From d2a3e0931a8f3b95b910096d022ffd98adbd075c Mon Sep 17 00:00:00 2001 From: Martin Kepplinger Date: Thu, 15 Oct 2015 15:10:32 +0200 Subject: [PATCH 001/843] iio: mma8452: support either of the available interrupt pins This change is important in order for everyone to be easily able to use the driver for one of the supported accelerometer chips! Until now, the driver blindly assumed that the INT1 interrupt line is wired on a user's board. But these devices have 2 interrupt lines and can route their interrupt sources to one of them. Now, if "INT2" is found and matches i2c_client->irq, INT2 will be used. The chip's default actually is INT2, which is why probably many boards will have it wired and can make use of this. Of course, this also falls back to assuming INT1, so for existing users nothing will break. The new functionality is described in the bindings doc. Signed-off-by: Martin Kepplinger For the binding: Acked-by: Rob Herring Signed-off-by: Jonathan Cameron --- .../devicetree/bindings/iio/accel/mma8452.txt | 6 ++++++ drivers/iio/accel/mma8452.c | 21 +++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/accel/mma8452.txt b/Documentation/devicetree/bindings/iio/accel/mma8452.txt index e3c37467d7da..3c10e8581144 100644 --- a/Documentation/devicetree/bindings/iio/accel/mma8452.txt +++ b/Documentation/devicetree/bindings/iio/accel/mma8452.txt @@ -7,13 +7,18 @@ Required properties: * "fsl,mma8453" * "fsl,mma8652" * "fsl,mma8653" + - reg: the I2C address of the chip Optional properties: - interrupt-parent: should be the phandle for the interrupt controller + - interrupts: interrupt mapping for GPIO IRQ + - interrupt-names: should contain "INT1" and/or "INT2", the accelerometer's + interrupt line in use. + Example: mma8453fc@1d { @@ -21,4 +26,5 @@ Example: reg = <0x1d>; interrupt-parent = <&gpio1>; interrupts = <5 0>; + interrupt-names = "INT2"; }; diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c index 1eccc2dcf14c..116a6e401a6a 100644 --- a/drivers/iio/accel/mma8452.c +++ b/drivers/iio/accel/mma8452.c @@ -29,6 +29,7 @@ #include #include #include +#include #define MMA8452_STATUS 0x00 #define MMA8452_STATUS_DRDY (BIT(2) | BIT(1) | BIT(0)) @@ -1130,13 +1131,21 @@ static int mma8452_probe(struct i2c_client *client, MMA8452_INT_FF_MT; int enabled_interrupts = MMA8452_INT_TRANS | MMA8452_INT_FF_MT; + int irq2; - /* Assume wired to INT1 pin */ - ret = i2c_smbus_write_byte_data(client, - MMA8452_CTRL_REG5, - supported_interrupts); - if (ret < 0) - return ret; + irq2 = of_irq_get_byname(client->dev.of_node, "INT2"); + + if (irq2 == client->irq) { + dev_dbg(&client->dev, "using interrupt line INT2\n"); + } else { + ret = i2c_smbus_write_byte_data(client, + MMA8452_CTRL_REG5, + supported_interrupts); + if (ret < 0) + return ret; + + dev_dbg(&client->dev, "using interrupt line INT1\n"); + } ret = i2c_smbus_write_byte_data(client, MMA8452_CTRL_REG4, From 75b6548f1793c7a79a8b063cd575df9c04dcc122 Mon Sep 17 00:00:00 2001 From: Teodora Baluta Date: Thu, 22 Oct 2015 15:44:50 +0300 Subject: [PATCH 002/843] iio: accel: add support for Memsic MXC6255XC sensor This patch adds a minimal implementation for the Memsic MXC6255XC orientation sensing accelerometer. The supported operations are reading raw acceleration values for X/Y axis that can be scaled using the exposed scale. Signed-off-by: Teodora Baluta Signed-off-by: Jonathan Cameron --- drivers/iio/accel/Kconfig | 11 ++ drivers/iio/accel/Makefile | 1 + drivers/iio/accel/mxc6255.c | 198 ++++++++++++++++++++++++++++++++++++ 3 files changed, 210 insertions(+) create mode 100644 drivers/iio/accel/mxc6255.c diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig index 969428dd6329..75ac08790bc5 100644 --- a/drivers/iio/accel/Kconfig +++ b/drivers/iio/accel/Kconfig @@ -158,6 +158,17 @@ config MXC4005 To compile this driver as a module, choose M. The module will be called mxc4005. +config MXC6255 + tristate "Memsic MXC6255 Orientation Sensing Accelerometer Driver" + depends on I2C + select REGMAP_I2C + help + Say yes here to build support for the Memsic MXC6255 Orientation + Sensing Accelerometer Driver. + + To compile this driver as a module, choose M here: the module will be + called mxc6255. + config STK8312 tristate "Sensortek STK8312 3-Axis Accelerometer Driver" depends on I2C diff --git a/drivers/iio/accel/Makefile b/drivers/iio/accel/Makefile index 7925f166e6e9..525ed52fab52 100644 --- a/drivers/iio/accel/Makefile +++ b/drivers/iio/accel/Makefile @@ -17,6 +17,7 @@ obj-$(CONFIG_MMA9551) += mma9551.o obj-$(CONFIG_MMA9553) += mma9553.o obj-$(CONFIG_MXC4005) += mxc4005.o +obj-$(CONFIG_MXC6255) += mxc6255.o obj-$(CONFIG_STK8312) += stk8312.o obj-$(CONFIG_STK8BA50) += stk8ba50.o diff --git a/drivers/iio/accel/mxc6255.c b/drivers/iio/accel/mxc6255.c new file mode 100644 index 000000000000..97ccde722e7b --- /dev/null +++ b/drivers/iio/accel/mxc6255.c @@ -0,0 +1,198 @@ +/* + * MXC6255 - MEMSIC orientation sensing accelerometer + * + * Copyright (c) 2015, Intel Corporation. + * + * This file is subject to the terms and conditions of version 2 of + * the GNU General Public License. See the file COPYING in the main + * directory of this archive for more details. + * + * IIO driver for MXC6255 (7-bit I2C slave address 0x15). + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define MXC6255_DRV_NAME "mxc6255" +#define MXC6255_REGMAP_NAME "mxc6255_regmap" + +#define MXC6255_REG_XOUT 0x00 +#define MXC6255_REG_YOUT 0x01 +#define MXC6255_REG_CHIP_ID 0x08 + +#define MXC6255_CHIP_ID 0x05 + +/* + * MXC6255 has only one measurement range: +/- 2G. + * The acceleration output is an 8-bit value. + * + * Scale is calculated as follows: + * (2 + 2) * 9.80665 / (2^8 - 1) = 0.153829 + * + * Scale value for +/- 2G measurement range + */ +#define MXC6255_SCALE 153829 + +enum mxc6255_axis { + AXIS_X, + AXIS_Y, +}; + +struct mxc6255_data { + struct i2c_client *client; + struct regmap *regmap; +}; + +static int mxc6255_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, int *val2, long mask) +{ + struct mxc6255_data *data = iio_priv(indio_dev); + unsigned int reg; + int ret; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + ret = regmap_read(data->regmap, chan->address, ®); + if (ret < 0) { + dev_err(&data->client->dev, + "Error reading reg %lu\n", chan->address); + return ret; + } + + *val = sign_extend32(reg, 7); + return IIO_VAL_INT; + case IIO_CHAN_INFO_SCALE: + *val = 0; + *val2 = MXC6255_SCALE; + return IIO_VAL_INT_PLUS_MICRO; + default: + return -EINVAL; + } +} + +static const struct iio_info mxc6255_info = { + .driver_module = THIS_MODULE, + .read_raw = mxc6255_read_raw, +}; + +#define MXC6255_CHANNEL(_axis, reg) { \ + .type = IIO_ACCEL, \ + .modified = 1, \ + .channel2 = IIO_MOD_##_axis, \ + .address = reg, \ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ +} + +static const struct iio_chan_spec mxc6255_channels[] = { + MXC6255_CHANNEL(X, MXC6255_REG_XOUT), + MXC6255_CHANNEL(Y, MXC6255_REG_YOUT), +}; + +static bool mxc6255_is_readable_reg(struct device *dev, unsigned int reg) +{ + switch (reg) { + case MXC6255_REG_XOUT: + case MXC6255_REG_YOUT: + case MXC6255_REG_CHIP_ID: + return true; + default: + return false; + } +} + +static const struct regmap_config mxc6255_regmap_config = { + .name = MXC6255_REGMAP_NAME, + + .reg_bits = 8, + .val_bits = 8, + + .readable_reg = mxc6255_is_readable_reg, +}; + +static int mxc6255_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct mxc6255_data *data; + struct iio_dev *indio_dev; + struct regmap *regmap; + unsigned int chip_id; + int ret; + + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); + if (!indio_dev) + return -ENOMEM; + + regmap = devm_regmap_init_i2c(client, &mxc6255_regmap_config); + if (IS_ERR(regmap)) { + dev_err(&client->dev, "Error initializing regmap\n"); + return PTR_ERR(regmap); + } + + data = iio_priv(indio_dev); + i2c_set_clientdata(client, indio_dev); + data->client = client; + data->regmap = regmap; + + indio_dev->name = MXC6255_DRV_NAME; + indio_dev->dev.parent = &client->dev; + indio_dev->channels = mxc6255_channels; + indio_dev->num_channels = ARRAY_SIZE(mxc6255_channels); + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->info = &mxc6255_info; + + ret = regmap_read(data->regmap, MXC6255_REG_CHIP_ID, &chip_id); + if (ret < 0) { + dev_err(&client->dev, "Error reading chip id %d\n", ret); + return ret; + } + + if (chip_id != MXC6255_CHIP_ID) { + dev_err(&client->dev, "Invalid chip id %x\n", chip_id); + return -ENODEV; + } + + dev_dbg(&client->dev, "Chip id %x\n", chip_id); + + ret = devm_iio_device_register(&client->dev, indio_dev); + if (ret < 0) { + dev_err(&client->dev, "Could not register IIO device\n"); + return ret; + } + + return 0; +} + +static const struct acpi_device_id mxc6255_acpi_match[] = { + {"MXC6255", 0}, + { } +}; +MODULE_DEVICE_TABLE(acpi, mxc6255_acpi_match); + +static const struct i2c_device_id mxc6255_id[] = { + {"mxc6255", 0}, + { } +}; +MODULE_DEVICE_TABLE(i2c, mxc6255_id); + +static struct i2c_driver mxc6255_driver = { + .driver = { + .name = MXC6255_DRV_NAME, + .acpi_match_table = ACPI_PTR(mxc6255_acpi_match), + }, + .probe = mxc6255_probe, + .id_table = mxc6255_id, +}; + +module_i2c_driver(mxc6255_driver); + +MODULE_AUTHOR("Teodora Baluta "); +MODULE_DESCRIPTION("MEMSIC MXC6255 orientation sensing accelerometer driver"); +MODULE_LICENSE("GPL v2"); From e08e19c331fb249e6dc86365ee80d16045c4aeb1 Mon Sep 17 00:00:00 2001 From: "H. Nikolaus Schaller" Date: Fri, 16 Oct 2015 14:53:38 +0200 Subject: [PATCH 003/843] iio:adc: add iio driver for Palmas (twl6035/7) gpadc This driver code was found as: https://android.googlesource.com/kernel/tegra/+/aaabb2e045f31e5a970109ffdaae900dd403d17e/drivers/staging/iio/adc Fixed various compilation issues and test this driver on omap5 evm. Signed-off-by: Pradeep Goudagunta Signed-off-by: H. Nikolaus Schaller Signed-off-by: Marek Belisko Acked-by: Laxman Dewangan Reviewed-by: Jonathan Cameron Acked-by: Lee Jones Signed-off-by: Jonathan Cameron --- drivers/iio/adc/Kconfig | 8 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/palmas_gpadc.c | 817 +++++++++++++++++++++++++++++++++ include/linux/mfd/palmas.h | 75 ++- 4 files changed, 877 insertions(+), 24 deletions(-) create mode 100644 drivers/iio/adc/palmas_gpadc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 7868c744fd4b..daad72e1266d 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -275,6 +275,14 @@ config NAU7802 To compile this driver as a module, choose M here: the module will be called nau7802. +config PALMAS_GPADC + tristate "TI Palmas General Purpose ADC" + depends on MFD_PALMAS + help + Palmas series pmic chip by Texas Instruments (twl6035/6037) + is used in smartphones and tablets and supports a 16 channel + general purpose ADC. + config QCOM_SPMI_IADC tristate "Qualcomm SPMI PMIC current ADC" depends on SPMI diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 99b37a963a1e..11cfdfd76798 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -27,6 +27,7 @@ obj-$(CONFIG_MCP320X) += mcp320x.o obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_NAU7802) += nau7802.o +obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o obj-$(CONFIG_QCOM_SPMI_VADC) += qcom-spmi-vadc.o obj-$(CONFIG_ROCKCHIP_SARADC) += rockchip_saradc.o diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c new file mode 100644 index 000000000000..71763c5da2ab --- /dev/null +++ b/drivers/iio/adc/palmas_gpadc.c @@ -0,0 +1,817 @@ +/* + * palmas-adc.c -- TI PALMAS GPADC. + * + * Copyright (c) 2013, NVIDIA Corporation. All rights reserved. + * + * Author: Pradeep Goudagunta + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation version 2. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MOD_NAME "palmas-gpadc" +#define PALMAS_ADC_CONVERSION_TIMEOUT (msecs_to_jiffies(5000)) +#define PALMAS_TO_BE_CALCULATED 0 +#define PALMAS_GPADC_TRIMINVALID -1 + +struct palmas_gpadc_info { +/* calibration codes and regs */ + int x1; /* lower ideal code */ + int x2; /* higher ideal code */ + int v1; /* expected lower volt reading */ + int v2; /* expected higher volt reading */ + u8 trim1_reg; /* register number for lower trim */ + u8 trim2_reg; /* register number for upper trim */ + int gain; /* calculated from above (after reading trim regs) */ + int offset; /* calculated from above (after reading trim regs) */ + int gain_error; /* calculated from above (after reading trim regs) */ + bool is_uncalibrated; /* if channel has calibration data */ +}; + +#define PALMAS_ADC_INFO(_chan, _x1, _x2, _v1, _v2, _t1, _t2, _is_uncalibrated) \ + [PALMAS_ADC_CH_##_chan] = { \ + .x1 = _x1, \ + .x2 = _x2, \ + .v1 = _v1, \ + .v2 = _v2, \ + .gain = PALMAS_TO_BE_CALCULATED, \ + .offset = PALMAS_TO_BE_CALCULATED, \ + .gain_error = PALMAS_TO_BE_CALCULATED, \ + .trim1_reg = PALMAS_GPADC_TRIM##_t1, \ + .trim2_reg = PALMAS_GPADC_TRIM##_t2, \ + .is_uncalibrated = _is_uncalibrated \ + } + +static struct palmas_gpadc_info palmas_gpadc_info[] = { + PALMAS_ADC_INFO(IN0, 2064, 3112, 630, 950, 1, 2, false), + PALMAS_ADC_INFO(IN1, 2064, 3112, 630, 950, 1, 2, false), + PALMAS_ADC_INFO(IN2, 2064, 3112, 1260, 1900, 3, 4, false), + PALMAS_ADC_INFO(IN3, 2064, 3112, 630, 950, 1, 2, false), + PALMAS_ADC_INFO(IN4, 2064, 3112, 630, 950, 1, 2, false), + PALMAS_ADC_INFO(IN5, 2064, 3112, 630, 950, 1, 2, false), + PALMAS_ADC_INFO(IN6, 2064, 3112, 2520, 3800, 5, 6, false), + PALMAS_ADC_INFO(IN7, 2064, 3112, 2520, 3800, 7, 8, false), + PALMAS_ADC_INFO(IN8, 2064, 3112, 3150, 4750, 9, 10, false), + PALMAS_ADC_INFO(IN9, 2064, 3112, 5670, 8550, 11, 12, false), + PALMAS_ADC_INFO(IN10, 2064, 3112, 3465, 5225, 13, 14, false), + PALMAS_ADC_INFO(IN11, 0, 0, 0, 0, INVALID, INVALID, true), + PALMAS_ADC_INFO(IN12, 0, 0, 0, 0, INVALID, INVALID, true), + PALMAS_ADC_INFO(IN13, 0, 0, 0, 0, INVALID, INVALID, true), + PALMAS_ADC_INFO(IN14, 2064, 3112, 3645, 5225, 15, 16, false), + PALMAS_ADC_INFO(IN15, 0, 0, 0, 0, INVALID, INVALID, true), +}; + +/** + * struct palmas_gpadc - the palmas_gpadc structure + * @ch0_current: channel 0 current source setting + * 0: 0 uA + * 1: 5 uA + * 2: 15 uA + * 3: 20 uA + * @ch3_current: channel 0 current source setting + * 0: 0 uA + * 1: 10 uA + * 2: 400 uA + * 3: 800 uA + * @extended_delay: enable the gpadc extended delay mode + * @auto_conversion_period: define the auto_conversion_period + * + * This is the palmas_gpadc structure to store run-time information + * and pointers for this driver instance. + */ + +struct palmas_gpadc { + struct device *dev; + struct palmas *palmas; + u8 ch0_current; + u8 ch3_current; + bool extended_delay; + int irq; + int irq_auto_0; + int irq_auto_1; + struct palmas_gpadc_info *adc_info; + struct completion conv_completion; + struct palmas_adc_wakeup_property wakeup1_data; + struct palmas_adc_wakeup_property wakeup2_data; + bool wakeup1_enable; + bool wakeup2_enable; + int auto_conversion_period; +}; + +/* + * GPADC lock issue in AUTO mode. + * Impact: In AUTO mode, GPADC conversion can be locked after disabling AUTO + * mode feature. + * Details: + * When the AUTO mode is the only conversion mode enabled, if the AUTO + * mode feature is disabled with bit GPADC_AUTO_CTRL. AUTO_CONV1_EN = 0 + * or bit GPADC_AUTO_CTRL. AUTO_CONV0_EN = 0 during a conversion, the + * conversion mechanism can be seen as locked meaning that all following + * conversion will give 0 as a result. Bit GPADC_STATUS.GPADC_AVAILABLE + * will stay at 0 meaning that GPADC is busy. An RT conversion can unlock + * the GPADC. + * + * Workaround(s): + * To avoid the lock mechanism, the workaround to follow before any stop + * conversion request is: + * Force the GPADC state machine to be ON by using the GPADC_CTRL1. + * GPADC_FORCE bit = 1 + * Shutdown the GPADC AUTO conversion using + * GPADC_AUTO_CTRL.SHUTDOWN_CONV[01] = 0. + * After 100us, force the GPADC state machine to be OFF by using the + * GPADC_CTRL1. GPADC_FORCE bit = 0 + */ + +static int palmas_disable_auto_conversion(struct palmas_gpadc *adc) +{ + int ret; + + ret = palmas_update_bits(adc->palmas, PALMAS_GPADC_BASE, + PALMAS_GPADC_CTRL1, + PALMAS_GPADC_CTRL1_GPADC_FORCE, + PALMAS_GPADC_CTRL1_GPADC_FORCE); + if (ret < 0) { + dev_err(adc->dev, "GPADC_CTRL1 update failed: %d\n", ret); + return ret; + } + + ret = palmas_update_bits(adc->palmas, PALMAS_GPADC_BASE, + PALMAS_GPADC_AUTO_CTRL, + PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV1 | + PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV0, + 0); + if (ret < 0) { + dev_err(adc->dev, "AUTO_CTRL update failed: %d\n", ret); + return ret; + } + + udelay(100); + + ret = palmas_update_bits(adc->palmas, PALMAS_GPADC_BASE, + PALMAS_GPADC_CTRL1, + PALMAS_GPADC_CTRL1_GPADC_FORCE, 0); + if (ret < 0) + dev_err(adc->dev, "GPADC_CTRL1 update failed: %d\n", ret); + + return ret; +} + +static irqreturn_t palmas_gpadc_irq(int irq, void *data) +{ + struct palmas_gpadc *adc = data; + + complete(&adc->conv_completion); + + return IRQ_HANDLED; +} + +static irqreturn_t palmas_gpadc_irq_auto(int irq, void *data) +{ + struct palmas_gpadc *adc = data; + + dev_dbg(adc->dev, "Threshold interrupt %d occurs\n", irq); + palmas_disable_auto_conversion(adc); + + return IRQ_HANDLED; +} + +static int palmas_gpadc_start_mask_interrupt(struct palmas_gpadc *adc, + bool mask) +{ + int ret; + + if (!mask) + ret = palmas_update_bits(adc->palmas, PALMAS_INTERRUPT_BASE, + PALMAS_INT3_MASK, + PALMAS_INT3_MASK_GPADC_EOC_SW, 0); + else + ret = palmas_update_bits(adc->palmas, PALMAS_INTERRUPT_BASE, + PALMAS_INT3_MASK, + PALMAS_INT3_MASK_GPADC_EOC_SW, + PALMAS_INT3_MASK_GPADC_EOC_SW); + if (ret < 0) + dev_err(adc->dev, "GPADC INT MASK update failed: %d\n", ret); + + return ret; +} + +static int palmas_gpadc_enable(struct palmas_gpadc *adc, int adc_chan, + int enable) +{ + unsigned int mask, val; + int ret; + + if (enable) { + val = (adc->extended_delay + << PALMAS_GPADC_RT_CTRL_EXTEND_DELAY_SHIFT); + ret = palmas_update_bits(adc->palmas, PALMAS_GPADC_BASE, + PALMAS_GPADC_RT_CTRL, + PALMAS_GPADC_RT_CTRL_EXTEND_DELAY, val); + if (ret < 0) { + dev_err(adc->dev, "RT_CTRL update failed: %d\n", ret); + return ret; + } + + mask = (PALMAS_GPADC_CTRL1_CURRENT_SRC_CH0_MASK | + PALMAS_GPADC_CTRL1_CURRENT_SRC_CH3_MASK | + PALMAS_GPADC_CTRL1_GPADC_FORCE); + val = (adc->ch0_current + << PALMAS_GPADC_CTRL1_CURRENT_SRC_CH0_SHIFT); + val |= (adc->ch3_current + << PALMAS_GPADC_CTRL1_CURRENT_SRC_CH3_SHIFT); + val |= PALMAS_GPADC_CTRL1_GPADC_FORCE; + ret = palmas_update_bits(adc->palmas, PALMAS_GPADC_BASE, + PALMAS_GPADC_CTRL1, mask, val); + if (ret < 0) { + dev_err(adc->dev, + "Failed to update current setting: %d\n", ret); + return ret; + } + + mask = (PALMAS_GPADC_SW_SELECT_SW_CONV0_SEL_MASK | + PALMAS_GPADC_SW_SELECT_SW_CONV_EN); + val = (adc_chan | PALMAS_GPADC_SW_SELECT_SW_CONV_EN); + ret = palmas_update_bits(adc->palmas, PALMAS_GPADC_BASE, + PALMAS_GPADC_SW_SELECT, mask, val); + if (ret < 0) { + dev_err(adc->dev, "SW_SELECT update failed: %d\n", ret); + return ret; + } + } else { + ret = palmas_write(adc->palmas, PALMAS_GPADC_BASE, + PALMAS_GPADC_SW_SELECT, 0); + if (ret < 0) + dev_err(adc->dev, "SW_SELECT write failed: %d\n", ret); + + ret = palmas_update_bits(adc->palmas, PALMAS_GPADC_BASE, + PALMAS_GPADC_CTRL1, + PALMAS_GPADC_CTRL1_GPADC_FORCE, 0); + if (ret < 0) { + dev_err(adc->dev, "CTRL1 update failed: %d\n", ret); + return ret; + } + } + + return ret; +} + +static int palmas_gpadc_read_prepare(struct palmas_gpadc *adc, int adc_chan) +{ + int ret; + + ret = palmas_gpadc_enable(adc, adc_chan, true); + if (ret < 0) + return ret; + + return palmas_gpadc_start_mask_interrupt(adc, 0); +} + +static void palmas_gpadc_read_done(struct palmas_gpadc *adc, int adc_chan) +{ + palmas_gpadc_start_mask_interrupt(adc, 1); + palmas_gpadc_enable(adc, adc_chan, false); +} + +static int palmas_gpadc_calibrate(struct palmas_gpadc *adc, int adc_chan) +{ + int k; + int d1; + int d2; + int ret; + int gain; + int x1 = adc->adc_info[adc_chan].x1; + int x2 = adc->adc_info[adc_chan].x2; + int v1 = adc->adc_info[adc_chan].v1; + int v2 = adc->adc_info[adc_chan].v2; + + ret = palmas_read(adc->palmas, PALMAS_TRIM_GPADC_BASE, + adc->adc_info[adc_chan].trim1_reg, &d1); + if (ret < 0) { + dev_err(adc->dev, "TRIM read failed: %d\n", ret); + goto scrub; + } + + ret = palmas_read(adc->palmas, PALMAS_TRIM_GPADC_BASE, + adc->adc_info[adc_chan].trim2_reg, &d2); + if (ret < 0) { + dev_err(adc->dev, "TRIM read failed: %d\n", ret); + goto scrub; + } + + /* gain error calculation */ + k = (1000 + (1000 * (d2 - d1)) / (x2 - x1)); + + /* gain calculation */ + gain = ((v2 - v1) * 1000) / (x2 - x1); + + adc->adc_info[adc_chan].gain_error = k; + adc->adc_info[adc_chan].gain = gain; + /* offset Calculation */ + adc->adc_info[adc_chan].offset = (d1 * 1000) - ((k - 1000) * x1); + +scrub: + return ret; +} + +static int palmas_gpadc_start_conversion(struct palmas_gpadc *adc, int adc_chan) +{ + unsigned int val; + int ret; + + init_completion(&adc->conv_completion); + ret = palmas_update_bits(adc->palmas, PALMAS_GPADC_BASE, + PALMAS_GPADC_SW_SELECT, + PALMAS_GPADC_SW_SELECT_SW_START_CONV0, + PALMAS_GPADC_SW_SELECT_SW_START_CONV0); + if (ret < 0) { + dev_err(adc->dev, "SELECT_SW_START write failed: %d\n", ret); + return ret; + } + + ret = wait_for_completion_timeout(&adc->conv_completion, + PALMAS_ADC_CONVERSION_TIMEOUT); + if (ret == 0) { + dev_err(adc->dev, "conversion not completed\n"); + return -ETIMEDOUT; + } + + ret = palmas_bulk_read(adc->palmas, PALMAS_GPADC_BASE, + PALMAS_GPADC_SW_CONV0_LSB, &val, 2); + if (ret < 0) { + dev_err(adc->dev, "SW_CONV0_LSB read failed: %d\n", ret); + return ret; + } + + ret = val & 0xFFF; + + return ret; +} + +static int palmas_gpadc_get_calibrated_code(struct palmas_gpadc *adc, + int adc_chan, int val) +{ + if (!adc->adc_info[adc_chan].is_uncalibrated) + val = (val*1000 - adc->adc_info[adc_chan].offset) / + adc->adc_info[adc_chan].gain_error; + + if (val < 0) { + dev_err(adc->dev, "Mismatch with calibration\n"); + return 0; + } + + val = (val * adc->adc_info[adc_chan].gain) / 1000; + + return val; +} + +static int palmas_gpadc_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int *val, int *val2, long mask) +{ + struct palmas_gpadc *adc = iio_priv(indio_dev); + int adc_chan = chan->channel; + int ret = 0; + + if (adc_chan > PALMAS_ADC_CH_MAX) + return -EINVAL; + + mutex_lock(&indio_dev->mlock); + + switch (mask) { + case IIO_CHAN_INFO_RAW: + case IIO_CHAN_INFO_PROCESSED: + ret = palmas_gpadc_read_prepare(adc, adc_chan); + if (ret < 0) + goto out; + + ret = palmas_gpadc_start_conversion(adc, adc_chan); + if (ret < 0) { + dev_err(adc->dev, + "ADC start conversion failed\n"); + goto out; + } + + if (mask == IIO_CHAN_INFO_PROCESSED) + ret = palmas_gpadc_get_calibrated_code( + adc, adc_chan, ret); + + *val = ret; + + ret = IIO_VAL_INT; + goto out; + } + + mutex_unlock(&indio_dev->mlock); + return ret; + +out: + palmas_gpadc_read_done(adc, adc_chan); + mutex_unlock(&indio_dev->mlock); + + return ret; +} + +static const struct iio_info palmas_gpadc_iio_info = { + .read_raw = palmas_gpadc_read_raw, + .driver_module = THIS_MODULE, +}; + +#define PALMAS_ADC_CHAN_IIO(chan, _type, chan_info) \ +{ \ + .datasheet_name = PALMAS_DATASHEET_NAME(chan), \ + .type = _type, \ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ + BIT(chan_info), \ + .indexed = 1, \ + .channel = PALMAS_ADC_CH_##chan, \ +} + +static const struct iio_chan_spec palmas_gpadc_iio_channel[] = { + PALMAS_ADC_CHAN_IIO(IN0, IIO_VOLTAGE, IIO_CHAN_INFO_PROCESSED), + PALMAS_ADC_CHAN_IIO(IN1, IIO_TEMP, IIO_CHAN_INFO_RAW), + PALMAS_ADC_CHAN_IIO(IN2, IIO_VOLTAGE, IIO_CHAN_INFO_PROCESSED), + PALMAS_ADC_CHAN_IIO(IN3, IIO_TEMP, IIO_CHAN_INFO_RAW), + PALMAS_ADC_CHAN_IIO(IN4, IIO_VOLTAGE, IIO_CHAN_INFO_PROCESSED), + PALMAS_ADC_CHAN_IIO(IN5, IIO_VOLTAGE, IIO_CHAN_INFO_PROCESSED), + PALMAS_ADC_CHAN_IIO(IN6, IIO_VOLTAGE, IIO_CHAN_INFO_PROCESSED), + PALMAS_ADC_CHAN_IIO(IN7, IIO_VOLTAGE, IIO_CHAN_INFO_PROCESSED), + PALMAS_ADC_CHAN_IIO(IN8, IIO_VOLTAGE, IIO_CHAN_INFO_PROCESSED), + PALMAS_ADC_CHAN_IIO(IN9, IIO_VOLTAGE, IIO_CHAN_INFO_PROCESSED), + PALMAS_ADC_CHAN_IIO(IN10, IIO_VOLTAGE, IIO_CHAN_INFO_PROCESSED), + PALMAS_ADC_CHAN_IIO(IN11, IIO_VOLTAGE, IIO_CHAN_INFO_PROCESSED), + PALMAS_ADC_CHAN_IIO(IN12, IIO_TEMP, IIO_CHAN_INFO_RAW), + PALMAS_ADC_CHAN_IIO(IN13, IIO_TEMP, IIO_CHAN_INFO_RAW), + PALMAS_ADC_CHAN_IIO(IN14, IIO_VOLTAGE, IIO_CHAN_INFO_PROCESSED), + PALMAS_ADC_CHAN_IIO(IN15, IIO_VOLTAGE, IIO_CHAN_INFO_PROCESSED), +}; + +static int palmas_gpadc_probe(struct platform_device *pdev) +{ + struct palmas_gpadc *adc; + struct palmas_platform_data *pdata; + struct palmas_gpadc_platform_data *gpadc_pdata = NULL; + struct iio_dev *indio_dev; + int ret, i; + + pdata = dev_get_platdata(pdev->dev.parent); + if (!pdata || !pdata->gpadc_pdata) { + dev_err(&pdev->dev, "No platform data\n"); + return -ENODEV; + } + + gpadc_pdata = pdata->gpadc_pdata; + + indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*adc)); + if (!indio_dev) { + dev_err(&pdev->dev, "iio_device_alloc failed\n"); + return -ENOMEM; + } + + adc = iio_priv(indio_dev); + adc->dev = &pdev->dev; + adc->palmas = dev_get_drvdata(pdev->dev.parent); + adc->adc_info = palmas_gpadc_info; + init_completion(&adc->conv_completion); + dev_set_drvdata(&pdev->dev, indio_dev); + + adc->auto_conversion_period = gpadc_pdata->auto_conversion_period_ms; + adc->irq = palmas_irq_get_virq(adc->palmas, PALMAS_GPADC_EOC_SW_IRQ); + if (adc->irq < 0) { + dev_err(adc->dev, + "get virq failed: %d\n", adc->irq); + ret = adc->irq; + goto out; + } + ret = request_threaded_irq(adc->irq, NULL, + palmas_gpadc_irq, + IRQF_ONESHOT | IRQF_EARLY_RESUME, dev_name(adc->dev), + adc); + if (ret < 0) { + dev_err(adc->dev, + "request irq %d failed: %d\n", adc->irq, ret); + goto out; + } + + if (gpadc_pdata->adc_wakeup1_data) { + memcpy(&adc->wakeup1_data, gpadc_pdata->adc_wakeup1_data, + sizeof(adc->wakeup1_data)); + adc->wakeup1_enable = true; + adc->irq_auto_0 = platform_get_irq(pdev, 1); + ret = request_threaded_irq(adc->irq_auto_0, NULL, + palmas_gpadc_irq_auto, + IRQF_ONESHOT | IRQF_EARLY_RESUME, + "palmas-adc-auto-0", adc); + if (ret < 0) { + dev_err(adc->dev, "request auto0 irq %d failed: %d\n", + adc->irq_auto_0, ret); + goto out_irq_free; + } + } + + if (gpadc_pdata->adc_wakeup2_data) { + memcpy(&adc->wakeup2_data, gpadc_pdata->adc_wakeup2_data, + sizeof(adc->wakeup2_data)); + adc->wakeup2_enable = true; + adc->irq_auto_1 = platform_get_irq(pdev, 2); + ret = request_threaded_irq(adc->irq_auto_1, NULL, + palmas_gpadc_irq_auto, + IRQF_ONESHOT | IRQF_EARLY_RESUME, + "palmas-adc-auto-1", adc); + if (ret < 0) { + dev_err(adc->dev, "request auto1 irq %d failed: %d\n", + adc->irq_auto_1, ret); + goto out_irq_auto0_free; + } + } + + /* set the current source 0 (value 0/5/15/20 uA => 0..3) */ + if (gpadc_pdata->ch0_current <= 1) + adc->ch0_current = PALMAS_ADC_CH0_CURRENT_SRC_0; + else if (gpadc_pdata->ch0_current <= 5) + adc->ch0_current = PALMAS_ADC_CH0_CURRENT_SRC_5; + else if (gpadc_pdata->ch0_current <= 15) + adc->ch0_current = PALMAS_ADC_CH0_CURRENT_SRC_15; + else + adc->ch0_current = PALMAS_ADC_CH0_CURRENT_SRC_20; + + /* set the current source 3 (value 0/10/400/800 uA => 0..3) */ + if (gpadc_pdata->ch3_current <= 1) + adc->ch3_current = PALMAS_ADC_CH3_CURRENT_SRC_0; + else if (gpadc_pdata->ch3_current <= 10) + adc->ch3_current = PALMAS_ADC_CH3_CURRENT_SRC_10; + else if (gpadc_pdata->ch3_current <= 400) + adc->ch3_current = PALMAS_ADC_CH3_CURRENT_SRC_400; + else + adc->ch3_current = PALMAS_ADC_CH3_CURRENT_SRC_800; + + adc->extended_delay = gpadc_pdata->extended_delay; + + indio_dev->name = MOD_NAME; + indio_dev->dev.parent = &pdev->dev; + indio_dev->info = &palmas_gpadc_iio_info; + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->channels = palmas_gpadc_iio_channel; + indio_dev->num_channels = ARRAY_SIZE(palmas_gpadc_iio_channel); + + ret = iio_device_register(indio_dev); + if (ret < 0) { + dev_err(adc->dev, "iio_device_register() failed: %d\n", ret); + goto out_irq_auto1_free; + } + + device_set_wakeup_capable(&pdev->dev, 1); + for (i = 0; i < PALMAS_ADC_CH_MAX; i++) { + if (!(adc->adc_info[i].is_uncalibrated)) + palmas_gpadc_calibrate(adc, i); + } + + if (adc->wakeup1_enable || adc->wakeup2_enable) + device_wakeup_enable(&pdev->dev); + + return 0; + +out_irq_auto1_free: + if (gpadc_pdata->adc_wakeup2_data) + free_irq(adc->irq_auto_1, adc); +out_irq_auto0_free: + if (gpadc_pdata->adc_wakeup1_data) + free_irq(adc->irq_auto_0, adc); +out_irq_free: + free_irq(adc->irq, adc); +out: + return ret; +} + +static int palmas_gpadc_remove(struct platform_device *pdev) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(&pdev->dev); + struct palmas_gpadc *adc = iio_priv(indio_dev); + + if (adc->wakeup1_enable || adc->wakeup2_enable) + device_wakeup_disable(&pdev->dev); + iio_device_unregister(indio_dev); + free_irq(adc->irq, adc); + if (adc->wakeup1_enable) + free_irq(adc->irq_auto_0, adc); + if (adc->wakeup2_enable) + free_irq(adc->irq_auto_1, adc); + + return 0; +} + +#ifdef CONFIG_PM_SLEEP +static int palmas_adc_wakeup_configure(struct palmas_gpadc *adc) +{ + int adc_period, conv; + int i; + int ch0 = 0, ch1 = 0; + int thres; + int ret; + + adc_period = adc->auto_conversion_period; + for (i = 0; i < 16; ++i) { + if (((1000 * (1 << i)) / 32) < adc_period) + continue; + } + if (i > 0) + i--; + adc_period = i; + ret = palmas_update_bits(adc->palmas, PALMAS_GPADC_BASE, + PALMAS_GPADC_AUTO_CTRL, + PALMAS_GPADC_AUTO_CTRL_COUNTER_CONV_MASK, + adc_period); + if (ret < 0) { + dev_err(adc->dev, "AUTO_CTRL write failed: %d\n", ret); + return ret; + } + + conv = 0; + if (adc->wakeup1_enable) { + int polarity; + + ch0 = adc->wakeup1_data.adc_channel_number; + conv |= PALMAS_GPADC_AUTO_CTRL_AUTO_CONV0_EN; + if (adc->wakeup1_data.adc_high_threshold > 0) { + thres = adc->wakeup1_data.adc_high_threshold; + polarity = 0; + } else { + thres = adc->wakeup1_data.adc_low_threshold; + polarity = PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_POL; + } + + ret = palmas_write(adc->palmas, PALMAS_GPADC_BASE, + PALMAS_GPADC_THRES_CONV0_LSB, thres & 0xFF); + if (ret < 0) { + dev_err(adc->dev, + "THRES_CONV0_LSB write failed: %d\n", ret); + return ret; + } + + ret = palmas_write(adc->palmas, PALMAS_GPADC_BASE, + PALMAS_GPADC_THRES_CONV0_MSB, + ((thres >> 8) & 0xF) | polarity); + if (ret < 0) { + dev_err(adc->dev, + "THRES_CONV0_MSB write failed: %d\n", ret); + return ret; + } + } + + if (adc->wakeup2_enable) { + int polarity; + + ch1 = adc->wakeup2_data.adc_channel_number; + conv |= PALMAS_GPADC_AUTO_CTRL_AUTO_CONV1_EN; + if (adc->wakeup2_data.adc_high_threshold > 0) { + thres = adc->wakeup2_data.adc_high_threshold; + polarity = 0; + } else { + thres = adc->wakeup2_data.adc_low_threshold; + polarity = PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_POL; + } + + ret = palmas_write(adc->palmas, PALMAS_GPADC_BASE, + PALMAS_GPADC_THRES_CONV1_LSB, thres & 0xFF); + if (ret < 0) { + dev_err(adc->dev, + "THRES_CONV1_LSB write failed: %d\n", ret); + return ret; + } + + ret = palmas_write(adc->palmas, PALMAS_GPADC_BASE, + PALMAS_GPADC_THRES_CONV1_MSB, + ((thres >> 8) & 0xF) | polarity); + if (ret < 0) { + dev_err(adc->dev, + "THRES_CONV1_MSB write failed: %d\n", ret); + return ret; + } + } + + ret = palmas_write(adc->palmas, PALMAS_GPADC_BASE, + PALMAS_GPADC_AUTO_SELECT, (ch1 << 4) | ch0); + if (ret < 0) { + dev_err(adc->dev, "AUTO_SELECT write failed: %d\n", ret); + return ret; + } + + ret = palmas_update_bits(adc->palmas, PALMAS_GPADC_BASE, + PALMAS_GPADC_AUTO_CTRL, + PALMAS_GPADC_AUTO_CTRL_AUTO_CONV1_EN | + PALMAS_GPADC_AUTO_CTRL_AUTO_CONV0_EN, conv); + if (ret < 0) + dev_err(adc->dev, "AUTO_CTRL write failed: %d\n", ret); + + return ret; +} + +static int palmas_adc_wakeup_reset(struct palmas_gpadc *adc) +{ + int ret; + + ret = palmas_write(adc->palmas, PALMAS_GPADC_BASE, + PALMAS_GPADC_AUTO_SELECT, 0); + if (ret < 0) { + dev_err(adc->dev, "AUTO_SELECT write failed: %d\n", ret); + return ret; + } + + ret = palmas_disable_auto_conversion(adc); + if (ret < 0) + dev_err(adc->dev, "Disable auto conversion failed: %d\n", ret); + + return ret; +} + +static int palmas_gpadc_suspend(struct device *dev) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + struct palmas_gpadc *adc = iio_priv(indio_dev); + int wakeup = adc->wakeup1_enable || adc->wakeup2_enable; + int ret; + + if (!device_may_wakeup(dev) || !wakeup) + return 0; + + ret = palmas_adc_wakeup_configure(adc); + if (ret < 0) + return ret; + + if (adc->wakeup1_enable) + enable_irq_wake(adc->irq_auto_0); + + if (adc->wakeup2_enable) + enable_irq_wake(adc->irq_auto_1); + + return 0; +} + +static int palmas_gpadc_resume(struct device *dev) +{ + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + struct palmas_gpadc *adc = iio_priv(indio_dev); + int wakeup = adc->wakeup1_enable || adc->wakeup2_enable; + int ret; + + if (!device_may_wakeup(dev) || !wakeup) + return 0; + + ret = palmas_adc_wakeup_reset(adc); + if (ret < 0) + return ret; + + if (adc->wakeup1_enable) + disable_irq_wake(adc->irq_auto_0); + + if (adc->wakeup2_enable) + disable_irq_wake(adc->irq_auto_1); + + return 0; +}; +#endif + +static const struct dev_pm_ops palmas_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(palmas_gpadc_suspend, + palmas_gpadc_resume) +}; + +static struct platform_driver palmas_gpadc_driver = { + .probe = palmas_gpadc_probe, + .remove = palmas_gpadc_remove, + .driver = { + .name = MOD_NAME, + .pm = &palmas_pm_ops, + }, +}; + +static int __init palmas_gpadc_init(void) +{ + return platform_driver_register(&palmas_gpadc_driver); +} +module_init(palmas_gpadc_init); + +static void __exit palmas_gpadc_exit(void) +{ + platform_driver_unregister(&palmas_gpadc_driver); +} +module_exit(palmas_gpadc_exit); + +MODULE_DESCRIPTION("palmas GPADC driver"); +MODULE_AUTHOR("Pradeep Goudagunta"); +MODULE_ALIAS("platform:palmas-gpadc"); +MODULE_LICENSE("GPL v2"); diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h index 13e1d96935ed..c800dbc42079 100644 --- a/include/linux/mfd/palmas.h +++ b/include/linux/mfd/palmas.h @@ -134,21 +134,32 @@ struct palmas_pmic_driver_data { struct regulator_config config); }; +struct palmas_adc_wakeup_property { + int adc_channel_number; + int adc_high_threshold; + int adc_low_threshold; +}; + struct palmas_gpadc_platform_data { /* Channel 3 current source is only enabled during conversion */ - int ch3_current; + int ch3_current; /* 0: off; 1: 10uA; 2: 400uA; 3: 800 uA */ /* Channel 0 current source can be used for battery detection. * If used for battery detection this will cause a permanent current * consumption depending on current level set here. */ - int ch0_current; + int ch0_current; /* 0: off; 1: 5uA; 2: 15uA; 3: 20 uA */ + bool extended_delay; /* use extended delay for conversion */ /* default BAT_REMOVAL_DAT setting on device probe */ int bat_removal; /* Sets the START_POLARITY bit in the RT_CTRL register */ int start_polarity; + + int auto_conversion_period_ms; + struct palmas_adc_wakeup_property *adc_wakeup1_data; + struct palmas_adc_wakeup_property *adc_wakeup2_data; }; struct palmas_reg_init { @@ -405,28 +416,7 @@ struct palmas_gpadc_calibration { s32 offset_error; }; -struct palmas_gpadc { - struct device *dev; - struct palmas *palmas; - - int ch3_current; - int ch0_current; - - int gpadc_force; - - int bat_removal; - - struct mutex reading_lock; - struct completion irq_complete; - - int eoc_sw_irq; - - struct palmas_gpadc_calibration *palmas_cal_tbl; - - int conv0_channel; - int conv1_channel; - int rt_channel; -}; +#define PALMAS_DATASHEET_NAME(_name) "palmas-gpadc-chan-"#_name struct palmas_gpadc_result { s32 raw_code; @@ -520,6 +510,43 @@ enum palmas_irqs { PALMAS_NUM_IRQ, }; +/* Palmas GPADC Channels */ +enum { + PALMAS_ADC_CH_IN0, + PALMAS_ADC_CH_IN1, + PALMAS_ADC_CH_IN2, + PALMAS_ADC_CH_IN3, + PALMAS_ADC_CH_IN4, + PALMAS_ADC_CH_IN5, + PALMAS_ADC_CH_IN6, + PALMAS_ADC_CH_IN7, + PALMAS_ADC_CH_IN8, + PALMAS_ADC_CH_IN9, + PALMAS_ADC_CH_IN10, + PALMAS_ADC_CH_IN11, + PALMAS_ADC_CH_IN12, + PALMAS_ADC_CH_IN13, + PALMAS_ADC_CH_IN14, + PALMAS_ADC_CH_IN15, + PALMAS_ADC_CH_MAX, +}; + +/* Palmas GPADC Channel0 Current Source */ +enum { + PALMAS_ADC_CH0_CURRENT_SRC_0, + PALMAS_ADC_CH0_CURRENT_SRC_5, + PALMAS_ADC_CH0_CURRENT_SRC_15, + PALMAS_ADC_CH0_CURRENT_SRC_20, +}; + +/* Palmas GPADC Channel3 Current Source */ +enum { + PALMAS_ADC_CH3_CURRENT_SRC_0, + PALMAS_ADC_CH3_CURRENT_SRC_10, + PALMAS_ADC_CH3_CURRENT_SRC_400, + PALMAS_ADC_CH3_CURRENT_SRC_800, +}; + struct palmas_pmic { struct palmas *palmas; struct device *dev; From f0b1643581b376ebd97a0068cbc3d146d6abdff1 Mon Sep 17 00:00:00 2001 From: Marek Belisko Date: Fri, 16 Oct 2015 14:53:39 +0200 Subject: [PATCH 004/843] iio:adc:palmas: add DT support Code was found at: https://android.googlesource.com/kernel/tegra/+/a90856a6626d502d42c6e7abccbdf9d730b36270%5E%21/#F1 Signed-off-by: Laxman Dewangan Signed-off-by: Marek Belisko [Fixed minor typos + add channels list to documentation] Signed-off-by: Jonathan Cameron --- .../bindings/iio/adc/palmas-gpadc.txt | 48 +++++++++++++++++ drivers/iio/adc/palmas_gpadc.c | 52 +++++++++++++++++-- 2 files changed, 95 insertions(+), 5 deletions(-) create mode 100644 Documentation/devicetree/bindings/iio/adc/palmas-gpadc.txt diff --git a/Documentation/devicetree/bindings/iio/adc/palmas-gpadc.txt b/Documentation/devicetree/bindings/iio/adc/palmas-gpadc.txt new file mode 100644 index 000000000000..4bb9a86065d1 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/palmas-gpadc.txt @@ -0,0 +1,48 @@ +* Palmas general purpose ADC IP block devicetree bindings + +Channels list: + 0 battery type + 1 battery temp NTC (optional current source) + 2 GP + 3 temp (with ext. diode, optional current source) + 4 GP + 5 GP + 6 VBAT_SENSE + 7 VCC_SENSE + 8 Backup Battery voltage + 9 external charger (VCHG) + 10 VBUS + 11 DC-DC current probe (how does this work?) + 12 internal die temp + 13 internal die temp + 14 USB ID pin voltage + 15 test network + +Required properties: +- compatible : Must be "ti,palmas-gpadc". +- #io-channel-cells: Should be set to <1>. + +Optional sub-nodes: +ti,channel0-current-microamp: Channel 0 current in uA. + Values are rounded to derive 0uA, 5uA, 15uA, 20uA. +ti,channel3-current-microamp: Channel 3 current in uA. + Values are rounded to derive 0uA, 10uA, 400uA, 800uA. +ti,enable-extended-delay: Enable extended delay. + +Example: + +pmic { + compatible = "ti,twl6035-pmic", "ti,palmas-pmic"; + ... + gpadc { + compatible = "ti,palmas-gpadc"; + interrupts = <18 0 + 16 0 + 17 0>; + #io-channel-cells = <1>; + ti,channel0-current-microamp = <5>; + ti,channel3-current-microamp = <10>; + }; + }; + ... +}; diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c index 71763c5da2ab..f42eb8a7d21f 100644 --- a/drivers/iio/adc/palmas_gpadc.c +++ b/drivers/iio/adc/palmas_gpadc.c @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include #include #include @@ -460,6 +462,34 @@ static const struct iio_chan_spec palmas_gpadc_iio_channel[] = { PALMAS_ADC_CHAN_IIO(IN15, IIO_VOLTAGE, IIO_CHAN_INFO_PROCESSED), }; +static int palmas_gpadc_get_adc_dt_data(struct platform_device *pdev, + struct palmas_gpadc_platform_data **gpadc_pdata) +{ + struct device_node *np = pdev->dev.of_node; + struct palmas_gpadc_platform_data *gp_data; + int ret; + u32 pval; + + gp_data = devm_kzalloc(&pdev->dev, sizeof(*gp_data), GFP_KERNEL); + if (!gp_data) + return -ENOMEM; + + ret = of_property_read_u32(np, "ti,channel0-current-microamp", &pval); + if (!ret) + gp_data->ch0_current = pval; + + ret = of_property_read_u32(np, "ti,channel3-current-microamp", &pval); + if (!ret) + gp_data->ch3_current = pval; + + gp_data->extended_delay = of_property_read_bool(np, + "ti,enable-extended-delay"); + + *gpadc_pdata = gp_data; + + return 0; +} + static int palmas_gpadc_probe(struct platform_device *pdev) { struct palmas_gpadc *adc; @@ -469,12 +499,17 @@ static int palmas_gpadc_probe(struct platform_device *pdev) int ret, i; pdata = dev_get_platdata(pdev->dev.parent); - if (!pdata || !pdata->gpadc_pdata) { - dev_err(&pdev->dev, "No platform data\n"); - return -ENODEV; - } - gpadc_pdata = pdata->gpadc_pdata; + if (pdata && pdata->gpadc_pdata) + gpadc_pdata = pdata->gpadc_pdata; + + if (!gpadc_pdata && pdev->dev.of_node) { + ret = palmas_gpadc_get_adc_dt_data(pdev, &gpadc_pdata); + if (ret < 0) + return ret; + } + if (!gpadc_pdata) + return -EINVAL; indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*adc)); if (!indio_dev) { @@ -790,12 +825,19 @@ static const struct dev_pm_ops palmas_pm_ops = { palmas_gpadc_resume) }; +static const struct of_device_id of_palmas_gpadc_match_tbl[] = { + { .compatible = "ti,palmas-gpadc", }, + { /* end */ } +}; +MODULE_DEVICE_TABLE(of, of_palmas_gpadc_match_tbl); + static struct platform_driver palmas_gpadc_driver = { .probe = palmas_gpadc_probe, .remove = palmas_gpadc_remove, .driver = { .name = MOD_NAME, .pm = &palmas_pm_ops, + .of_match_table = of_palmas_gpadc_match_tbl, }, }; From 415f792447572ef1949a3cef5119bbce8cc66373 Mon Sep 17 00:00:00 2001 From: Cristina Opriceana Date: Fri, 9 Oct 2015 16:31:28 +0300 Subject: [PATCH 005/843] iio: Move IIO Dummy Driver out of staging This patch moves the reference IIO dummy driver from drivers/staging/iio into a separate folder, drivers/iio/dummy and adds the proper Kconfig and Makefile for it. A new config menu entry called IIO dummy driver has also been added in the Industrial I/O support menu, corresponding to this driver. Signed-off-by: Cristina Opriceana Signed-off-by: Jonathan Cameron --- drivers/iio/Kconfig | 1 + drivers/iio/Makefile | 1 + drivers/iio/dummy/Kconfig | 35 ++++++++++++++ drivers/iio/dummy/Makefile | 10 ++++ .../iio => iio/dummy}/iio_dummy_evgen.c | 0 .../iio => iio/dummy}/iio_dummy_evgen.h | 0 .../iio => iio/dummy}/iio_simple_dummy.c | 0 .../iio => iio/dummy}/iio_simple_dummy.h | 0 .../dummy}/iio_simple_dummy_buffer.c | 0 .../dummy}/iio_simple_dummy_events.c | 0 drivers/staging/iio/Kconfig | 46 +++++++++---------- drivers/staging/iio/Makefile | 10 ++-- 12 files changed, 75 insertions(+), 28 deletions(-) create mode 100644 drivers/iio/dummy/Kconfig create mode 100644 drivers/iio/dummy/Makefile rename drivers/{staging/iio => iio/dummy}/iio_dummy_evgen.c (100%) rename drivers/{staging/iio => iio/dummy}/iio_dummy_evgen.h (100%) rename drivers/{staging/iio => iio/dummy}/iio_simple_dummy.c (100%) rename drivers/{staging/iio => iio/dummy}/iio_simple_dummy.h (100%) rename drivers/{staging/iio => iio/dummy}/iio_simple_dummy_buffer.c (100%) rename drivers/{staging/iio => iio/dummy}/iio_simple_dummy_events.c (100%) diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig index 66792e707d74..6b8c77c97d40 100644 --- a/drivers/iio/Kconfig +++ b/drivers/iio/Kconfig @@ -50,6 +50,7 @@ source "drivers/iio/amplifiers/Kconfig" source "drivers/iio/chemical/Kconfig" source "drivers/iio/common/Kconfig" source "drivers/iio/dac/Kconfig" +source "drivers/iio/dummy/Kconfig" source "drivers/iio/frequency/Kconfig" source "drivers/iio/gyro/Kconfig" source "drivers/iio/humidity/Kconfig" diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile index aeca7269fe44..6769f2f43e86 100644 --- a/drivers/iio/Makefile +++ b/drivers/iio/Makefile @@ -16,6 +16,7 @@ obj-y += buffer/ obj-y += chemical/ obj-y += common/ obj-y += dac/ +obj-y += dummy/ obj-y += gyro/ obj-y += frequency/ obj-y += humidity/ diff --git a/drivers/iio/dummy/Kconfig b/drivers/iio/dummy/Kconfig new file mode 100644 index 000000000000..e8676aa97d62 --- /dev/null +++ b/drivers/iio/dummy/Kconfig @@ -0,0 +1,35 @@ +# +# Industrial I/O subsystem Dummy Driver configuration +# +menu "IIO dummy driver" + depends on IIO + +config IIO_DUMMY_EVGEN + tristate + +config IIO_SIMPLE_DUMMY + tristate "An example driver with no hardware requirements" + help + Driver intended mainly as documentation for how to write + a driver. May also be useful for testing userspace code + without hardware. + +if IIO_SIMPLE_DUMMY + +config IIO_SIMPLE_DUMMY_EVENTS + bool "Event generation support" + select IIO_DUMMY_EVGEN + help + Add some dummy events to the simple dummy driver. + +config IIO_SIMPLE_DUMMY_BUFFER + bool "Buffered capture support" + select IIO_BUFFER + select IIO_TRIGGER + select IIO_KFIFO_BUF + help + Add buffered data capture to the simple dummy driver. + +endif # IIO_SIMPLE_DUMMY + +endmenu diff --git a/drivers/iio/dummy/Makefile b/drivers/iio/dummy/Makefile new file mode 100644 index 000000000000..0765e93d7804 --- /dev/null +++ b/drivers/iio/dummy/Makefile @@ -0,0 +1,10 @@ +# +# Makefile for the IIO Dummy Driver +# + +obj-$(CONFIG_IIO_SIMPLE_DUMMY) += iio_dummy.o +iio_dummy-y := iio_simple_dummy.o +iio_dummy-$(CONFIG_IIO_SIMPLE_DUMMY_EVENTS) += iio_simple_dummy_events.o +iio_dummy-$(CONFIG_IIO_SIMPLE_DUMMY_BUFFER) += iio_simple_dummy_buffer.o + +obj-$(CONFIG_IIO_DUMMY_EVGEN) += iio_dummy_evgen.o diff --git a/drivers/staging/iio/iio_dummy_evgen.c b/drivers/iio/dummy/iio_dummy_evgen.c similarity index 100% rename from drivers/staging/iio/iio_dummy_evgen.c rename to drivers/iio/dummy/iio_dummy_evgen.c diff --git a/drivers/staging/iio/iio_dummy_evgen.h b/drivers/iio/dummy/iio_dummy_evgen.h similarity index 100% rename from drivers/staging/iio/iio_dummy_evgen.h rename to drivers/iio/dummy/iio_dummy_evgen.h diff --git a/drivers/staging/iio/iio_simple_dummy.c b/drivers/iio/dummy/iio_simple_dummy.c similarity index 100% rename from drivers/staging/iio/iio_simple_dummy.c rename to drivers/iio/dummy/iio_simple_dummy.c diff --git a/drivers/staging/iio/iio_simple_dummy.h b/drivers/iio/dummy/iio_simple_dummy.h similarity index 100% rename from drivers/staging/iio/iio_simple_dummy.h rename to drivers/iio/dummy/iio_simple_dummy.h diff --git a/drivers/staging/iio/iio_simple_dummy_buffer.c b/drivers/iio/dummy/iio_simple_dummy_buffer.c similarity index 100% rename from drivers/staging/iio/iio_simple_dummy_buffer.c rename to drivers/iio/dummy/iio_simple_dummy_buffer.c diff --git a/drivers/staging/iio/iio_simple_dummy_events.c b/drivers/iio/dummy/iio_simple_dummy_events.c similarity index 100% rename from drivers/staging/iio/iio_simple_dummy_events.c rename to drivers/iio/dummy/iio_simple_dummy_events.c diff --git a/drivers/staging/iio/Kconfig b/drivers/staging/iio/Kconfig index 6d5b38d69578..85de1985df8e 100644 --- a/drivers/staging/iio/Kconfig +++ b/drivers/staging/iio/Kconfig @@ -17,32 +17,32 @@ source "drivers/staging/iio/meter/Kconfig" source "drivers/staging/iio/resolver/Kconfig" source "drivers/staging/iio/trigger/Kconfig" -config IIO_DUMMY_EVGEN - tristate +#config IIO_DUMMY_EVGEN +# tristate +# +#config IIO_SIMPLE_DUMMY +# tristate "An example driver with no hardware requirements" +# help +# Driver intended mainly as documentation for how to write +# a driver. May also be useful for testing userspace code +# without hardware. -config IIO_SIMPLE_DUMMY - tristate "An example driver with no hardware requirements" - help - Driver intended mainly as documentation for how to write - a driver. May also be useful for testing userspace code - without hardware. +#if IIO_SIMPLE_DUMMY -if IIO_SIMPLE_DUMMY +#config IIO_SIMPLE_DUMMY_EVENTS +# bool "Event generation support" +# select IIO_DUMMY_EVGEN +# help +# Add some dummy events to the simple dummy driver. -config IIO_SIMPLE_DUMMY_EVENTS - bool "Event generation support" - select IIO_DUMMY_EVGEN - help - Add some dummy events to the simple dummy driver. +#config IIO_SIMPLE_DUMMY_BUFFER +# bool "Buffered capture support" +# select IIO_BUFFER +# select IIO_TRIGGER +# select IIO_KFIFO_BUF +# help +# Add buffered data capture to the simple dummy driver. -config IIO_SIMPLE_DUMMY_BUFFER - bool "Buffered capture support" - select IIO_BUFFER - select IIO_TRIGGER - select IIO_KFIFO_BUF - help - Add buffered data capture to the simple dummy driver. - -endif # IIO_SIMPLE_DUMMY +#endif # IIO_SIMPLE_DUMMY endmenu diff --git a/drivers/staging/iio/Makefile b/drivers/staging/iio/Makefile index d87106135b27..355824ab733b 100644 --- a/drivers/staging/iio/Makefile +++ b/drivers/staging/iio/Makefile @@ -2,12 +2,12 @@ # Makefile for the industrial I/O core. # -obj-$(CONFIG_IIO_SIMPLE_DUMMY) += iio_dummy.o -iio_dummy-y := iio_simple_dummy.o -iio_dummy-$(CONFIG_IIO_SIMPLE_DUMMY_EVENTS) += iio_simple_dummy_events.o -iio_dummy-$(CONFIG_IIO_SIMPLE_DUMMY_BUFFER) += iio_simple_dummy_buffer.o +#obj-$(CONFIG_IIO_SIMPLE_DUMMY) += iio_dummy.o +#iio_dummy-y := iio_simple_dummy.o +#iio_dummy-$(CONFIG_IIO_SIMPLE_DUMMY_EVENTS) += iio_simple_dummy_events.o +#iio_dummy-$(CONFIG_IIO_SIMPLE_DUMMY_BUFFER) += iio_simple_dummy_buffer.o -obj-$(CONFIG_IIO_DUMMY_EVGEN) += iio_dummy_evgen.o +#obj-$(CONFIG_IIO_DUMMY_EVGEN) += iio_dummy_evgen.o obj-y += accel/ obj-y += adc/ From 3a872138e4b78e7f8bfce63f0da788c0cfd80e53 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 14 Oct 2015 14:54:38 +0200 Subject: [PATCH 006/843] iio: adc: mcp320x: Deprecated compatible strings with no vendor prefix The Microchip Analog to Digital Converter (ADC) Device Tree binding documents compatible strings with no vendor prefix. Since it should compatible strings with also a vendor, add these to the binding doc and mark the old ones as deprecated. The driver says that the device is from Microchip Technology which is listed in Documentation/devicetree/bindings/vendor-prefixes.txt so use the documented prefix. Signed-off-by: Javier Martinez Canillas Acked-by: Michael Welling Signed-off-by: Jonathan Cameron --- .../devicetree/bindings/iio/adc/mcp320x.txt | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/adc/mcp320x.txt b/Documentation/devicetree/bindings/iio/adc/mcp320x.txt index 2a1f3af30155..bcd3ac8e6e0c 100644 --- a/Documentation/devicetree/bindings/iio/adc/mcp320x.txt +++ b/Documentation/devicetree/bindings/iio/adc/mcp320x.txt @@ -10,16 +10,28 @@ must be specified. Required properties: - compatible: Must be one of the following, depending on the model: - "mcp3001" - "mcp3002" - "mcp3004" - "mcp3008" - "mcp3201" - "mcp3202" - "mcp3204" - "mcp3208" - "mcp3301" + "mcp3001" (DEPRECATED) + "mcp3002" (DEPRECATED) + "mcp3004" (DEPRECATED) + "mcp3008" (DEPRECATED) + "mcp3201" (DEPRECATED) + "mcp3202" (DEPRECATED) + "mcp3204" (DEPRECATED) + "mcp3208" (DEPRECATED) + "mcp3301" (DEPRECATED) + "microchip,mcp3001" + "microchip,mcp3002" + "microchip,mcp3004" + "microchip,mcp3008" + "microchip,mcp3201" + "microchip,mcp3202" + "microchip,mcp3204" + "microchip,mcp3208" + "microchip,mcp3301" + + NOTE: The use of the compatibles with no vendor prefix + is deprecated and only listed because old DT use them. Examples: spi_controller { From 0d0e53844797200aa026dfbdfe62f90ccff88300 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 14 Oct 2015 14:54:39 +0200 Subject: [PATCH 007/843] iio: adc: mcp320x: Add compatible with vendor prefix to OF table The driver Device Tree binding now documents compatible strings that have a vendor prefix, so add these to the OF device ID table to match and mark the old ones as deprecated explaining that should not be used anymore. Signed-off-by: Javier Martinez Canillas Acked-by: Michael Welling Signed-off-by: Jonathan Cameron --- drivers/iio/adc/mcp320x.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/iio/adc/mcp320x.c b/drivers/iio/adc/mcp320x.c index 41a21e986c1a..9fcb8b61e300 100644 --- a/drivers/iio/adc/mcp320x.c +++ b/drivers/iio/adc/mcp320x.c @@ -354,6 +354,7 @@ static int mcp320x_remove(struct spi_device *spi) #if defined(CONFIG_OF) static const struct of_device_id mcp320x_dt_ids[] = { + /* NOTE: The use of compatibles with no vendor prefix is deprecated. */ { .compatible = "mcp3001", .data = &mcp320x_chip_infos[mcp3001], @@ -381,6 +382,33 @@ static const struct of_device_id mcp320x_dt_ids[] = { }, { .compatible = "mcp3301", .data = &mcp320x_chip_infos[mcp3301], + }, { + .compatible = "microchip,mcp3001", + .data = &mcp320x_chip_infos[mcp3001], + }, { + .compatible = "microchip,mcp3002", + .data = &mcp320x_chip_infos[mcp3002], + }, { + .compatible = "microchip,mcp3004", + .data = &mcp320x_chip_infos[mcp3004], + }, { + .compatible = "microchip,mcp3008", + .data = &mcp320x_chip_infos[mcp3008], + }, { + .compatible = "microchip,mcp3201", + .data = &mcp320x_chip_infos[mcp3201], + }, { + .compatible = "microchip,mcp3202", + .data = &mcp320x_chip_infos[mcp3202], + }, { + .compatible = "microchip,mcp3204", + .data = &mcp320x_chip_infos[mcp3204], + }, { + .compatible = "microchip,mcp3208", + .data = &mcp320x_chip_infos[mcp3208], + }, { + .compatible = "microchip,mcp3301", + .data = &mcp320x_chip_infos[mcp3301], }, { } }; From f0566c0c405de543efb6fb8b8988cc7743d85ea6 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Tue, 13 Oct 2015 18:10:24 +0200 Subject: [PATCH 008/843] iio: Set device watermark based on watermark of all attached buffers Currently the watermark of the device is only set based on the watermark that is set for the user space buffer. This doesn't consider the watermarks set on any attached in-kernel buffers. Change this so that the watermark of the device should be the minimum of the watermarks over all attached buffers. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/iio/industrialio-buffer.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index d7e908acb480..7340922d367f 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -610,6 +610,7 @@ static void iio_free_scan_mask(struct iio_dev *indio_dev, struct iio_device_config { unsigned int mode; + unsigned int watermark; const unsigned long *scan_mask; unsigned int scan_bytes; bool scan_timestamp; @@ -642,10 +643,14 @@ static int iio_verify_update(struct iio_dev *indio_dev, if (buffer == remove_buffer) continue; modes &= buffer->access->modes; + config->watermark = min(config->watermark, buffer->watermark); } - if (insert_buffer) + if (insert_buffer) { modes &= insert_buffer->access->modes; + config->watermark = min(config->watermark, + insert_buffer->watermark); + } /* Definitely possible for devices to support both of these. */ if ((modes & INDIO_BUFFER_TRIGGERED) && indio_dev->trig) { @@ -743,6 +748,10 @@ static int iio_enable_buffers(struct iio_dev *indio_dev, } } + if (indio_dev->info->hwfifo_set_watermark) + indio_dev->info->hwfifo_set_watermark(indio_dev, + config->watermark); + indio_dev->currentmode = config->mode; if (indio_dev->setup_ops->postenable) { @@ -974,9 +983,6 @@ static ssize_t iio_buffer_store_watermark(struct device *dev, } buffer->watermark = val; - - if (indio_dev->info->hwfifo_set_watermark) - indio_dev->info->hwfifo_set_watermark(indio_dev, val); out: mutex_unlock(&indio_dev->mlock); From 4a60535726d90bfad16b5c52dcffaeede9fb84a9 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Tue, 13 Oct 2015 18:10:25 +0200 Subject: [PATCH 009/843] iio:iio_buffer_init(): Only set watermark if not already set Only initialize the watermark field if it is still 0. This allows drivers to provide a custom default watermark value. E.g. some driver might have a fixed watermark or can only support watermarks within a certain range and the initial value for the watermark should be within this range. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/iio/industrialio-buffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index 7340922d367f..5f2c8c8c436e 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -193,7 +193,8 @@ void iio_buffer_init(struct iio_buffer *buffer) INIT_LIST_HEAD(&buffer->buffer_list); init_waitqueue_head(&buffer->pollq); kref_init(&buffer->ref); - buffer->watermark = 1; + if (!buffer->watermark) + buffer->watermark = 1; } EXPORT_SYMBOL(iio_buffer_init); From b440655b896b2d5a2fb5f918801fb0e281a537cd Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Tue, 13 Oct 2015 18:10:26 +0200 Subject: [PATCH 010/843] iio: Add support for indicating fixed watermarks For buffers which have a fixed wake-up watermark the watermark attribute should be read-only. Add a new FIXED_WATERMARK flag to the struct iio_buffer_access_funcs, which can be set by a buffer implementation. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/iio/industrialio-buffer.c | 5 +++++ include/linux/iio/buffer.h | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index 5f2c8c8c436e..98a6447a61d3 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -998,6 +998,8 @@ static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, iio_buffer_show_enable, iio_buffer_store_enable); static DEVICE_ATTR(watermark, S_IRUGO | S_IWUSR, iio_buffer_show_watermark, iio_buffer_store_watermark); +static struct device_attribute dev_attr_watermark_ro = __ATTR(watermark, + S_IRUGO, iio_buffer_show_watermark, NULL); static struct attribute *iio_buffer_attrs[] = { &dev_attr_length.attr, @@ -1040,6 +1042,9 @@ int iio_buffer_alloc_sysfs_and_mask(struct iio_dev *indio_dev) if (!buffer->access->set_length) attr[0] = &dev_attr_length_ro.attr; + if (buffer->access->flags & INDIO_BUFFER_FLAG_FIXED_WATERMARK) + attr[2] = &dev_attr_watermark_ro.attr; + if (buffer->attrs) memcpy(&attr[ARRAY_SIZE(iio_buffer_attrs)], buffer->attrs, sizeof(struct attribute *) * attrcount); diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h index 1600c55828e0..4d99a53d1fe7 100644 --- a/include/linux/iio/buffer.h +++ b/include/linux/iio/buffer.h @@ -17,6 +17,12 @@ struct iio_buffer; +/** + * INDIO_BUFFER_FLAG_FIXED_WATERMARK - Watermark level of the buffer can not be + * configured. It has a fixed value which will be buffer specific. + */ +#define INDIO_BUFFER_FLAG_FIXED_WATERMARK BIT(0) + /** * struct iio_buffer_access_funcs - access functions for buffers. * @store_to: actually store stuff to the buffer @@ -30,6 +36,7 @@ struct iio_buffer; * @release: called when the last reference to the buffer is dropped, * should free all resources allocated by the buffer. * @modes: Supported operating modes by this buffer type + * @flags: A bitmask combination of INDIO_BUFFER_FLAG_* * * The purpose of this structure is to make the buffer element * modular as event for a given driver, different usecases may require @@ -54,6 +61,7 @@ struct iio_buffer_access_funcs { void (*release)(struct iio_buffer *buffer); unsigned int modes; + unsigned int flags; }; /** From e18a2ad45caeb11226e49c25068d0f2efe2adf6c Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Tue, 13 Oct 2015 18:10:27 +0200 Subject: [PATCH 011/843] iio: Add buffer enable/disable callbacks This patch adds a enable and disable callback that is called when the buffer is enabled/disabled. This can be used by buffer implementations that need to do some setup or teardown work. E.g. a DMA based buffer can use this to start/stop the DMA transfer. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/iio/industrialio-buffer.c | 36 ++++++++++++++++++++++++++++++- include/linux/iio/buffer.h | 8 +++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index 98a6447a61d3..a4b164a478c4 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -568,6 +568,22 @@ static void iio_buffer_deactivate_all(struct iio_dev *indio_dev) iio_buffer_deactivate(buffer); } +static int iio_buffer_enable(struct iio_buffer *buffer, + struct iio_dev *indio_dev) +{ + if (!buffer->access->enable) + return 0; + return buffer->access->enable(buffer, indio_dev); +} + +static int iio_buffer_disable(struct iio_buffer *buffer, + struct iio_dev *indio_dev) +{ + if (!buffer->access->disable) + return 0; + return buffer->access->disable(buffer, indio_dev); +} + static void iio_buffer_update_bytes_per_datum(struct iio_dev *indio_dev, struct iio_buffer *buffer) { @@ -719,6 +735,7 @@ static int iio_verify_update(struct iio_dev *indio_dev, static int iio_enable_buffers(struct iio_dev *indio_dev, struct iio_device_config *config) { + struct iio_buffer *buffer; int ret; indio_dev->active_scan_mask = config->scan_mask; @@ -753,6 +770,12 @@ static int iio_enable_buffers(struct iio_dev *indio_dev, indio_dev->info->hwfifo_set_watermark(indio_dev, config->watermark); + list_for_each_entry(buffer, &indio_dev->buffer_list, buffer_list) { + ret = iio_buffer_enable(buffer, indio_dev); + if (ret) + goto err_disable_buffers; + } + indio_dev->currentmode = config->mode; if (indio_dev->setup_ops->postenable) { @@ -760,12 +783,16 @@ static int iio_enable_buffers(struct iio_dev *indio_dev, if (ret) { dev_dbg(&indio_dev->dev, "Buffer not started: postenable failed (%d)\n", ret); - goto err_run_postdisable; + goto err_disable_buffers; } } return 0; +err_disable_buffers: + list_for_each_entry_continue_reverse(buffer, &indio_dev->buffer_list, + buffer_list) + iio_buffer_disable(buffer, indio_dev); err_run_postdisable: indio_dev->currentmode = INDIO_DIRECT_MODE; if (indio_dev->setup_ops->postdisable) @@ -778,6 +805,7 @@ err_undo_config: static int iio_disable_buffers(struct iio_dev *indio_dev) { + struct iio_buffer *buffer; int ret = 0; int ret2; @@ -798,6 +826,12 @@ static int iio_disable_buffers(struct iio_dev *indio_dev) ret = ret2; } + list_for_each_entry(buffer, &indio_dev->buffer_list, buffer_list) { + ret2 = iio_buffer_disable(buffer, indio_dev); + if (ret2 && !ret) + ret = ret2; + } + indio_dev->currentmode = INDIO_DIRECT_MODE; if (indio_dev->setup_ops->postdisable) { diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h index 4d99a53d1fe7..2ec3ad58e8a0 100644 --- a/include/linux/iio/buffer.h +++ b/include/linux/iio/buffer.h @@ -33,6 +33,11 @@ struct iio_buffer; * storage. * @set_bytes_per_datum:set number of bytes per datum * @set_length: set number of datums in buffer + * @enable: called if the buffer is attached to a device and the + * device starts sampling. Calls are balanced with + * @disable. + * @disable: called if the buffer is attached to a device and the + * device stops sampling. Calles are balanced with @enable. * @release: called when the last reference to the buffer is dropped, * should free all resources allocated by the buffer. * @modes: Supported operating modes by this buffer type @@ -58,6 +63,9 @@ struct iio_buffer_access_funcs { int (*set_bytes_per_datum)(struct iio_buffer *buffer, size_t bpd); int (*set_length)(struct iio_buffer *buffer, int length); + int (*enable)(struct iio_buffer *buffer, struct iio_dev *indio_dev); + int (*disable)(struct iio_buffer *buffer, struct iio_dev *indio_dev); + void (*release)(struct iio_buffer *buffer); unsigned int modes; From 670b19ae9bfdbcb4ce2c2ffb2ec1659a7f4a2074 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Tue, 13 Oct 2015 18:10:28 +0200 Subject: [PATCH 012/843] iio: Add generic DMA buffer infrastructure The traditional approach used in IIO to implement buffered capture requires the generation of at least one interrupt per sample. In the interrupt handler the driver reads the sample from the device and copies it to a software buffer. This approach has a rather large per sample overhead associated with it. And while it works fine for samplerates in the range of up to 1000 samples per second it starts to consume a rather large share of the available CPU processing time once we go beyond that, this is especially true on an embedded system with limited processing power. The regular interrupt also causes increased power consumption by not allowing the hardware into deeper sleep states, which is something that becomes more and more important on mobile battery powered devices. And while the recently added watermark support mitigates some of the issues by allowing the device to generate interrupts at a rate lower than the data output rate, this still requires a storage buffer inside the device and even if it exists it is only a few 100 samples deep at most. DMA support on the other hand allows to capture multiple millions or even more samples without any CPU interaction. This allows the CPU to either go to sleep for longer periods or focus on other tasks which increases overall system performance and power consumption. In addition to that some devices might not even offer a way to read the data other than using DMA, which makes DMA mandatory to use for them. The tasks involved in implementing a DMA buffer can be divided into two categories. The first category is memory buffer management (allocation, mapping, etc.) and hooking this up the IIO buffer callbacks like read(), enable(), disable(), etc. The second category of tasks is to setup the DMA hardware and manage the DMA transfers. Tasks from the first category will be very similar for all IIO drivers supporting DMA buffers, while the tasks from the second category will be hardware specific. This patch implements a generic infrastructure that take care of the former tasks. It provides a set of functions that implement the standard IIO buffer iio_buffer_access_funcs callbacks. These can either be used as is or be overloaded and augmented with driver specific code where necessary. For the DMA buffer support infrastructure that is introduced in this series sample data is grouped by so called blocks. A block is the basic unit at which data is exchanged between the application and the hardware. The application is responsible for allocating the memory associated with the block and then passes the block to the hardware. When the hardware has captured the amount of samples equal to size of a block it will notify the application, which can then read the data from the block and process it. The block size can freely chosen (within the constraints of the hardware). This allows to make a trade-off between latency and management overhead. The larger the block size the lower the per sample overhead but the latency between when the data was captured and when the application will be able to access it increases, in a similar way smaller block sizes have a larger per sample management overhead but a lower latency. The ideal block size thus depends on system and application requirements. For the time being the infrastructure only implements a simple double buffered scheme which allocates two blocks each with half the size of the configured buffer size. This provides basic support for capturing continuous uninterrupted data over the existing file-IO ABI. Future extensions to the DMA buffer infrastructure will give applications a more fine grained control over how many blocks are allocated and the size of each block. But this requires userspace ABI additions which are intentionally not part of this patch and will be added separately. Tasks of the second category need to be implemented by a device specific driver. They can be hooked up into the generic infrastructure using two simple callbacks, submit() and abort(). The submit() callback is used to schedule DMA transfers for blocks. Once a DMA transfer has been completed it is expected that the buffer driver calls iio_dma_buffer_block_done() to notify. The abort() callback is used for stopping all pending and active DMA transfers when the buffer is disabled. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/iio/buffer/Kconfig | 9 + drivers/iio/buffer/Makefile | 1 + drivers/iio/buffer/industrialio-buffer-dma.c | 683 +++++++++++++++++++ include/linux/iio/buffer-dma.h | 152 +++++ 4 files changed, 845 insertions(+) create mode 100644 drivers/iio/buffer/industrialio-buffer-dma.c create mode 100644 include/linux/iio/buffer-dma.h diff --git a/drivers/iio/buffer/Kconfig b/drivers/iio/buffer/Kconfig index 0a7b2fd3699b..b2fda1afc03e 100644 --- a/drivers/iio/buffer/Kconfig +++ b/drivers/iio/buffer/Kconfig @@ -9,6 +9,15 @@ config IIO_BUFFER_CB Should be selected by any drivers that do in-kernel push usage. That is, those where the data is pushed to the consumer. +config IIO_BUFFER_DMA + tristate + help + Provides the generic IIO DMA buffer infrastructure that can be used by + drivers for devices with DMA support to implement the IIO buffer. + + Should be selected by drivers that want to use the generic DMA buffer + infrastructure. + config IIO_KFIFO_BUF tristate "Industrial I/O buffering based on kfifo" help diff --git a/drivers/iio/buffer/Makefile b/drivers/iio/buffer/Makefile index 4d193b9a9123..bda3f1143e72 100644 --- a/drivers/iio/buffer/Makefile +++ b/drivers/iio/buffer/Makefile @@ -4,5 +4,6 @@ # When adding new entries keep the list in alphabetical order obj-$(CONFIG_IIO_BUFFER_CB) += industrialio-buffer-cb.o +obj-$(CONFIG_IIO_BUFFER_DMA) += industrialio-buffer-dma.o obj-$(CONFIG_IIO_TRIGGERED_BUFFER) += industrialio-triggered-buffer.o obj-$(CONFIG_IIO_KFIFO_BUF) += kfifo_buf.o diff --git a/drivers/iio/buffer/industrialio-buffer-dma.c b/drivers/iio/buffer/industrialio-buffer-dma.c new file mode 100644 index 000000000000..212cbedc7abb --- /dev/null +++ b/drivers/iio/buffer/industrialio-buffer-dma.c @@ -0,0 +1,683 @@ +/* + * Copyright 2013-2015 Analog Devices Inc. + * Author: Lars-Peter Clausen + * + * Licensed under the GPL-2. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * For DMA buffers the storage is sub-divided into so called blocks. Each block + * has its own memory buffer. The size of the block is the granularity at which + * memory is exchanged between the hardware and the application. Increasing the + * basic unit of data exchange from one sample to one block decreases the + * management overhead that is associated with each sample. E.g. if we say the + * management overhead for one exchange is x and the unit of exchange is one + * sample the overhead will be x for each sample. Whereas when using a block + * which contains n samples the overhead per sample is reduced to x/n. This + * allows to achieve much higher samplerates than what can be sustained with + * the one sample approach. + * + * Blocks are exchanged between the DMA controller and the application via the + * means of two queues. The incoming queue and the outgoing queue. Blocks on the + * incoming queue are waiting for the DMA controller to pick them up and fill + * them with data. Block on the outgoing queue have been filled with data and + * are waiting for the application to dequeue them and read the data. + * + * A block can be in one of the following states: + * * Owned by the application. In this state the application can read data from + * the block. + * * On the incoming list: Blocks on the incoming list are queued up to be + * processed by the DMA controller. + * * Owned by the DMA controller: The DMA controller is processing the block + * and filling it with data. + * * On the outgoing list: Blocks on the outgoing list have been successfully + * processed by the DMA controller and contain data. They can be dequeued by + * the application. + * * Dead: A block that is dead has been marked as to be freed. It might still + * be owned by either the application or the DMA controller at the moment. + * But once they are done processing it instead of going to either the + * incoming or outgoing queue the block will be freed. + * + * In addition to this blocks are reference counted and the memory associated + * with both the block structure as well as the storage memory for the block + * will be freed when the last reference to the block is dropped. This means a + * block must not be accessed without holding a reference. + * + * The iio_dma_buffer implementation provides a generic infrastructure for + * managing the blocks. + * + * A driver for a specific piece of hardware that has DMA capabilities need to + * implement the submit() callback from the iio_dma_buffer_ops structure. This + * callback is supposed to initiate the DMA transfer copying data from the + * converter to the memory region of the block. Once the DMA transfer has been + * completed the driver must call iio_dma_buffer_block_done() for the completed + * block. + * + * Prior to this it must set the bytes_used field of the block contains + * the actual number of bytes in the buffer. Typically this will be equal to the + * size of the block, but if the DMA hardware has certain alignment requirements + * for the transfer length it might choose to use less than the full size. In + * either case it is expected that bytes_used is a multiple of the bytes per + * datum, i.e. the block must not contain partial samples. + * + * The driver must call iio_dma_buffer_block_done() for each block it has + * received through its submit_block() callback, even if it does not actually + * perform a DMA transfer for the block, e.g. because the buffer was disabled + * before the block transfer was started. In this case it should set bytes_used + * to 0. + * + * In addition it is recommended that a driver implements the abort() callback. + * It will be called when the buffer is disabled and can be used to cancel + * pending and stop active transfers. + * + * The specific driver implementation should use the default callback + * implementations provided by this module for the iio_buffer_access_funcs + * struct. It may overload some callbacks with custom variants if the hardware + * has special requirements that are not handled by the generic functions. If a + * driver chooses to overload a callback it has to ensure that the generic + * callback is called from within the custom callback. + */ + +static void iio_buffer_block_release(struct kref *kref) +{ + struct iio_dma_buffer_block *block = container_of(kref, + struct iio_dma_buffer_block, kref); + + WARN_ON(block->state != IIO_BLOCK_STATE_DEAD); + + dma_free_coherent(block->queue->dev, PAGE_ALIGN(block->size), + block->vaddr, block->phys_addr); + + iio_buffer_put(&block->queue->buffer); + kfree(block); +} + +static void iio_buffer_block_get(struct iio_dma_buffer_block *block) +{ + kref_get(&block->kref); +} + +static void iio_buffer_block_put(struct iio_dma_buffer_block *block) +{ + kref_put(&block->kref, iio_buffer_block_release); +} + +/* + * dma_free_coherent can sleep, hence we need to take some special care to be + * able to drop a reference from an atomic context. + */ +static LIST_HEAD(iio_dma_buffer_dead_blocks); +static DEFINE_SPINLOCK(iio_dma_buffer_dead_blocks_lock); + +static void iio_dma_buffer_cleanup_worker(struct work_struct *work) +{ + struct iio_dma_buffer_block *block, *_block; + LIST_HEAD(block_list); + + spin_lock_irq(&iio_dma_buffer_dead_blocks_lock); + list_splice_tail_init(&iio_dma_buffer_dead_blocks, &block_list); + spin_unlock_irq(&iio_dma_buffer_dead_blocks_lock); + + list_for_each_entry_safe(block, _block, &block_list, head) + iio_buffer_block_release(&block->kref); +} +static DECLARE_WORK(iio_dma_buffer_cleanup_work, iio_dma_buffer_cleanup_worker); + +static void iio_buffer_block_release_atomic(struct kref *kref) +{ + struct iio_dma_buffer_block *block; + unsigned long flags; + + block = container_of(kref, struct iio_dma_buffer_block, kref); + + spin_lock_irqsave(&iio_dma_buffer_dead_blocks_lock, flags); + list_add_tail(&block->head, &iio_dma_buffer_dead_blocks); + spin_unlock_irqrestore(&iio_dma_buffer_dead_blocks_lock, flags); + + schedule_work(&iio_dma_buffer_cleanup_work); +} + +/* + * Version of iio_buffer_block_put() that can be called from atomic context + */ +static void iio_buffer_block_put_atomic(struct iio_dma_buffer_block *block) +{ + kref_put(&block->kref, iio_buffer_block_release_atomic); +} + +static struct iio_dma_buffer_queue *iio_buffer_to_queue(struct iio_buffer *buf) +{ + return container_of(buf, struct iio_dma_buffer_queue, buffer); +} + +static struct iio_dma_buffer_block *iio_dma_buffer_alloc_block( + struct iio_dma_buffer_queue *queue, size_t size) +{ + struct iio_dma_buffer_block *block; + + block = kzalloc(sizeof(*block), GFP_KERNEL); + if (!block) + return NULL; + + block->vaddr = dma_alloc_coherent(queue->dev, PAGE_ALIGN(size), + &block->phys_addr, GFP_KERNEL); + if (!block->vaddr) { + kfree(block); + return NULL; + } + + block->size = size; + block->state = IIO_BLOCK_STATE_DEQUEUED; + block->queue = queue; + INIT_LIST_HEAD(&block->head); + kref_init(&block->kref); + + iio_buffer_get(&queue->buffer); + + return block; +} + +static void _iio_dma_buffer_block_done(struct iio_dma_buffer_block *block) +{ + struct iio_dma_buffer_queue *queue = block->queue; + + /* + * The buffer has already been freed by the application, just drop the + * reference. + */ + if (block->state != IIO_BLOCK_STATE_DEAD) { + block->state = IIO_BLOCK_STATE_DONE; + list_add_tail(&block->head, &queue->outgoing); + } +} + +/** + * iio_dma_buffer_block_done() - Indicate that a block has been completed + * @block: The completed block + * + * Should be called when the DMA controller has finished handling the block to + * pass back ownership of the block to the queue. + */ +void iio_dma_buffer_block_done(struct iio_dma_buffer_block *block) +{ + struct iio_dma_buffer_queue *queue = block->queue; + unsigned long flags; + + spin_lock_irqsave(&queue->list_lock, flags); + _iio_dma_buffer_block_done(block); + spin_unlock_irqrestore(&queue->list_lock, flags); + + iio_buffer_block_put_atomic(block); + wake_up_interruptible_poll(&queue->buffer.pollq, POLLIN | POLLRDNORM); +} +EXPORT_SYMBOL_GPL(iio_dma_buffer_block_done); + +/** + * iio_dma_buffer_block_list_abort() - Indicate that a list block has been + * aborted + * @queue: Queue for which to complete blocks. + * @list: List of aborted blocks. All blocks in this list must be from @queue. + * + * Typically called from the abort() callback after the DMA controller has been + * stopped. This will set bytes_used to 0 for each block in the list and then + * hand the blocks back to the queue. + */ +void iio_dma_buffer_block_list_abort(struct iio_dma_buffer_queue *queue, + struct list_head *list) +{ + struct iio_dma_buffer_block *block, *_block; + unsigned long flags; + + spin_lock_irqsave(&queue->list_lock, flags); + list_for_each_entry_safe(block, _block, list, head) { + list_del(&block->head); + block->bytes_used = 0; + _iio_dma_buffer_block_done(block); + iio_buffer_block_put_atomic(block); + } + spin_unlock_irqrestore(&queue->list_lock, flags); + + wake_up_interruptible_poll(&queue->buffer.pollq, POLLIN | POLLRDNORM); +} +EXPORT_SYMBOL_GPL(iio_dma_buffer_block_list_abort); + +static bool iio_dma_block_reusable(struct iio_dma_buffer_block *block) +{ + /* + * If the core owns the block it can be re-used. This should be the + * default case when enabling the buffer, unless the DMA controller does + * not support abort and has not given back the block yet. + */ + switch (block->state) { + case IIO_BLOCK_STATE_DEQUEUED: + case IIO_BLOCK_STATE_QUEUED: + case IIO_BLOCK_STATE_DONE: + return true; + default: + return false; + } +} + +/** + * iio_dma_buffer_request_update() - DMA buffer request_update callback + * @buffer: The buffer which to request an update + * + * Should be used as the iio_dma_buffer_request_update() callback for + * iio_buffer_access_ops struct for DMA buffers. + */ +int iio_dma_buffer_request_update(struct iio_buffer *buffer) +{ + struct iio_dma_buffer_queue *queue = iio_buffer_to_queue(buffer); + struct iio_dma_buffer_block *block; + bool try_reuse = false; + size_t size; + int ret = 0; + int i; + + /* + * Split the buffer into two even parts. This is used as a double + * buffering scheme with usually one block at a time being used by the + * DMA and the other one by the application. + */ + size = DIV_ROUND_UP(queue->buffer.bytes_per_datum * + queue->buffer.length, 2); + + mutex_lock(&queue->lock); + + /* Allocations are page aligned */ + if (PAGE_ALIGN(queue->fileio.block_size) == PAGE_ALIGN(size)) + try_reuse = true; + + queue->fileio.block_size = size; + queue->fileio.active_block = NULL; + + spin_lock_irq(&queue->list_lock); + for (i = 0; i < 2; i++) { + block = queue->fileio.blocks[i]; + + /* If we can't re-use it free it */ + if (block && (!iio_dma_block_reusable(block) || !try_reuse)) + block->state = IIO_BLOCK_STATE_DEAD; + } + + /* + * At this point all blocks are either owned by the core or marked as + * dead. This means we can reset the lists without having to fear + * corrution. + */ + INIT_LIST_HEAD(&queue->outgoing); + spin_unlock_irq(&queue->list_lock); + + INIT_LIST_HEAD(&queue->incoming); + + for (i = 0; i < 2; i++) { + if (queue->fileio.blocks[i]) { + block = queue->fileio.blocks[i]; + if (block->state == IIO_BLOCK_STATE_DEAD) { + /* Could not reuse it */ + iio_buffer_block_put(block); + block = NULL; + } else { + block->size = size; + } + } else { + block = NULL; + } + + if (!block) { + block = iio_dma_buffer_alloc_block(queue, size); + if (!block) { + ret = -ENOMEM; + goto out_unlock; + } + queue->fileio.blocks[i] = block; + } + + block->state = IIO_BLOCK_STATE_QUEUED; + list_add_tail(&block->head, &queue->incoming); + } + +out_unlock: + mutex_unlock(&queue->lock); + + return ret; +} +EXPORT_SYMBOL_GPL(iio_dma_buffer_request_update); + +static void iio_dma_buffer_submit_block(struct iio_dma_buffer_queue *queue, + struct iio_dma_buffer_block *block) +{ + int ret; + + /* + * If the hardware has already been removed we put the block into + * limbo. It will neither be on the incoming nor outgoing list, nor will + * it ever complete. It will just wait to be freed eventually. + */ + if (!queue->ops) + return; + + block->state = IIO_BLOCK_STATE_ACTIVE; + iio_buffer_block_get(block); + ret = queue->ops->submit(queue, block); + if (ret) { + /* + * This is a bit of a problem and there is not much we can do + * other then wait for the buffer to be disabled and re-enabled + * and try again. But it should not really happen unless we run + * out of memory or something similar. + * + * TODO: Implement support in the IIO core to allow buffers to + * notify consumers that something went wrong and the buffer + * should be disabled. + */ + iio_buffer_block_put(block); + } +} + +/** + * iio_dma_buffer_enable() - Enable DMA buffer + * @buffer: IIO buffer to enable + * @indio_dev: IIO device the buffer is attached to + * + * Needs to be called when the device that the buffer is attached to starts + * sampling. Typically should be the iio_buffer_access_ops enable callback. + * + * This will allocate the DMA buffers and start the DMA transfers. + */ +int iio_dma_buffer_enable(struct iio_buffer *buffer, + struct iio_dev *indio_dev) +{ + struct iio_dma_buffer_queue *queue = iio_buffer_to_queue(buffer); + struct iio_dma_buffer_block *block, *_block; + + mutex_lock(&queue->lock); + queue->active = true; + list_for_each_entry_safe(block, _block, &queue->incoming, head) { + list_del(&block->head); + iio_dma_buffer_submit_block(queue, block); + } + mutex_unlock(&queue->lock); + + return 0; +} +EXPORT_SYMBOL_GPL(iio_dma_buffer_enable); + +/** + * iio_dma_buffer_disable() - Disable DMA buffer + * @buffer: IIO DMA buffer to disable + * @indio_dev: IIO device the buffer is attached to + * + * Needs to be called when the device that the buffer is attached to stops + * sampling. Typically should be the iio_buffer_access_ops disable callback. + */ +int iio_dma_buffer_disable(struct iio_buffer *buffer, + struct iio_dev *indio_dev) +{ + struct iio_dma_buffer_queue *queue = iio_buffer_to_queue(buffer); + + mutex_lock(&queue->lock); + queue->active = false; + + if (queue->ops && queue->ops->abort) + queue->ops->abort(queue); + mutex_unlock(&queue->lock); + + return 0; +} +EXPORT_SYMBOL_GPL(iio_dma_buffer_disable); + +static void iio_dma_buffer_enqueue(struct iio_dma_buffer_queue *queue, + struct iio_dma_buffer_block *block) +{ + if (block->state == IIO_BLOCK_STATE_DEAD) { + iio_buffer_block_put(block); + } else if (queue->active) { + iio_dma_buffer_submit_block(queue, block); + } else { + block->state = IIO_BLOCK_STATE_QUEUED; + list_add_tail(&block->head, &queue->incoming); + } +} + +static struct iio_dma_buffer_block *iio_dma_buffer_dequeue( + struct iio_dma_buffer_queue *queue) +{ + struct iio_dma_buffer_block *block; + + spin_lock_irq(&queue->list_lock); + block = list_first_entry_or_null(&queue->outgoing, struct + iio_dma_buffer_block, head); + if (block != NULL) { + list_del(&block->head); + block->state = IIO_BLOCK_STATE_DEQUEUED; + } + spin_unlock_irq(&queue->list_lock); + + return block; +} + +/** + * iio_dma_buffer_read() - DMA buffer read callback + * @buffer: Buffer to read form + * @n: Number of bytes to read + * @user_buffer: Userspace buffer to copy the data to + * + * Should be used as the read_first_n callback for iio_buffer_access_ops + * struct for DMA buffers. + */ +int iio_dma_buffer_read(struct iio_buffer *buffer, size_t n, + char __user *user_buffer) +{ + struct iio_dma_buffer_queue *queue = iio_buffer_to_queue(buffer); + struct iio_dma_buffer_block *block; + int ret; + + if (n < buffer->bytes_per_datum) + return -EINVAL; + + mutex_lock(&queue->lock); + + if (!queue->fileio.active_block) { + block = iio_dma_buffer_dequeue(queue); + if (block == NULL) { + ret = 0; + goto out_unlock; + } + queue->fileio.pos = 0; + queue->fileio.active_block = block; + } else { + block = queue->fileio.active_block; + } + + n = rounddown(n, buffer->bytes_per_datum); + if (n > block->bytes_used - queue->fileio.pos) + n = block->bytes_used - queue->fileio.pos; + + if (copy_to_user(user_buffer, block->vaddr + queue->fileio.pos, n)) { + ret = -EFAULT; + goto out_unlock; + } + + queue->fileio.pos += n; + + if (queue->fileio.pos == block->bytes_used) { + queue->fileio.active_block = NULL; + iio_dma_buffer_enqueue(queue, block); + } + + ret = n; + +out_unlock: + mutex_unlock(&queue->lock); + + return ret; +} +EXPORT_SYMBOL_GPL(iio_dma_buffer_read); + +/** + * iio_dma_buffer_data_available() - DMA buffer data_available callback + * @buf: Buffer to check for data availability + * + * Should be used as the data_available callback for iio_buffer_access_ops + * struct for DMA buffers. + */ +size_t iio_dma_buffer_data_available(struct iio_buffer *buf) +{ + struct iio_dma_buffer_queue *queue = iio_buffer_to_queue(buf); + struct iio_dma_buffer_block *block; + size_t data_available = 0; + + /* + * For counting the available bytes we'll use the size of the block not + * the number of actual bytes available in the block. Otherwise it is + * possible that we end up with a value that is lower than the watermark + * but won't increase since all blocks are in use. + */ + + mutex_lock(&queue->lock); + if (queue->fileio.active_block) + data_available += queue->fileio.active_block->size; + + spin_lock_irq(&queue->list_lock); + list_for_each_entry(block, &queue->outgoing, head) + data_available += block->size; + spin_unlock_irq(&queue->list_lock); + mutex_unlock(&queue->lock); + + return data_available; +} +EXPORT_SYMBOL_GPL(iio_dma_buffer_data_available); + +/** + * iio_dma_buffer_set_bytes_per_datum() - DMA buffer set_bytes_per_datum callback + * @buffer: Buffer to set the bytes-per-datum for + * @bpd: The new bytes-per-datum value + * + * Should be used as the set_bytes_per_datum callback for iio_buffer_access_ops + * struct for DMA buffers. + */ +int iio_dma_buffer_set_bytes_per_datum(struct iio_buffer *buffer, size_t bpd) +{ + buffer->bytes_per_datum = bpd; + + return 0; +} +EXPORT_SYMBOL_GPL(iio_dma_buffer_set_bytes_per_datum); + +/** + * iio_dma_buffer_set_length - DMA buffer set_length callback + * @buffer: Buffer to set the length for + * @length: The new buffer length + * + * Should be used as the set_length callback for iio_buffer_access_ops + * struct for DMA buffers. + */ +int iio_dma_buffer_set_length(struct iio_buffer *buffer, int length) +{ + /* Avoid an invalid state */ + if (length < 2) + length = 2; + buffer->length = length; + buffer->watermark = length / 2; + + return 0; +} +EXPORT_SYMBOL_GPL(iio_dma_buffer_set_length); + +/** + * iio_dma_buffer_init() - Initialize DMA buffer queue + * @queue: Buffer to initialize + * @dev: DMA device + * @ops: DMA buffer queue callback operations + * + * The DMA device will be used by the queue to do DMA memory allocations. So it + * should refer to the device that will perform the DMA to ensure that + * allocations are done from a memory region that can be accessed by the device. + */ +int iio_dma_buffer_init(struct iio_dma_buffer_queue *queue, + struct device *dev, const struct iio_dma_buffer_ops *ops) +{ + iio_buffer_init(&queue->buffer); + queue->buffer.length = PAGE_SIZE; + queue->buffer.watermark = queue->buffer.length / 2; + queue->dev = dev; + queue->ops = ops; + + INIT_LIST_HEAD(&queue->incoming); + INIT_LIST_HEAD(&queue->outgoing); + + mutex_init(&queue->lock); + spin_lock_init(&queue->list_lock); + + return 0; +} +EXPORT_SYMBOL_GPL(iio_dma_buffer_init); + +/** + * iio_dma_buffer_exit() - Cleanup DMA buffer queue + * @queue: Buffer to cleanup + * + * After this function has completed it is safe to free any resources that are + * associated with the buffer and are accessed inside the callback operations. + */ +void iio_dma_buffer_exit(struct iio_dma_buffer_queue *queue) +{ + unsigned int i; + + mutex_lock(&queue->lock); + + spin_lock_irq(&queue->list_lock); + for (i = 0; i < ARRAY_SIZE(queue->fileio.blocks); i++) { + if (!queue->fileio.blocks[i]) + continue; + queue->fileio.blocks[i]->state = IIO_BLOCK_STATE_DEAD; + } + INIT_LIST_HEAD(&queue->outgoing); + spin_unlock_irq(&queue->list_lock); + + INIT_LIST_HEAD(&queue->incoming); + + for (i = 0; i < ARRAY_SIZE(queue->fileio.blocks); i++) { + if (!queue->fileio.blocks[i]) + continue; + iio_buffer_block_put(queue->fileio.blocks[i]); + queue->fileio.blocks[i] = NULL; + } + queue->fileio.active_block = NULL; + queue->ops = NULL; + + mutex_unlock(&queue->lock); +} +EXPORT_SYMBOL_GPL(iio_dma_buffer_exit); + +/** + * iio_dma_buffer_release() - Release final buffer resources + * @queue: Buffer to release + * + * Frees resources that can't yet be freed in iio_dma_buffer_exit(). Should be + * called in the buffers release callback implementation right before freeing + * the memory associated with the buffer. + */ +void iio_dma_buffer_release(struct iio_dma_buffer_queue *queue) +{ + mutex_destroy(&queue->lock); +} +EXPORT_SYMBOL_GPL(iio_dma_buffer_release); + +MODULE_AUTHOR("Lars-Peter Clausen "); +MODULE_DESCRIPTION("DMA buffer for the IIO framework"); +MODULE_LICENSE("GPL v2"); diff --git a/include/linux/iio/buffer-dma.h b/include/linux/iio/buffer-dma.h new file mode 100644 index 000000000000..767467d886de --- /dev/null +++ b/include/linux/iio/buffer-dma.h @@ -0,0 +1,152 @@ +/* + * Copyright 2013-2015 Analog Devices Inc. + * Author: Lars-Peter Clausen + * + * Licensed under the GPL-2. + */ + +#ifndef __INDUSTRIALIO_DMA_BUFFER_H__ +#define __INDUSTRIALIO_DMA_BUFFER_H__ + +#include +#include +#include +#include +#include + +struct iio_dma_buffer_queue; +struct iio_dma_buffer_ops; +struct device; + +struct iio_buffer_block { + u32 size; + u32 bytes_used; +}; + +/** + * enum iio_block_state - State of a struct iio_dma_buffer_block + * @IIO_BLOCK_STATE_DEQUEUED: Block is not queued + * @IIO_BLOCK_STATE_QUEUED: Block is on the incoming queue + * @IIO_BLOCK_STATE_ACTIVE: Block is currently being processed by the DMA + * @IIO_BLOCK_STATE_DONE: Block is on the outgoing queue + * @IIO_BLOCK_STATE_DEAD: Block has been marked as to be freed + */ +enum iio_block_state { + IIO_BLOCK_STATE_DEQUEUED, + IIO_BLOCK_STATE_QUEUED, + IIO_BLOCK_STATE_ACTIVE, + IIO_BLOCK_STATE_DONE, + IIO_BLOCK_STATE_DEAD, +}; + +/** + * struct iio_dma_buffer_block - IIO buffer block + * @head: List head + * @size: Total size of the block in bytes + * @bytes_used: Number of bytes that contain valid data + * @vaddr: Virutal address of the blocks memory + * @phys_addr: Physical address of the blocks memory + * @queue: Parent DMA buffer queue + * @kref: kref used to manage the lifetime of block + * @state: Current state of the block + */ +struct iio_dma_buffer_block { + /* May only be accessed by the owner of the block */ + struct list_head head; + size_t bytes_used; + + /* + * Set during allocation, constant thereafter. May be accessed read-only + * by anybody holding a reference to the block. + */ + void *vaddr; + dma_addr_t phys_addr; + size_t size; + struct iio_dma_buffer_queue *queue; + + /* Must not be accessed outside the core. */ + struct kref kref; + /* + * Must not be accessed outside the core. Access needs to hold + * queue->list_lock if the block is not owned by the core. + */ + enum iio_block_state state; +}; + +/** + * struct iio_dma_buffer_queue_fileio - FileIO state for the DMA buffer + * @blocks: Buffer blocks used for fileio + * @active_block: Block being used in read() + * @pos: Read offset in the active block + * @block_size: Size of each block + */ +struct iio_dma_buffer_queue_fileio { + struct iio_dma_buffer_block *blocks[2]; + struct iio_dma_buffer_block *active_block; + size_t pos; + size_t block_size; +}; + +/** + * struct iio_dma_buffer_queue - DMA buffer base structure + * @buffer: IIO buffer base structure + * @dev: Parent device + * @ops: DMA buffer callbacks + * @lock: Protects the incoming list, active and the fields in the fileio + * substruct + * @list_lock: Protects lists that contain blocks which can be modified in + * atomic context as well as blocks on those lists. This is the outgoing queue + * list and typically also a list of active blocks in the part that handles + * the DMA controller + * @incoming: List of buffers on the incoming queue + * @outgoing: List of buffers on the outgoing queue + * @active: Whether the buffer is currently active + * @fileio: FileIO state + */ +struct iio_dma_buffer_queue { + struct iio_buffer buffer; + struct device *dev; + const struct iio_dma_buffer_ops *ops; + + struct mutex lock; + spinlock_t list_lock; + struct list_head incoming; + struct list_head outgoing; + + bool active; + + struct iio_dma_buffer_queue_fileio fileio; +}; + +/** + * struct iio_dma_buffer_ops - DMA buffer callback operations + * @submit: Called when a block is submitted to the DMA controller + * @abort: Should abort all pending transfers + */ +struct iio_dma_buffer_ops { + int (*submit)(struct iio_dma_buffer_queue *queue, + struct iio_dma_buffer_block *block); + void (*abort)(struct iio_dma_buffer_queue *queue); +}; + +void iio_dma_buffer_block_done(struct iio_dma_buffer_block *block); +void iio_dma_buffer_block_list_abort(struct iio_dma_buffer_queue *queue, + struct list_head *list); + +int iio_dma_buffer_enable(struct iio_buffer *buffer, + struct iio_dev *indio_dev); +int iio_dma_buffer_disable(struct iio_buffer *buffer, + struct iio_dev *indio_dev); +int iio_dma_buffer_read(struct iio_buffer *buffer, size_t n, + char __user *user_buffer); +size_t iio_dma_buffer_data_available(struct iio_buffer *buffer); +int iio_dma_buffer_set_bytes_per_datum(struct iio_buffer *buffer, size_t bpd); +int iio_dma_buffer_set_length(struct iio_buffer *buffer, int length); +int iio_dma_buffer_request_update(struct iio_buffer *buffer); + +int iio_dma_buffer_init(struct iio_dma_buffer_queue *queue, + struct device *dma_dev, const struct iio_dma_buffer_ops *ops); +void iio_dma_buffer_exit(struct iio_dma_buffer_queue *queue); +void iio_dma_buffer_release(struct iio_dma_buffer_queue *queue); + +#endif From 2d6ca60f328450ff5c7802d0857d12e3711348ce Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Tue, 13 Oct 2015 18:10:29 +0200 Subject: [PATCH 013/843] iio: Add a DMAengine framework based buffer Add a generic fully device independent DMA buffer implementation that uses the DMAegnine framework to perform the DMA transfers. This can be used by converter drivers that whish to provide a DMA buffer for converters that are connected to a DMA core that implements the DMAengine API. Apart from allocating the buffer using iio_dmaengine_buffer_alloc() and freeing it using iio_dmaengine_buffer_free() no additional converter driver specific code is required when using this DMA buffer implementation. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/iio/buffer/Kconfig | 11 + drivers/iio/buffer/Makefile | 1 + .../buffer/industrialio-buffer-dmaengine.c | 213 ++++++++++++++++++ include/linux/iio/buffer-dmaengine.h | 18 ++ 4 files changed, 243 insertions(+) create mode 100644 drivers/iio/buffer/industrialio-buffer-dmaengine.c create mode 100644 include/linux/iio/buffer-dmaengine.h diff --git a/drivers/iio/buffer/Kconfig b/drivers/iio/buffer/Kconfig index b2fda1afc03e..4ffd3db7817f 100644 --- a/drivers/iio/buffer/Kconfig +++ b/drivers/iio/buffer/Kconfig @@ -18,6 +18,17 @@ config IIO_BUFFER_DMA Should be selected by drivers that want to use the generic DMA buffer infrastructure. +config IIO_BUFFER_DMAENGINE + tristate + select IIO_BUFFER_DMA + help + Provides a bonding of the generic IIO DMA buffer infrastructure with the + DMAengine framework. This can be used by converter drivers with a DMA port + connected to an external DMA controller which is supported by the + DMAengine framework. + + Should be selected by drivers that want to use this functionality. + config IIO_KFIFO_BUF tristate "Industrial I/O buffering based on kfifo" help diff --git a/drivers/iio/buffer/Makefile b/drivers/iio/buffer/Makefile index bda3f1143e72..85beaae831ae 100644 --- a/drivers/iio/buffer/Makefile +++ b/drivers/iio/buffer/Makefile @@ -5,5 +5,6 @@ # When adding new entries keep the list in alphabetical order obj-$(CONFIG_IIO_BUFFER_CB) += industrialio-buffer-cb.o obj-$(CONFIG_IIO_BUFFER_DMA) += industrialio-buffer-dma.o +obj-$(CONFIG_IIO_BUFFER_DMAENGINE) += industrialio-buffer-dmaengine.o obj-$(CONFIG_IIO_TRIGGERED_BUFFER) += industrialio-triggered-buffer.o obj-$(CONFIG_IIO_KFIFO_BUF) += kfifo_buf.o diff --git a/drivers/iio/buffer/industrialio-buffer-dmaengine.c b/drivers/iio/buffer/industrialio-buffer-dmaengine.c new file mode 100644 index 000000000000..ebdb838d3a1c --- /dev/null +++ b/drivers/iio/buffer/industrialio-buffer-dmaengine.c @@ -0,0 +1,213 @@ +/* + * Copyright 2014-2015 Analog Devices Inc. + * Author: Lars-Peter Clausen + * + * Licensed under the GPL-2 or later. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +/* + * The IIO DMAengine buffer combines the generic IIO DMA buffer infrastructure + * with the DMAengine framework. The generic IIO DMA buffer infrastructure is + * used to manage the buffer memory and implement the IIO buffer operations + * while the DMAengine framework is used to perform the DMA transfers. Combined + * this results in a device independent fully functional DMA buffer + * implementation that can be used by device drivers for peripherals which are + * connected to a DMA controller which has a DMAengine driver implementation. + */ + +struct dmaengine_buffer { + struct iio_dma_buffer_queue queue; + + struct dma_chan *chan; + struct list_head active; + + size_t align; + size_t max_size; +}; + +static struct dmaengine_buffer *iio_buffer_to_dmaengine_buffer( + struct iio_buffer *buffer) +{ + return container_of(buffer, struct dmaengine_buffer, queue.buffer); +} + +static void iio_dmaengine_buffer_block_done(void *data) +{ + struct iio_dma_buffer_block *block = data; + unsigned long flags; + + spin_lock_irqsave(&block->queue->list_lock, flags); + list_del(&block->head); + spin_unlock_irqrestore(&block->queue->list_lock, flags); + iio_dma_buffer_block_done(block); +} + +static int iio_dmaengine_buffer_submit_block(struct iio_dma_buffer_queue *queue, + struct iio_dma_buffer_block *block) +{ + struct dmaengine_buffer *dmaengine_buffer = + iio_buffer_to_dmaengine_buffer(&queue->buffer); + struct dma_async_tx_descriptor *desc; + dma_cookie_t cookie; + + block->bytes_used = min(block->size, dmaengine_buffer->max_size); + block->bytes_used = rounddown(block->bytes_used, + dmaengine_buffer->align); + + desc = dmaengine_prep_slave_single(dmaengine_buffer->chan, + block->phys_addr, block->bytes_used, DMA_DEV_TO_MEM, + DMA_PREP_INTERRUPT); + if (!desc) + return -ENOMEM; + + desc->callback = iio_dmaengine_buffer_block_done; + desc->callback_param = block; + + cookie = dmaengine_submit(desc); + if (dma_submit_error(cookie)) + return dma_submit_error(cookie); + + spin_lock_irq(&dmaengine_buffer->queue.list_lock); + list_add_tail(&block->head, &dmaengine_buffer->active); + spin_unlock_irq(&dmaengine_buffer->queue.list_lock); + + dma_async_issue_pending(dmaengine_buffer->chan); + + return 0; +} + +static void iio_dmaengine_buffer_abort(struct iio_dma_buffer_queue *queue) +{ + struct dmaengine_buffer *dmaengine_buffer = + iio_buffer_to_dmaengine_buffer(&queue->buffer); + + dmaengine_terminate_all(dmaengine_buffer->chan); + /* FIXME: There is a slight chance of a race condition here. + * dmaengine_terminate_all() does not guarantee that all transfer + * callbacks have finished running. Need to introduce a + * dmaengine_terminate_all_sync(). + */ + iio_dma_buffer_block_list_abort(queue, &dmaengine_buffer->active); +} + +static void iio_dmaengine_buffer_release(struct iio_buffer *buf) +{ + struct dmaengine_buffer *dmaengine_buffer = + iio_buffer_to_dmaengine_buffer(buf); + + iio_dma_buffer_release(&dmaengine_buffer->queue); + kfree(dmaengine_buffer); +} + +static const struct iio_buffer_access_funcs iio_dmaengine_buffer_ops = { + .read_first_n = iio_dma_buffer_read, + .set_bytes_per_datum = iio_dma_buffer_set_bytes_per_datum, + .set_length = iio_dma_buffer_set_length, + .request_update = iio_dma_buffer_request_update, + .enable = iio_dma_buffer_enable, + .disable = iio_dma_buffer_disable, + .data_available = iio_dma_buffer_data_available, + .release = iio_dmaengine_buffer_release, + + .modes = INDIO_BUFFER_HARDWARE, + .flags = INDIO_BUFFER_FLAG_FIXED_WATERMARK, +}; + +static const struct iio_dma_buffer_ops iio_dmaengine_default_ops = { + .submit = iio_dmaengine_buffer_submit_block, + .abort = iio_dmaengine_buffer_abort, +}; + +/** + * iio_dmaengine_buffer_alloc() - Allocate new buffer which uses DMAengine + * @dev: Parent device for the buffer + * @channel: DMA channel name, typically "rx". + * + * This allocates a new IIO buffer which internally uses the DMAengine framework + * to perform its transfers. The parent device will be used to request the DMA + * channel. + * + * Once done using the buffer iio_dmaengine_buffer_free() should be used to + * release it. + */ +struct iio_buffer *iio_dmaengine_buffer_alloc(struct device *dev, + const char *channel) +{ + struct dmaengine_buffer *dmaengine_buffer; + unsigned int width, src_width, dest_width; + struct dma_slave_caps caps; + struct dma_chan *chan; + int ret; + + dmaengine_buffer = kzalloc(sizeof(*dmaengine_buffer), GFP_KERNEL); + if (!dmaengine_buffer) + return ERR_PTR(-ENOMEM); + + chan = dma_request_slave_channel_reason(dev, channel); + if (IS_ERR(chan)) { + ret = PTR_ERR(chan); + goto err_free; + } + + ret = dma_get_slave_caps(chan, &caps); + if (ret < 0) + goto err_free; + + /* Needs to be aligned to the maximum of the minimums */ + if (caps.src_addr_widths) + src_width = __ffs(caps.src_addr_widths); + else + src_width = 1; + if (caps.dst_addr_widths) + dest_width = __ffs(caps.dst_addr_widths); + else + dest_width = 1; + width = max(src_width, dest_width); + + INIT_LIST_HEAD(&dmaengine_buffer->active); + dmaengine_buffer->chan = chan; + dmaengine_buffer->align = width; + dmaengine_buffer->max_size = dma_get_max_seg_size(chan->device->dev); + + iio_dma_buffer_init(&dmaengine_buffer->queue, chan->device->dev, + &iio_dmaengine_default_ops); + + dmaengine_buffer->queue.buffer.access = &iio_dmaengine_buffer_ops; + + return &dmaengine_buffer->queue.buffer; + +err_free: + kfree(dmaengine_buffer); + return ERR_PTR(ret); +} +EXPORT_SYMBOL(iio_dmaengine_buffer_alloc); + +/** + * iio_dmaengine_buffer_free() - Free dmaengine buffer + * @buffer: Buffer to free + * + * Frees a buffer previously allocated with iio_dmaengine_buffer_alloc(). + */ +void iio_dmaengine_buffer_free(struct iio_buffer *buffer) +{ + struct dmaengine_buffer *dmaengine_buffer = + iio_buffer_to_dmaengine_buffer(buffer); + + iio_dma_buffer_exit(&dmaengine_buffer->queue); + dma_release_channel(dmaengine_buffer->chan); + + iio_buffer_put(buffer); +} +EXPORT_SYMBOL_GPL(iio_dmaengine_buffer_free); diff --git a/include/linux/iio/buffer-dmaengine.h b/include/linux/iio/buffer-dmaengine.h new file mode 100644 index 000000000000..5dcddf427bb0 --- /dev/null +++ b/include/linux/iio/buffer-dmaengine.h @@ -0,0 +1,18 @@ +/* + * Copyright 2014-2015 Analog Devices Inc. + * Author: Lars-Peter Clausen + * + * Licensed under the GPL-2 or later. + */ + +#ifndef __IIO_DMAENGINE_H__ +#define __IIO_DMAENGINE_H__ + +struct iio_buffer; +struct device; + +struct iio_buffer *iio_dmaengine_buffer_alloc(struct device *dev, + const char *channel); +void iio_dmaengine_buffer_free(struct iio_buffer *buffer); + +#endif From 18fb1ab0eb81a08ecb00065f3e6c037a37d8e917 Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Fri, 30 Oct 2015 16:50:39 -0700 Subject: [PATCH 014/843] iio: light: lm3533-als: Print error message on invalid resistance Print an error message to indicate that invalid configuration data was provided in the platform_data, rather than just aborting initialization. Signed-off-by: Bjorn Andersson Signed-off-by: Jonathan Cameron --- drivers/iio/light/lm3533-als.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iio/light/lm3533-als.c b/drivers/iio/light/lm3533-als.c index 076bc46fad03..e56937c40a18 100644 --- a/drivers/iio/light/lm3533-als.c +++ b/drivers/iio/light/lm3533-als.c @@ -743,8 +743,10 @@ static int lm3533_als_set_resistor(struct lm3533_als *als, u8 val) { int ret; - if (val < LM3533_ALS_RESISTOR_MIN || val > LM3533_ALS_RESISTOR_MAX) + if (val < LM3533_ALS_RESISTOR_MIN || val > LM3533_ALS_RESISTOR_MAX) { + dev_err(&als->pdev->dev, "invalid resistor value\n"); return -EINVAL; + }; ret = lm3533_write(als->lm3533, LM3533_REG_ALS_RESISTOR_SELECT, val); if (ret) { From a84ef0d181d917125f1f16cffe53f84c19968969 Mon Sep 17 00:00:00 2001 From: Joachim Eastwood Date: Sat, 31 Oct 2015 13:49:16 +0100 Subject: [PATCH 015/843] iio: accel: add Freescale MMA7455L/MMA7456L 3-axis accelerometer driver Add support for Freescale MMA7455L/MMA7456L 3-axis in 10-bit mode for I2C and SPI bus. This rather simple driver that currently doesn't support all the hardware features of MMA7455L/MMA7456L. Tested on Embedded Artist's LPC4357 Dev Kit with MMA7455L on I2C bus. Data sheets for the two devices can be found here: http://cache.freescale.com/files/sensors/doc/data_sheet/MMA7455L.pdf http://cache.freescale.com/files/sensors/doc/data_sheet/MMA7456L.pdf Signed-off-by: Joachim Eastwood Signed-off-by: Jonathan Cameron --- drivers/iio/accel/Kconfig | 29 +++ drivers/iio/accel/Makefile | 5 + drivers/iio/accel/mma7455.h | 19 ++ drivers/iio/accel/mma7455_core.c | 311 +++++++++++++++++++++++++++++++ drivers/iio/accel/mma7455_i2c.c | 56 ++++++ drivers/iio/accel/mma7455_spi.c | 52 ++++++ 6 files changed, 472 insertions(+) create mode 100644 drivers/iio/accel/mma7455.h create mode 100644 drivers/iio/accel/mma7455_core.c create mode 100644 drivers/iio/accel/mma7455_i2c.c create mode 100644 drivers/iio/accel/mma7455_spi.c diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig index 75ac08790bc5..87487d377f9b 100644 --- a/drivers/iio/accel/Kconfig +++ b/drivers/iio/accel/Kconfig @@ -107,6 +107,35 @@ config KXCJK1013 To compile this driver as a module, choose M here: the module will be called kxcjk-1013. +config MMA7455 + tristate + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + +config MMA7455_I2C + tristate "Freescale MMA7455L/MMA7456L Accelerometer I2C Driver" + depends on I2C + select MMA7455 + select REGMAP_I2C + help + Say yes here to build support for the Freescale MMA7455L and + MMA7456L 3-axis accelerometer. + + To compile this driver as a module, choose M here: the module + will be called mma7455_i2c. + +config MMA7455_SPI + tristate "Freescale MMA7455L/MMA7456L Accelerometer SPI Driver" + depends on SPI_MASTER + select MMA7455 + select REGMAP_SPI + help + Say yes here to build support for the Freescale MMA7455L and + MMA7456L 3-axis accelerometer. + + To compile this driver as a module, choose M here: the module + will be called mma7455_spi. + config MMA8452 tristate "Freescale MMA8452Q and similar Accelerometers Driver" depends on I2C diff --git a/drivers/iio/accel/Makefile b/drivers/iio/accel/Makefile index 525ed52fab52..71b6794de885 100644 --- a/drivers/iio/accel/Makefile +++ b/drivers/iio/accel/Makefile @@ -10,6 +10,11 @@ obj-$(CONFIG_BMC150_ACCEL_SPI) += bmc150-accel-spi.o obj-$(CONFIG_HID_SENSOR_ACCEL_3D) += hid-sensor-accel-3d.o obj-$(CONFIG_KXCJK1013) += kxcjk-1013.o obj-$(CONFIG_KXSD9) += kxsd9.o + +obj-$(CONFIG_MMA7455) += mma7455_core.o +obj-$(CONFIG_MMA7455_I2C) += mma7455_i2c.o +obj-$(CONFIG_MMA7455_SPI) += mma7455_spi.o + obj-$(CONFIG_MMA8452) += mma8452.o obj-$(CONFIG_MMA9551_CORE) += mma9551_core.o diff --git a/drivers/iio/accel/mma7455.h b/drivers/iio/accel/mma7455.h new file mode 100644 index 000000000000..2b1152c53d4f --- /dev/null +++ b/drivers/iio/accel/mma7455.h @@ -0,0 +1,19 @@ +/* + * IIO accel driver for Freescale MMA7455L 3-axis 10-bit accelerometer + * Copyright 2015 Joachim Eastwood + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef __MMA7455_H +#define __MMA7455_H + +extern const struct regmap_config mma7455_core_regmap; + +int mma7455_core_probe(struct device *dev, struct regmap *regmap, + const char *name); +int mma7455_core_remove(struct device *dev); + +#endif diff --git a/drivers/iio/accel/mma7455_core.c b/drivers/iio/accel/mma7455_core.c new file mode 100644 index 000000000000..c633cc2c0789 --- /dev/null +++ b/drivers/iio/accel/mma7455_core.c @@ -0,0 +1,311 @@ +/* + * IIO accel core driver for Freescale MMA7455L 3-axis 10-bit accelerometer + * Copyright 2015 Joachim Eastwood + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * UNSUPPORTED hardware features: + * - 8-bit mode with different scales + * - INT1/INT2 interrupts + * - Offset calibration + * - Events + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mma7455.h" + +#define MMA7455_REG_XOUTL 0x00 +#define MMA7455_REG_XOUTH 0x01 +#define MMA7455_REG_YOUTL 0x02 +#define MMA7455_REG_YOUTH 0x03 +#define MMA7455_REG_ZOUTL 0x04 +#define MMA7455_REG_ZOUTH 0x05 +#define MMA7455_REG_STATUS 0x09 +#define MMA7455_STATUS_DRDY BIT(0) +#define MMA7455_REG_WHOAMI 0x0f +#define MMA7455_WHOAMI_ID 0x55 +#define MMA7455_REG_MCTL 0x16 +#define MMA7455_MCTL_MODE_STANDBY 0x00 +#define MMA7455_MCTL_MODE_MEASURE 0x01 +#define MMA7455_REG_CTL1 0x18 +#define MMA7455_CTL1_DFBW_MASK BIT(7) +#define MMA7455_CTL1_DFBW_125HZ BIT(7) +#define MMA7455_CTL1_DFBW_62_5HZ 0 +#define MMA7455_REG_TW 0x1e + +/* + * When MMA7455 is used in 10-bit it has a fullscale of -8g + * corresponding to raw value -512. The userspace interface + * uses m/s^2 and we declare micro units. + * So scale factor is given by: + * g * 8 * 1e6 / 512 = 153228.90625, with g = 9.80665 + */ +#define MMA7455_10BIT_SCALE 153229 + +struct mma7455_data { + struct regmap *regmap; + struct device *dev; +}; + +static int mma7455_drdy(struct mma7455_data *mma7455) +{ + unsigned int reg; + int tries = 3; + int ret; + + while (tries-- > 0) { + ret = regmap_read(mma7455->regmap, MMA7455_REG_STATUS, ®); + if (ret) + return ret; + + if (reg & MMA7455_STATUS_DRDY) + return 0; + + msleep(20); + } + + dev_warn(mma7455->dev, "data not ready\n"); + + return -EIO; +} + +static irqreturn_t mma7455_trigger_handler(int irq, void *p) +{ + struct iio_poll_func *pf = p; + struct iio_dev *indio_dev = pf->indio_dev; + struct mma7455_data *mma7455 = iio_priv(indio_dev); + u8 buf[16]; /* 3 x 16-bit channels + padding + ts */ + int ret; + + ret = mma7455_drdy(mma7455); + if (ret) + goto done; + + ret = regmap_bulk_read(mma7455->regmap, MMA7455_REG_XOUTL, buf, + sizeof(__le16) * 3); + if (ret) + goto done; + + iio_push_to_buffers_with_timestamp(indio_dev, buf, iio_get_time_ns()); + +done: + iio_trigger_notify_done(indio_dev->trig); + + return IRQ_HANDLED; +} + +static int mma7455_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, int *val2, long mask) +{ + struct mma7455_data *mma7455 = iio_priv(indio_dev); + unsigned int reg; + __le16 data; + int ret; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + if (iio_buffer_enabled(indio_dev)) + return -EBUSY; + + ret = mma7455_drdy(mma7455); + if (ret) + return ret; + + ret = regmap_bulk_read(mma7455->regmap, chan->address, &data, + sizeof(data)); + if (ret) + return ret; + + *val = sign_extend32(le16_to_cpu(data), 9); + + return IIO_VAL_INT; + + case IIO_CHAN_INFO_SCALE: + *val = 0; + *val2 = MMA7455_10BIT_SCALE; + + return IIO_VAL_INT_PLUS_MICRO; + + case IIO_CHAN_INFO_SAMP_FREQ: + ret = regmap_read(mma7455->regmap, MMA7455_REG_CTL1, ®); + if (ret) + return ret; + + if (reg & MMA7455_CTL1_DFBW_MASK) + *val = 250; + else + *val = 125; + + return IIO_VAL_INT; + } + + return -EINVAL; +} + +static int mma7455_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int val, int val2, long mask) +{ + struct mma7455_data *mma7455 = iio_priv(indio_dev); + int i; + + switch (mask) { + case IIO_CHAN_INFO_SAMP_FREQ: + if (val == 250 && val2 == 0) + i = MMA7455_CTL1_DFBW_125HZ; + else if (val == 125 && val2 == 0) + i = MMA7455_CTL1_DFBW_62_5HZ; + else + return -EINVAL; + + return regmap_update_bits(mma7455->regmap, MMA7455_REG_CTL1, + MMA7455_CTL1_DFBW_MASK, i); + + case IIO_CHAN_INFO_SCALE: + /* In 10-bit mode there is only one scale available */ + if (val == 0 && val2 == MMA7455_10BIT_SCALE) + return 0; + break; + } + + return -EINVAL; +} + +static IIO_CONST_ATTR(sampling_frequency_available, "125 250"); + +static struct attribute *mma7455_attributes[] = { + &iio_const_attr_sampling_frequency_available.dev_attr.attr, + NULL +}; + +static const struct attribute_group mma7455_group = { + .attrs = mma7455_attributes, +}; + +static const struct iio_info mma7455_info = { + .attrs = &mma7455_group, + .read_raw = mma7455_read_raw, + .write_raw = mma7455_write_raw, + .driver_module = THIS_MODULE, +}; + +#define MMA7455_CHANNEL(axis, idx) { \ + .type = IIO_ACCEL, \ + .modified = 1, \ + .address = MMA7455_REG_##axis##OUTL,\ + .channel2 = IIO_MOD_##axis, \ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SAMP_FREQ) | \ + BIT(IIO_CHAN_INFO_SCALE), \ + .scan_index = idx, \ + .scan_type = { \ + .sign = 's', \ + .realbits = 10, \ + .storagebits = 16, \ + .endianness = IIO_LE, \ + }, \ +} + +static const struct iio_chan_spec mma7455_channels[] = { + MMA7455_CHANNEL(X, 0), + MMA7455_CHANNEL(Y, 1), + MMA7455_CHANNEL(Z, 2), + IIO_CHAN_SOFT_TIMESTAMP(3), +}; + +static const unsigned long mma7455_scan_masks[] = {0x7, 0}; + +const struct regmap_config mma7455_core_regmap = { + .reg_bits = 8, + .val_bits = 8, + .max_register = MMA7455_REG_TW, +}; +EXPORT_SYMBOL_GPL(mma7455_core_regmap); + +int mma7455_core_probe(struct device *dev, struct regmap *regmap, + const char *name) +{ + struct mma7455_data *mma7455; + struct iio_dev *indio_dev; + unsigned int reg; + int ret; + + ret = regmap_read(regmap, MMA7455_REG_WHOAMI, ®); + if (ret) { + dev_err(dev, "unable to read reg\n"); + return ret; + } + + if (reg != MMA7455_WHOAMI_ID) { + dev_err(dev, "device id mismatch\n"); + return -ENODEV; + } + + indio_dev = devm_iio_device_alloc(dev, sizeof(*mma7455)); + if (!indio_dev) + return -ENOMEM; + + dev_set_drvdata(dev, indio_dev); + mma7455 = iio_priv(indio_dev); + mma7455->regmap = regmap; + mma7455->dev = dev; + + indio_dev->info = &mma7455_info; + indio_dev->name = name; + indio_dev->dev.parent = dev; + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->channels = mma7455_channels; + indio_dev->num_channels = ARRAY_SIZE(mma7455_channels); + indio_dev->available_scan_masks = mma7455_scan_masks; + + regmap_write(mma7455->regmap, MMA7455_REG_MCTL, + MMA7455_MCTL_MODE_MEASURE); + + ret = iio_triggered_buffer_setup(indio_dev, NULL, + mma7455_trigger_handler, NULL); + if (ret) { + dev_err(dev, "unable to setup triggered buffer\n"); + return ret; + } + + ret = iio_device_register(indio_dev); + if (ret) { + dev_err(dev, "unable to register device\n"); + iio_triggered_buffer_cleanup(indio_dev); + return ret; + } + + return 0; +} +EXPORT_SYMBOL_GPL(mma7455_core_probe); + +int mma7455_core_remove(struct device *dev) +{ + struct iio_dev *indio_dev = dev_get_drvdata(dev); + struct mma7455_data *mma7455 = iio_priv(indio_dev); + + iio_device_unregister(indio_dev); + iio_triggered_buffer_cleanup(indio_dev); + + regmap_write(mma7455->regmap, MMA7455_REG_MCTL, + MMA7455_MCTL_MODE_STANDBY); + + return 0; +} +EXPORT_SYMBOL_GPL(mma7455_core_remove); + +MODULE_AUTHOR("Joachim Eastwood "); +MODULE_DESCRIPTION("Freescale MMA7455L core accelerometer driver"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/iio/accel/mma7455_i2c.c b/drivers/iio/accel/mma7455_i2c.c new file mode 100644 index 000000000000..3cab5fb4a3c4 --- /dev/null +++ b/drivers/iio/accel/mma7455_i2c.c @@ -0,0 +1,56 @@ +/* + * IIO accel I2C driver for Freescale MMA7455L 3-axis 10-bit accelerometer + * Copyright 2015 Joachim Eastwood + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include + +#include "mma7455.h" + +static int mma7455_i2c_probe(struct i2c_client *i2c, + const struct i2c_device_id *id) +{ + struct regmap *regmap; + const char *name = NULL; + + regmap = devm_regmap_init_i2c(i2c, &mma7455_core_regmap); + if (IS_ERR(regmap)) + return PTR_ERR(regmap); + + if (id) + name = id->name; + + return mma7455_core_probe(&i2c->dev, regmap, name); +} + +static int mma7455_i2c_remove(struct i2c_client *i2c) +{ + return mma7455_core_remove(&i2c->dev); +} + +static const struct i2c_device_id mma7455_i2c_ids[] = { + { "mma7455", 0 }, + { "mma7456", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, mma7455_i2c_ids); + +static struct i2c_driver mma7455_i2c_driver = { + .probe = mma7455_i2c_probe, + .remove = mma7455_i2c_remove, + .id_table = mma7455_i2c_ids, + .driver = { + .name = "mma7455-i2c", + }, +}; +module_i2c_driver(mma7455_i2c_driver); + +MODULE_AUTHOR("Joachim Eastwood "); +MODULE_DESCRIPTION("Freescale MMA7455L I2C accelerometer driver"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/iio/accel/mma7455_spi.c b/drivers/iio/accel/mma7455_spi.c new file mode 100644 index 000000000000..79df8f27cf99 --- /dev/null +++ b/drivers/iio/accel/mma7455_spi.c @@ -0,0 +1,52 @@ +/* + * IIO accel SPI driver for Freescale MMA7455L 3-axis 10-bit accelerometer + * Copyright 2015 Joachim Eastwood + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include + +#include "mma7455.h" + +static int mma7455_spi_probe(struct spi_device *spi) +{ + const struct spi_device_id *id = spi_get_device_id(spi); + struct regmap *regmap; + + regmap = devm_regmap_init_spi(spi, &mma7455_core_regmap); + if (IS_ERR(regmap)) + return PTR_ERR(regmap); + + return mma7455_core_probe(&spi->dev, regmap, id->name); +} + +static int mma7455_spi_remove(struct spi_device *spi) +{ + return mma7455_core_remove(&spi->dev); +} + +static const struct spi_device_id mma7455_spi_ids[] = { + { "mma7455", 0 }, + { "mma7456", 0 }, + { } +}; +MODULE_DEVICE_TABLE(spi, mma7455_spi_ids); + +static struct spi_driver mma7455_spi_driver = { + .probe = mma7455_spi_probe, + .remove = mma7455_spi_remove, + .id_table = mma7455_spi_ids, + .driver = { + .name = "mma7455-spi", + }, +}; +module_spi_driver(mma7455_spi_driver); + +MODULE_AUTHOR("Joachim Eastwood "); +MODULE_DESCRIPTION("Freescale MMA7455L SPI accelerometer driver"); +MODULE_LICENSE("GPL v2"); From 536bbca7cfc9e7a85704de552fcf4b5d1062a38e Mon Sep 17 00:00:00 2001 From: Adriana Reus Date: Fri, 6 Nov 2015 11:10:37 +0200 Subject: [PATCH 016/843] iio: light: pa12203001: Poweroff chip if register fails Make sure we poweroff the chip if for any reason iio_register returns an error. Signed-off-by: Adriana Reus Signed-off-by: Jonathan Cameron --- drivers/iio/light/pa12203001.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/iio/light/pa12203001.c b/drivers/iio/light/pa12203001.c index 45f7bde02bbf..76a9e12b46bc 100644 --- a/drivers/iio/light/pa12203001.c +++ b/drivers/iio/light/pa12203001.c @@ -381,17 +381,23 @@ static int pa12203001_probe(struct i2c_client *client, return ret; ret = pm_runtime_set_active(&client->dev); - if (ret < 0) { - pa12203001_power_chip(indio_dev, PA12203001_CHIP_DISABLE); - return ret; - } + if (ret < 0) + goto out_err; pm_runtime_enable(&client->dev); pm_runtime_set_autosuspend_delay(&client->dev, PA12203001_SLEEP_DELAY_MS); pm_runtime_use_autosuspend(&client->dev); - return iio_device_register(indio_dev); + ret = iio_device_register(indio_dev); + if (ret < 0) + goto out_err; + + return 0; + +out_err: + pa12203001_power_chip(indio_dev, PA12203001_CHIP_DISABLE); + return ret; } static int pa12203001_remove(struct i2c_client *client) From 7d0ead5c3f00a0652fa4436f0d2dd05e9f2de140 Mon Sep 17 00:00:00 2001 From: Adriana Reus Date: Thu, 5 Nov 2015 16:25:29 +0200 Subject: [PATCH 017/843] iio: Reconcile operation order between iio_register/unregister and pm functions At probe, runtime pm should be setup before registering the sysfs interface so that all the power attributes are accurate and functional when registering. Also, when removing the device we should unregister first to make sure that the interfaces that may result in wakeups are no longer available. Fix this behaviour for the following drivers: bmc150, bmg160, kmx61, kxcj-1013, mma9551, mma9553, rpr0521. Signed-off-by: Adriana Reus Signed-off-by: Jonathan Cameron --- drivers/iio/accel/bmc150-accel-core.c | 22 ++++++++++------------ drivers/iio/accel/kxcjk-1013.c | 20 +++++++++----------- drivers/iio/accel/mma9551.c | 19 +++++++++---------- drivers/iio/accel/mma9553.c | 20 +++++++++----------- drivers/iio/gyro/bmg160_core.c | 19 +++++++++---------- drivers/iio/imu/kmx61.c | 24 +++++++++++------------- drivers/iio/light/rpr0521.c | 14 ++++---------- drivers/iio/magnetometer/bmc150_magn.c | 20 +++++++++----------- 8 files changed, 70 insertions(+), 88 deletions(-) diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c index 2d33f1e821db..c73331f7782b 100644 --- a/drivers/iio/accel/bmc150-accel-core.c +++ b/drivers/iio/accel/bmc150-accel-core.c @@ -1623,24 +1623,22 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq, } } + ret = pm_runtime_set_active(dev); + if (ret) + goto err_trigger_unregister; + + pm_runtime_enable(dev); + pm_runtime_set_autosuspend_delay(dev, BMC150_AUTO_SUSPEND_DELAY_MS); + pm_runtime_use_autosuspend(dev); + ret = iio_device_register(indio_dev); if (ret < 0) { dev_err(dev, "Unable to register iio device\n"); goto err_trigger_unregister; } - ret = pm_runtime_set_active(dev); - if (ret) - goto err_iio_unregister; - - pm_runtime_enable(dev); - pm_runtime_set_autosuspend_delay(dev, BMC150_AUTO_SUSPEND_DELAY_MS); - pm_runtime_use_autosuspend(dev); - return 0; -err_iio_unregister: - iio_device_unregister(indio_dev); err_trigger_unregister: bmc150_accel_unregister_triggers(data, BMC150_ACCEL_TRIGGERS - 1); err_buffer_cleanup: @@ -1655,12 +1653,12 @@ int bmc150_accel_core_remove(struct device *dev) struct iio_dev *indio_dev = dev_get_drvdata(dev); struct bmc150_accel_data *data = iio_priv(indio_dev); + iio_device_unregister(indio_dev); + pm_runtime_disable(data->dev); pm_runtime_set_suspended(data->dev); pm_runtime_put_noidle(data->dev); - iio_device_unregister(indio_dev); - bmc150_accel_unregister_triggers(data, BMC150_ACCEL_TRIGGERS - 1); iio_triggered_buffer_cleanup(indio_dev); diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index 18c1b06684c1..edec1d099e91 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c @@ -1264,25 +1264,23 @@ static int kxcjk1013_probe(struct i2c_client *client, goto err_trigger_unregister; } - ret = iio_device_register(indio_dev); - if (ret < 0) { - dev_err(&client->dev, "unable to register iio device\n"); - goto err_buffer_cleanup; - } - ret = pm_runtime_set_active(&client->dev); if (ret) - goto err_iio_unregister; + goto err_buffer_cleanup; pm_runtime_enable(&client->dev); pm_runtime_set_autosuspend_delay(&client->dev, KXCJK1013_SLEEP_DELAY_MS); pm_runtime_use_autosuspend(&client->dev); + ret = iio_device_register(indio_dev); + if (ret < 0) { + dev_err(&client->dev, "unable to register iio device\n"); + goto err_buffer_cleanup; + } + return 0; -err_iio_unregister: - iio_device_unregister(indio_dev); err_buffer_cleanup: if (data->dready_trig) iio_triggered_buffer_cleanup(indio_dev); @@ -1302,12 +1300,12 @@ static int kxcjk1013_remove(struct i2c_client *client) struct iio_dev *indio_dev = i2c_get_clientdata(client); struct kxcjk1013_data *data = iio_priv(indio_dev); + iio_device_unregister(indio_dev); + pm_runtime_disable(&client->dev); pm_runtime_set_suspended(&client->dev); pm_runtime_put_noidle(&client->dev); - iio_device_unregister(indio_dev); - if (data->dready_trig) { iio_triggered_buffer_cleanup(indio_dev); iio_trigger_unregister(data->dready_trig); diff --git a/drivers/iio/accel/mma9551.c b/drivers/iio/accel/mma9551.c index 7db7cc0bf362..d899a4d4307f 100644 --- a/drivers/iio/accel/mma9551.c +++ b/drivers/iio/accel/mma9551.c @@ -495,25 +495,23 @@ static int mma9551_probe(struct i2c_client *client, if (ret < 0) goto out_poweroff; - ret = iio_device_register(indio_dev); - if (ret < 0) { - dev_err(&client->dev, "unable to register iio device\n"); - goto out_poweroff; - } - ret = pm_runtime_set_active(&client->dev); if (ret < 0) - goto out_iio_unregister; + goto out_poweroff; pm_runtime_enable(&client->dev); pm_runtime_set_autosuspend_delay(&client->dev, MMA9551_AUTO_SUSPEND_DELAY_MS); pm_runtime_use_autosuspend(&client->dev); + ret = iio_device_register(indio_dev); + if (ret < 0) { + dev_err(&client->dev, "unable to register iio device\n"); + goto out_poweroff; + } + return 0; -out_iio_unregister: - iio_device_unregister(indio_dev); out_poweroff: mma9551_set_device_state(client, false); @@ -525,11 +523,12 @@ static int mma9551_remove(struct i2c_client *client) struct iio_dev *indio_dev = i2c_get_clientdata(client); struct mma9551_data *data = iio_priv(indio_dev); + iio_device_unregister(indio_dev); + pm_runtime_disable(&client->dev); pm_runtime_set_suspended(&client->dev); pm_runtime_put_noidle(&client->dev); - iio_device_unregister(indio_dev); mutex_lock(&data->mutex); mma9551_set_device_state(data->client, false); mutex_unlock(&data->mutex); diff --git a/drivers/iio/accel/mma9553.c b/drivers/iio/accel/mma9553.c index 9408ef3add58..fa7d36217c4b 100644 --- a/drivers/iio/accel/mma9553.c +++ b/drivers/iio/accel/mma9553.c @@ -1133,27 +1133,24 @@ static int mma9553_probe(struct i2c_client *client, } } - ret = iio_device_register(indio_dev); - if (ret < 0) { - dev_err(&client->dev, "unable to register iio device\n"); - goto out_poweroff; - } - ret = pm_runtime_set_active(&client->dev); if (ret < 0) - goto out_iio_unregister; + goto out_poweroff; pm_runtime_enable(&client->dev); pm_runtime_set_autosuspend_delay(&client->dev, MMA9551_AUTO_SUSPEND_DELAY_MS); pm_runtime_use_autosuspend(&client->dev); - dev_dbg(&indio_dev->dev, "Registered device %s\n", name); + ret = iio_device_register(indio_dev); + if (ret < 0) { + dev_err(&client->dev, "unable to register iio device\n"); + goto out_poweroff; + } + dev_dbg(&indio_dev->dev, "Registered device %s\n", name); return 0; -out_iio_unregister: - iio_device_unregister(indio_dev); out_poweroff: mma9551_set_device_state(client, false); return ret; @@ -1164,11 +1161,12 @@ static int mma9553_remove(struct i2c_client *client) struct iio_dev *indio_dev = i2c_get_clientdata(client); struct mma9553_data *data = iio_priv(indio_dev); + iio_device_unregister(indio_dev); + pm_runtime_disable(&client->dev); pm_runtime_set_suspended(&client->dev); pm_runtime_put_noidle(&client->dev); - iio_device_unregister(indio_dev); mutex_lock(&data->mutex); mma9551_set_device_state(data->client, false); mutex_unlock(&data->mutex); diff --git a/drivers/iio/gyro/bmg160_core.c b/drivers/iio/gyro/bmg160_core.c index 02ff789852a0..bbce3b09ac45 100644 --- a/drivers/iio/gyro/bmg160_core.c +++ b/drivers/iio/gyro/bmg160_core.c @@ -1077,25 +1077,23 @@ int bmg160_core_probe(struct device *dev, struct regmap *regmap, int irq, goto err_trigger_unregister; } - ret = iio_device_register(indio_dev); - if (ret < 0) { - dev_err(dev, "unable to register iio device\n"); - goto err_buffer_cleanup; - } - ret = pm_runtime_set_active(dev); if (ret) - goto err_iio_unregister; + goto err_buffer_cleanup; pm_runtime_enable(dev); pm_runtime_set_autosuspend_delay(dev, BMG160_AUTO_SUSPEND_DELAY_MS); pm_runtime_use_autosuspend(dev); + ret = iio_device_register(indio_dev); + if (ret < 0) { + dev_err(dev, "unable to register iio device\n"); + goto err_buffer_cleanup; + } + return 0; -err_iio_unregister: - iio_device_unregister(indio_dev); err_buffer_cleanup: iio_triggered_buffer_cleanup(indio_dev); err_trigger_unregister: @@ -1113,11 +1111,12 @@ void bmg160_core_remove(struct device *dev) struct iio_dev *indio_dev = dev_get_drvdata(dev); struct bmg160_data *data = iio_priv(indio_dev); + iio_device_unregister(indio_dev); + pm_runtime_disable(dev); pm_runtime_set_suspended(dev); pm_runtime_put_noidle(dev); - iio_device_unregister(indio_dev); iio_triggered_buffer_cleanup(indio_dev); if (data->dready_trig) { diff --git a/drivers/iio/imu/kmx61.c b/drivers/iio/imu/kmx61.c index dbf5e9936635..e5306b4e020e 100644 --- a/drivers/iio/imu/kmx61.c +++ b/drivers/iio/imu/kmx61.c @@ -1390,6 +1390,14 @@ static int kmx61_probe(struct i2c_client *client, } } + ret = pm_runtime_set_active(&client->dev); + if (ret < 0) + goto err_buffer_cleanup_mag; + + pm_runtime_enable(&client->dev); + pm_runtime_set_autosuspend_delay(&client->dev, KMX61_SLEEP_DELAY_MS); + pm_runtime_use_autosuspend(&client->dev); + ret = iio_device_register(data->acc_indio_dev); if (ret < 0) { dev_err(&client->dev, "Failed to register acc iio device\n"); @@ -1402,18 +1410,8 @@ static int kmx61_probe(struct i2c_client *client, goto err_iio_unregister_acc; } - ret = pm_runtime_set_active(&client->dev); - if (ret < 0) - goto err_iio_unregister_mag; - - pm_runtime_enable(&client->dev); - pm_runtime_set_autosuspend_delay(&client->dev, KMX61_SLEEP_DELAY_MS); - pm_runtime_use_autosuspend(&client->dev); - return 0; -err_iio_unregister_mag: - iio_device_unregister(data->mag_indio_dev); err_iio_unregister_acc: iio_device_unregister(data->acc_indio_dev); err_buffer_cleanup_mag: @@ -1437,13 +1435,13 @@ static int kmx61_remove(struct i2c_client *client) { struct kmx61_data *data = i2c_get_clientdata(client); + iio_device_unregister(data->acc_indio_dev); + iio_device_unregister(data->mag_indio_dev); + pm_runtime_disable(&client->dev); pm_runtime_set_suspended(&client->dev); pm_runtime_put_noidle(&client->dev); - iio_device_unregister(data->acc_indio_dev); - iio_device_unregister(data->mag_indio_dev); - if (client->irq > 0) { iio_triggered_buffer_cleanup(data->acc_indio_dev); iio_triggered_buffer_cleanup(data->mag_indio_dev); diff --git a/drivers/iio/light/rpr0521.c b/drivers/iio/light/rpr0521.c index 4b75bb0998b3..7de0f397194b 100644 --- a/drivers/iio/light/rpr0521.c +++ b/drivers/iio/light/rpr0521.c @@ -507,34 +507,28 @@ static int rpr0521_probe(struct i2c_client *client, dev_err(&client->dev, "rpr0521 chip init failed\n"); return ret; } - ret = iio_device_register(indio_dev); - if (ret < 0) - return ret; ret = pm_runtime_set_active(&client->dev); if (ret < 0) - goto err_iio_unregister; + return ret; pm_runtime_enable(&client->dev); pm_runtime_set_autosuspend_delay(&client->dev, RPR0521_SLEEP_DELAY_MS); pm_runtime_use_autosuspend(&client->dev); - return 0; - -err_iio_unregister: - iio_device_unregister(indio_dev); - return ret; + return iio_device_register(indio_dev); } static int rpr0521_remove(struct i2c_client *client) { struct iio_dev *indio_dev = i2c_get_clientdata(client); + iio_device_unregister(indio_dev); + pm_runtime_disable(&client->dev); pm_runtime_set_suspended(&client->dev); pm_runtime_put_noidle(&client->dev); - iio_device_unregister(indio_dev); rpr0521_poweroff(iio_priv(indio_dev)); return 0; diff --git a/drivers/iio/magnetometer/bmc150_magn.c b/drivers/iio/magnetometer/bmc150_magn.c index 1615b23d7b2a..ffcb75ea64fb 100644 --- a/drivers/iio/magnetometer/bmc150_magn.c +++ b/drivers/iio/magnetometer/bmc150_magn.c @@ -928,27 +928,24 @@ static int bmc150_magn_probe(struct i2c_client *client, goto err_free_irq; } - ret = iio_device_register(indio_dev); - if (ret < 0) { - dev_err(&client->dev, "unable to register iio device\n"); - goto err_buffer_cleanup; - } - ret = pm_runtime_set_active(&client->dev); if (ret) - goto err_iio_unregister; + goto err_buffer_cleanup; pm_runtime_enable(&client->dev); pm_runtime_set_autosuspend_delay(&client->dev, BMC150_MAGN_AUTO_SUSPEND_DELAY_MS); pm_runtime_use_autosuspend(&client->dev); - dev_dbg(&indio_dev->dev, "Registered device %s\n", name); + ret = iio_device_register(indio_dev); + if (ret < 0) { + dev_err(&client->dev, "unable to register iio device\n"); + goto err_buffer_cleanup; + } + dev_dbg(&indio_dev->dev, "Registered device %s\n", name); return 0; -err_iio_unregister: - iio_device_unregister(indio_dev); err_buffer_cleanup: iio_triggered_buffer_cleanup(indio_dev); err_free_irq: @@ -967,11 +964,12 @@ static int bmc150_magn_remove(struct i2c_client *client) struct iio_dev *indio_dev = i2c_get_clientdata(client); struct bmc150_magn_data *data = iio_priv(indio_dev); + iio_device_unregister(indio_dev); + pm_runtime_disable(&client->dev); pm_runtime_set_suspended(&client->dev); pm_runtime_put_noidle(&client->dev); - iio_device_unregister(indio_dev); iio_triggered_buffer_cleanup(indio_dev); if (client->irq > 0) From a106b4748917ba510d083217dbc25e56299f32d4 Mon Sep 17 00:00:00 2001 From: Ioana Ciornei Date: Sun, 1 Nov 2015 14:58:44 +0200 Subject: [PATCH 018/843] iio: gyro: check sscanf return value This patch fixes the checkpatch warnings: WARNING: unchecked sscanf return value Signed-off-by: Ioana Ciornei Acked-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/iio/gyro/adis16136.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iio/gyro/adis16136.c b/drivers/iio/gyro/adis16136.c index 26de876b223d..bb09bff25103 100644 --- a/drivers/iio/gyro/adis16136.c +++ b/drivers/iio/gyro/adis16136.c @@ -435,7 +435,9 @@ static int adis16136_initial_setup(struct iio_dev *indio_dev) if (ret) return ret; - sscanf(indio_dev->name, "adis%u\n", &device_id); + ret = sscanf(indio_dev->name, "adis%u\n", &device_id); + if (ret != 1) + return -EINVAL; if (prod_id != device_id) dev_warn(&indio_dev->dev, "Device ID(%u) and product ID(%u) do not match.", From 72a868b38bdd60cbc4084a91fd7b8df3e2bb96ba Mon Sep 17 00:00:00 2001 From: Ioana Ciornei Date: Sun, 1 Nov 2015 14:58:45 +0200 Subject: [PATCH 019/843] iio: imu: check sscanf return value This patch fixes the following checkpatch warning: WARNING: unchecked sscanf return value Signed-off-by: Ioana Ciornei Acked-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/iio/imu/adis16400_core.c | 6 +++++- drivers/iio/imu/adis16480.c | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c index abc4c50de9e8..72bcc2491d1d 100644 --- a/drivers/iio/imu/adis16400_core.c +++ b/drivers/iio/imu/adis16400_core.c @@ -288,7 +288,11 @@ static int adis16400_initial_setup(struct iio_dev *indio_dev) if (ret) goto err_ret; - sscanf(indio_dev->name, "adis%u\n", &device_id); + ret = sscanf(indio_dev->name, "adis%u\n", &device_id); + if (ret != 1) { + ret = -EINVAL; + goto err_ret; + } if (prod_id != device_id) dev_warn(&indio_dev->dev, "Device ID(%u) and product ID(%u) do not match.", diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c index b94bfd3f595b..16d430461414 100644 --- a/drivers/iio/imu/adis16480.c +++ b/drivers/iio/imu/adis16480.c @@ -765,7 +765,9 @@ static int adis16480_initial_setup(struct iio_dev *indio_dev) if (ret) return ret; - sscanf(indio_dev->name, "adis%u\n", &device_id); + ret = sscanf(indio_dev->name, "adis%u\n", &device_id); + if (ret != 1) + return -EINVAL; if (prod_id != device_id) dev_warn(&indio_dev->dev, "Device ID(%u) and product ID(%u) do not match.", From 34dc578d99449a83dcb0f5ef4444215590183af4 Mon Sep 17 00:00:00 2001 From: Giuseppe Barba Date: Thu, 12 Nov 2015 08:36:49 +0100 Subject: [PATCH 020/843] iio: st-accel: add support for lis2dh12 This commit add support for STMicroelectronics lis2dh12 accelerometer. Datasheet for this device can be found here: http://www.st.com/st-web-ui/static/active/en/resource/technical/ document/datasheet/DM00091513.pdf Signed-off-by: Giuseppe Barba Acked-by: Denis Ciocca Acked-by: Daniel Baluta Signed-off-by: Jonathan Cameron --- Documentation/devicetree/bindings/iio/st-sensors.txt | 1 + drivers/iio/accel/Kconfig | 2 +- drivers/iio/accel/st_accel.h | 1 + drivers/iio/accel/st_accel_core.c | 1 + drivers/iio/accel/st_accel_i2c.c | 5 +++++ drivers/iio/accel/st_accel_spi.c | 1 + 6 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/iio/st-sensors.txt b/Documentation/devicetree/bindings/iio/st-sensors.txt index d3ccdb190c53..d4b87cc1e446 100644 --- a/Documentation/devicetree/bindings/iio/st-sensors.txt +++ b/Documentation/devicetree/bindings/iio/st-sensors.txt @@ -36,6 +36,7 @@ Accelerometers: - st,lsm303dlm-accel - st,lsm330-accel - st,lsm303agr-accel +- st,lis2dh12-accel Gyroscopes: - st,l3g4200d-gyro diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig index 87487d377f9b..edc29b173f6c 100644 --- a/drivers/iio/accel/Kconfig +++ b/drivers/iio/accel/Kconfig @@ -64,7 +64,7 @@ config IIO_ST_ACCEL_3AXIS help Say yes here to build support for STMicroelectronics accelerometers: LSM303DLH, LSM303DLHC, LIS3DH, LSM330D, LSM330DL, LSM330DLC, - LIS331DLH, LSM303DL, LSM303DLM, LSM330. + LIS331DLH, LSM303DL, LSM303DLM, LSM330, LIS2DH12. This driver can also be built as a module. If so, these modules will be created: diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h index 468f21fa2950..5d4a1897b293 100644 --- a/drivers/iio/accel/st_accel.h +++ b/drivers/iio/accel/st_accel.h @@ -27,6 +27,7 @@ #define LSM303DLM_ACCEL_DEV_NAME "lsm303dlm_accel" #define LSM330_ACCEL_DEV_NAME "lsm330_accel" #define LSM303AGR_ACCEL_DEV_NAME "lsm303agr_accel" +#define LIS2DH12_ACCEL_DEV_NAME "lis2dh12_accel" /** * struct st_sensors_platform_data - default accel platform data diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c index dab8b76c1427..9d973f1e74ac 100644 --- a/drivers/iio/accel/st_accel_core.c +++ b/drivers/iio/accel/st_accel_core.c @@ -234,6 +234,7 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = { [3] = LSM330DL_ACCEL_DEV_NAME, [4] = LSM330DLC_ACCEL_DEV_NAME, [5] = LSM303AGR_ACCEL_DEV_NAME, + [6] = LIS2DH12_ACCEL_DEV_NAME, }, .ch = (struct iio_chan_spec *)st_accel_12bit_channels, .odr = { diff --git a/drivers/iio/accel/st_accel_i2c.c b/drivers/iio/accel/st_accel_i2c.c index 8b9cc84fd44f..294a32f89367 100644 --- a/drivers/iio/accel/st_accel_i2c.c +++ b/drivers/iio/accel/st_accel_i2c.c @@ -72,6 +72,10 @@ static const struct of_device_id st_accel_of_match[] = { .compatible = "st,lsm303agr-accel", .data = LSM303AGR_ACCEL_DEV_NAME, }, + { + .compatible = "st,lis2dh12-accel", + .data = LIS2DH12_ACCEL_DEV_NAME, + }, {}, }; MODULE_DEVICE_TABLE(of, st_accel_of_match); @@ -121,6 +125,7 @@ static const struct i2c_device_id st_accel_id_table[] = { { LSM303DLM_ACCEL_DEV_NAME }, { LSM330_ACCEL_DEV_NAME }, { LSM303AGR_ACCEL_DEV_NAME }, + { LIS2DH12_ACCEL_DEV_NAME }, {}, }; MODULE_DEVICE_TABLE(i2c, st_accel_id_table); diff --git a/drivers/iio/accel/st_accel_spi.c b/drivers/iio/accel/st_accel_spi.c index 54b61a3961c3..e82bedfaeb9b 100644 --- a/drivers/iio/accel/st_accel_spi.c +++ b/drivers/iio/accel/st_accel_spi.c @@ -58,6 +58,7 @@ static const struct spi_device_id st_accel_id_table[] = { { LSM303DLM_ACCEL_DEV_NAME }, { LSM330_ACCEL_DEV_NAME }, { LSM303AGR_ACCEL_DEV_NAME }, + { LIS2DH12_ACCEL_DEV_NAME }, {}, }; MODULE_DEVICE_TABLE(spi, st_accel_id_table); From f47dff323088462e7b0ac52d1ba41ce953a5ce20 Mon Sep 17 00:00:00 2001 From: Sean Nyekjaer Date: Mon, 9 Nov 2015 13:55:34 +0100 Subject: [PATCH 021/843] iio: core: added support for IIO_VAL_INT Added core support for IIO_VAL_INT in write_raw_get_fmt function. Signed-off-by: Sean Nyekjaer Signed-off-by: Jonathan Cameron --- drivers/iio/industrialio-core.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 208358f9e7e3..d0a84febd435 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -512,6 +512,12 @@ int iio_str_to_fixpoint(const char *str, int fract_mult, int i = 0, f = 0; bool integer_part = true, negative = false; + if (fract_mult == 0) { + *fract = 0; + + return kstrtoint(str, 0, integer); + } + if (str[0] == '-') { negative = true; str++; @@ -571,6 +577,9 @@ static ssize_t iio_write_channel_info(struct device *dev, if (indio_dev->info->write_raw_get_fmt) switch (indio_dev->info->write_raw_get_fmt(indio_dev, this_attr->c, this_attr->address)) { + case IIO_VAL_INT: + fract_mult = 0; + break; case IIO_VAL_INT_PLUS_MICRO: fract_mult = 100000; break; From 3e87e78383283119a7d41f8a4cab8ef0a5c9acab Mon Sep 17 00:00:00 2001 From: Sean Nyekjaer Date: Mon, 9 Nov 2015 13:52:59 +0100 Subject: [PATCH 022/843] iio: adc: Add TI ADS8688 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds support for the Texas Intruments ADS8688 ADC. Signed-off-by: Sean Nyekjaer Reviewed-by: Martin Hundebøll Signed-off-by: Jonathan Cameron --- drivers/iio/adc/Kconfig | 10 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/ti-ads8688.c | 486 +++++++++++++++++++++++++++++++++++ 3 files changed, 497 insertions(+) create mode 100644 drivers/iio/adc/ti-ads8688.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index daad72e1266d..9162dfefff30 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -341,6 +341,16 @@ config TI_ADC128S052 This driver can also be built as a module. If so, the module will be called ti-adc128s052. +config TI_ADS8688 + tristate "Texas Instruments ADS8688" + depends on SPI && OF + help + If you say yes here you get support for Texas Instruments ADS8684 and + and ADS8688 ADC chips + + This driver can also be built as a module. If so, the module will be + called ti-ads8688. + config TI_AM335X_ADC tristate "TI's AM335X ADC driver" depends on MFD_TI_AM335X_TSCADC diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 11cfdfd76798..91a65bf11c58 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -33,6 +33,7 @@ obj-$(CONFIG_QCOM_SPMI_VADC) += qcom-spmi-vadc.o obj-$(CONFIG_ROCKCHIP_SARADC) += rockchip_saradc.o obj-$(CONFIG_TI_ADC081C) += ti-adc081c.o obj-$(CONFIG_TI_ADC128S052) += ti-adc128s052.o +obj-$(CONFIG_TI_ADS8688) += ti-ads8688.o obj-$(CONFIG_TI_AM335X_ADC) += ti_am335x_adc.o obj-$(CONFIG_TWL4030_MADC) += twl4030-madc.o obj-$(CONFIG_TWL6030_GPADC) += twl6030-gpadc.o diff --git a/drivers/iio/adc/ti-ads8688.c b/drivers/iio/adc/ti-ads8688.c new file mode 100644 index 000000000000..03e907028cb6 --- /dev/null +++ b/drivers/iio/adc/ti-ads8688.c @@ -0,0 +1,486 @@ +/* + * Copyright (C) 2015 Prevas A/S + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define ADS8688_CMD_REG(x) (x << 8) +#define ADS8688_CMD_REG_NOOP 0x00 +#define ADS8688_CMD_REG_RST 0x85 +#define ADS8688_CMD_REG_MAN_CH(chan) (0xC0 | (4 * chan)) +#define ADS8688_CMD_DONT_CARE_BITS 16 + +#define ADS8688_PROG_REG(x) (x << 9) +#define ADS8688_PROG_REG_RANGE_CH(chan) (0x05 + chan) +#define ADS8688_PROG_WR_BIT BIT(8) +#define ADS8688_PROG_DONT_CARE_BITS 8 + +#define ADS8688_REG_PLUSMINUS25VREF 0 +#define ADS8688_REG_PLUSMINUS125VREF 1 +#define ADS8688_REG_PLUSMINUS0625VREF 2 +#define ADS8688_REG_PLUS25VREF 5 +#define ADS8688_REG_PLUS125VREF 6 + +#define ADS8688_VREF_MV 4096 +#define ADS8688_REALBITS 16 + +/* + * enum ads8688_range - ADS8688 reference voltage range + * @ADS8688_PLUSMINUS25VREF: Device is configured for input range ±2.5 * VREF + * @ADS8688_PLUSMINUS125VREF: Device is configured for input range ±1.25 * VREF + * @ADS8688_PLUSMINUS0625VREF: Device is configured for input range ±0.625 * VREF + * @ADS8688_PLUS25VREF: Device is configured for input range 0 - 2.5 * VREF + * @ADS8688_PLUS125VREF: Device is configured for input range 0 - 1.25 * VREF + */ +enum ads8688_range { + ADS8688_PLUSMINUS25VREF, + ADS8688_PLUSMINUS125VREF, + ADS8688_PLUSMINUS0625VREF, + ADS8688_PLUS25VREF, + ADS8688_PLUS125VREF, +}; + +struct ads8688_chip_info { + const struct iio_chan_spec *channels; + unsigned int num_channels; +}; + +struct ads8688_state { + struct mutex lock; + const struct ads8688_chip_info *chip_info; + struct spi_device *spi; + struct regulator *reg; + unsigned int vref_mv; + enum ads8688_range range[8]; + union { + __be32 d32; + u8 d8[4]; + } data[2] ____cacheline_aligned; +}; + +enum ads8688_id { + ID_ADS8684, + ID_ADS8688, +}; + +struct ads8688_ranges { + enum ads8688_range range; + unsigned int scale; + int offset; + u8 reg; +}; + +static const struct ads8688_ranges ads8688_range_def[5] = { + { + .range = ADS8688_PLUSMINUS25VREF, + .scale = 76295, + .offset = -(1 << (ADS8688_REALBITS - 1)), + .reg = ADS8688_REG_PLUSMINUS25VREF, + }, { + .range = ADS8688_PLUSMINUS125VREF, + .scale = 38148, + .offset = -(1 << (ADS8688_REALBITS - 1)), + .reg = ADS8688_REG_PLUSMINUS125VREF, + }, { + .range = ADS8688_PLUSMINUS0625VREF, + .scale = 19074, + .offset = -(1 << (ADS8688_REALBITS - 1)), + .reg = ADS8688_REG_PLUSMINUS0625VREF, + }, { + .range = ADS8688_PLUS25VREF, + .scale = 38148, + .offset = 0, + .reg = ADS8688_REG_PLUS25VREF, + }, { + .range = ADS8688_PLUS125VREF, + .scale = 19074, + .offset = 0, + .reg = ADS8688_REG_PLUS125VREF, + } +}; + +static ssize_t ads8688_show_scales(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct ads8688_state *st = iio_priv(dev_to_iio_dev(dev)); + + return sprintf(buf, "0.%09u 0.%09u 0.%09u\n", + ads8688_range_def[0].scale * st->vref_mv, + ads8688_range_def[1].scale * st->vref_mv, + ads8688_range_def[2].scale * st->vref_mv); +} + +static ssize_t ads8688_show_offsets(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return sprintf(buf, "%d %d\n", ads8688_range_def[0].offset, + ads8688_range_def[3].offset); +} + +static IIO_DEVICE_ATTR(in_voltage_scale_available, S_IRUGO, + ads8688_show_scales, NULL, 0); +static IIO_DEVICE_ATTR(in_voltage_offset_available, S_IRUGO, + ads8688_show_offsets, NULL, 0); + +static struct attribute *ads8688_attributes[] = { + &iio_dev_attr_in_voltage_scale_available.dev_attr.attr, + &iio_dev_attr_in_voltage_offset_available.dev_attr.attr, + NULL, +}; + +static const struct attribute_group ads8688_attribute_group = { + .attrs = ads8688_attributes, +}; + +#define ADS8688_CHAN(index) \ +{ \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .channel = index, \ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) \ + | BIT(IIO_CHAN_INFO_SCALE) \ + | BIT(IIO_CHAN_INFO_OFFSET), \ +} + +static const struct iio_chan_spec ads8684_channels[] = { + ADS8688_CHAN(0), + ADS8688_CHAN(1), + ADS8688_CHAN(2), + ADS8688_CHAN(3), +}; + +static const struct iio_chan_spec ads8688_channels[] = { + ADS8688_CHAN(0), + ADS8688_CHAN(1), + ADS8688_CHAN(2), + ADS8688_CHAN(3), + ADS8688_CHAN(4), + ADS8688_CHAN(5), + ADS8688_CHAN(6), + ADS8688_CHAN(7), +}; + +static int ads8688_prog_write(struct iio_dev *indio_dev, unsigned int addr, + unsigned int val) +{ + struct ads8688_state *st = iio_priv(indio_dev); + u32 tmp; + + tmp = ADS8688_PROG_REG(addr) | ADS8688_PROG_WR_BIT | val; + tmp <<= ADS8688_PROG_DONT_CARE_BITS; + st->data[0].d32 = cpu_to_be32(tmp); + + return spi_write(st->spi, &st->data[0].d8[1], 3); +} + +static int ads8688_reset(struct iio_dev *indio_dev) +{ + struct ads8688_state *st = iio_priv(indio_dev); + u32 tmp; + + tmp = ADS8688_CMD_REG(ADS8688_CMD_REG_RST); + tmp <<= ADS8688_CMD_DONT_CARE_BITS; + st->data[0].d32 = cpu_to_be32(tmp); + + return spi_write(st->spi, &st->data[0].d8[0], 4); +} + +static int ads8688_read(struct iio_dev *indio_dev, unsigned int chan) +{ + struct ads8688_state *st = iio_priv(indio_dev); + int ret; + u32 tmp; + struct spi_transfer t[] = { + { + .tx_buf = &st->data[0].d8[0], + .len = 4, + .cs_change = 1, + }, { + .tx_buf = &st->data[1].d8[0], + .rx_buf = &st->data[1].d8[0], + .len = 4, + }, + }; + + tmp = ADS8688_CMD_REG(ADS8688_CMD_REG_MAN_CH(chan)); + tmp <<= ADS8688_CMD_DONT_CARE_BITS; + st->data[0].d32 = cpu_to_be32(tmp); + + tmp = ADS8688_CMD_REG(ADS8688_CMD_REG_NOOP); + tmp <<= ADS8688_CMD_DONT_CARE_BITS; + st->data[1].d32 = cpu_to_be32(tmp); + + ret = spi_sync_transfer(st->spi, t, ARRAY_SIZE(t)); + if (ret < 0) + return ret; + + return be32_to_cpu(st->data[1].d32) & 0xffff; +} + +static int ads8688_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, int *val2, long m) +{ + int ret, offset; + unsigned long scale_mv; + + struct ads8688_state *st = iio_priv(indio_dev); + + mutex_lock(&st->lock); + switch (m) { + case IIO_CHAN_INFO_RAW: + ret = ads8688_read(indio_dev, chan->channel); + mutex_unlock(&st->lock); + if (ret < 0) + return ret; + *val = ret; + return IIO_VAL_INT; + case IIO_CHAN_INFO_SCALE: + scale_mv = st->vref_mv; + scale_mv *= ads8688_range_def[st->range[chan->channel]].scale; + *val = 0; + *val2 = scale_mv; + mutex_unlock(&st->lock); + return IIO_VAL_INT_PLUS_NANO; + case IIO_CHAN_INFO_OFFSET: + offset = ads8688_range_def[st->range[chan->channel]].offset; + *val = offset; + mutex_unlock(&st->lock); + return IIO_VAL_INT; + } + mutex_unlock(&st->lock); + + return -EINVAL; +} + +static int ads8688_write_reg_range(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + enum ads8688_range range) +{ + unsigned int tmp; + int ret; + + tmp = ADS8688_PROG_REG_RANGE_CH(chan->channel); + ret = ads8688_prog_write(indio_dev, tmp, range); + + return ret; +} + +static int ads8688_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int val, int val2, long mask) +{ + struct ads8688_state *st = iio_priv(indio_dev); + unsigned int scale = 0; + int ret = -EINVAL, i, offset = 0; + + mutex_lock(&st->lock); + switch (mask) { + case IIO_CHAN_INFO_SCALE: + /* If the offset is 0 the ±2.5 * VREF mode is not available */ + offset = ads8688_range_def[st->range[chan->channel]].offset; + if (offset == 0 && val2 == ads8688_range_def[0].scale * st->vref_mv) { + mutex_unlock(&st->lock); + return -EINVAL; + } + + /* Lookup new mode */ + for (i = 0; i < ARRAY_SIZE(ads8688_range_def); i++) + if (val2 == ads8688_range_def[i].scale * st->vref_mv && + offset == ads8688_range_def[i].offset) { + ret = ads8688_write_reg_range(indio_dev, chan, + ads8688_range_def[i].reg); + break; + } + break; + case IIO_CHAN_INFO_OFFSET: + /* + * There are only two available offsets: + * 0 and -(1 << (ADS8688_REALBITS - 1)) + */ + if (!(ads8688_range_def[0].offset == val || + ads8688_range_def[3].offset == val)) { + mutex_unlock(&st->lock); + return -EINVAL; + } + + /* + * If the device are in ±2.5 * VREF mode, it's not allowed to + * switch to a mode where the offset is 0 + */ + if (val == 0 && + st->range[chan->channel] == ADS8688_PLUSMINUS25VREF) { + mutex_unlock(&st->lock); + return -EINVAL; + } + + scale = ads8688_range_def[st->range[chan->channel]].scale; + + /* Lookup new mode */ + for (i = 0; i < ARRAY_SIZE(ads8688_range_def); i++) + if (val == ads8688_range_def[i].offset && + scale == ads8688_range_def[i].scale) { + ret = ads8688_write_reg_range(indio_dev, chan, + ads8688_range_def[i].reg); + break; + } + break; + } + + if (!ret) + st->range[chan->channel] = ads8688_range_def[i].range; + + mutex_unlock(&st->lock); + + return ret; +} + +static int ads8688_write_raw_get_fmt(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + long mask) +{ + switch (mask) { + case IIO_CHAN_INFO_SCALE: + return IIO_VAL_INT_PLUS_NANO; + case IIO_CHAN_INFO_OFFSET: + return IIO_VAL_INT; + } + + return -EINVAL; +} + +static const struct iio_info ads8688_info = { + .read_raw = &ads8688_read_raw, + .write_raw = &ads8688_write_raw, + .write_raw_get_fmt = &ads8688_write_raw_get_fmt, + .attrs = &ads8688_attribute_group, + .driver_module = THIS_MODULE, +}; + +static const struct ads8688_chip_info ads8688_chip_info_tbl[] = { + [ID_ADS8684] = { + .channels = ads8684_channels, + .num_channels = ARRAY_SIZE(ads8684_channels), + }, + [ID_ADS8688] = { + .channels = ads8688_channels, + .num_channels = ARRAY_SIZE(ads8688_channels), + }, +}; + +static int ads8688_probe(struct spi_device *spi) +{ + struct ads8688_state *st; + struct iio_dev *indio_dev; + int ret; + + indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); + if (indio_dev == NULL) + return -ENOMEM; + + st = iio_priv(indio_dev); + + st->reg = devm_regulator_get_optional(&spi->dev, "vref"); + if (!IS_ERR(st->reg)) { + ret = regulator_enable(st->reg); + if (ret) + return ret; + + ret = regulator_get_voltage(st->reg); + if (ret < 0) + goto error_out; + + st->vref_mv = ret / 1000; + } else { + /* Use internal reference */ + st->vref_mv = ADS8688_VREF_MV; + } + + st->chip_info = &ads8688_chip_info_tbl[spi_get_device_id(spi)->driver_data]; + + spi->mode = SPI_MODE_1; + + spi_set_drvdata(spi, indio_dev); + + st->spi = spi; + + indio_dev->name = spi_get_device_id(spi)->name; + indio_dev->dev.parent = &spi->dev; + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->channels = st->chip_info->channels; + indio_dev->num_channels = st->chip_info->num_channels; + indio_dev->info = &ads8688_info; + + ads8688_reset(indio_dev); + + mutex_init(&st->lock); + + ret = iio_device_register(indio_dev); + if (ret) + goto error_out; + + return 0; + +error_out: + if (!IS_ERR_OR_NULL(st->reg)) + regulator_disable(st->reg); + + return ret; +} + +static int ads8688_remove(struct spi_device *spi) +{ + struct iio_dev *indio_dev = spi_get_drvdata(spi); + struct ads8688_state *st = iio_priv(indio_dev); + + iio_device_unregister(indio_dev); + + if (!IS_ERR_OR_NULL(st->reg)) + regulator_disable(st->reg); + + return 0; +} + +static const struct spi_device_id ads8688_id[] = { + {"ads8684", ID_ADS8684}, + {"ads8688", ID_ADS8688}, + {} +}; +MODULE_DEVICE_TABLE(spi, ads8688_id); + +static const struct of_device_id ads8688_of_match[] = { + { .compatible = "ti,ads8684" }, + { .compatible = "ti,ads8688" }, + { } +}; +MODULE_DEVICE_TABLE(of, ads8688_of_match); + +static struct spi_driver ads8688_driver = { + .driver = { + .name = "ads8688", + .owner = THIS_MODULE, + }, + .probe = ads8688_probe, + .remove = ads8688_remove, + .id_table = ads8688_id, +}; +module_spi_driver(ads8688_driver); + +MODULE_AUTHOR("Sean Nyekjaer "); +MODULE_DESCRIPTION("Texas Instruments ADS8688 driver"); +MODULE_LICENSE("GPL v2"); From a1513641892b220bc5b7ce63e44b81658702cdae Mon Sep 17 00:00:00 2001 From: Sean Nyekjaer Date: Mon, 9 Nov 2015 13:53:00 +0100 Subject: [PATCH 023/843] iio: ti-ads8688: Add DT binding documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding binding documentation for Texas Instruments ADS8688 ADC. Signed-off-by: Sean Nyekjaer Reviewed-by: Martin Hundebøll Acked-by: Rob Herring Signed-off-by: Jonathan Cameron --- .../bindings/iio/adc/ti-ads8688.txt | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/ti-ads8688.txt diff --git a/Documentation/devicetree/bindings/iio/adc/ti-ads8688.txt b/Documentation/devicetree/bindings/iio/adc/ti-ads8688.txt new file mode 100644 index 000000000000..a02337d7efa4 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/ti-ads8688.txt @@ -0,0 +1,20 @@ +* Texas Instruments' ADS8684 and ADS8688 ADC chip + +Required properties: + - compatible: Should be "ti,ads8684" or "ti,ads8688" + - reg: spi chip select number for the device + +Recommended properties: + - spi-max-frequency: Definition as per + Documentation/devicetree/bindings/spi/spi-bus.txt + +Optional properties: + - vref-supply: The regulator supply for ADC reference voltage + +Example: +adc@0 { + compatible = "ti,ads8688"; + reg = <0>; + vref-supply = <&vdd_supply>; + spi-max-frequency = <1000000>; +}; From e0c961bdaf2786bc9795efff6e87a15491778384 Mon Sep 17 00:00:00 2001 From: Nizam Haider Date: Mon, 9 Nov 2015 19:56:02 +0530 Subject: [PATCH 024/843] iio: adc: mxs-lradc: Prefer using the BIT macro Replaces bit shifting on 1 with the BIT(x) macro Signed-off-by: Nizam Haider Signed-off-by: Jonathan Cameron --- drivers/staging/iio/adc/mxs-lradc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index 407d4a2c8eda..1f25027b7b61 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -324,7 +324,7 @@ struct mxs_lradc { #define LRADC_DELAY_TRIGGER(x) \ (((x) << LRADC_DELAY_TRIGGER_LRADCS_OFFSET) & \ LRADC_DELAY_TRIGGER_LRADCS_MASK) -#define LRADC_DELAY_KICK (1 << 20) +#define LRADC_DELAY_KICK BIT(20) #define LRADC_DELAY_TRIGGER_DELAYS_MASK (0xf << 16) #define LRADC_DELAY_TRIGGER_DELAYS_OFFSET 16 #define LRADC_DELAY_TRIGGER_DELAYS(x) \ From 7d173f26353df0e90ea1223b80f6834845f27435 Mon Sep 17 00:00:00 2001 From: Nizam Haider Date: Mon, 9 Nov 2015 18:20:45 +0530 Subject: [PATCH 025/843] iio: adc: ad7793: removed unnecessary else. Else is not generally useful after a break or return. Signed-off-by: Nizam Haider Signed-off-by: Jonathan Cameron --- drivers/iio/adc/ad7793.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/ad7793.c b/drivers/iio/adc/ad7793.c index b84922a4b32e..d3eeb3fb46c2 100644 --- a/drivers/iio/adc/ad7793.c +++ b/drivers/iio/adc/ad7793.c @@ -478,10 +478,9 @@ static int ad7793_read_raw(struct iio_dev *indio_dev, *val2 = st-> scale_avail[(st->conf >> 8) & 0x7][1]; return IIO_VAL_INT_PLUS_NANO; - } else { - /* 1170mV / 2^23 * 6 */ - scale_uv = (1170ULL * 1000000000ULL * 6ULL); } + /* 1170mV / 2^23 * 6 */ + scale_uv = (1170ULL * 1000000000ULL * 6ULL); break; case IIO_TEMP: /* 1170mV / 0.81 mV/C / 2^23 */ From 90e6228a995816750f96c70d94298e12c08511f4 Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Thu, 29 Oct 2015 21:58:16 -0700 Subject: [PATCH 026/843] Staging: comedi: das16: Fix sparse endian warning Fix following sparse warning: warning: cast to restricted __le16 This change is safe because array is pointer of type void and can be used to store any type of data, also offset of the array would be the same since unsigned short and __le16 are both 16 bits in size. Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/das16.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c index 056bca9c67d5..fd8e0b76f764 100644 --- a/drivers/staging/comedi/drivers/das16.c +++ b/drivers/staging/comedi/drivers/das16.c @@ -801,9 +801,10 @@ static void das16_ai_munge(struct comedi_device *dev, unsigned short *data = array; unsigned int num_samples = comedi_bytes_to_samples(s, num_bytes); unsigned int i; + __le16 *buf = array; for (i = 0; i < num_samples; i++) { - data[i] = le16_to_cpu(data[i]); + data[i] = le16_to_cpu(buf[i]); if (s->maxdata == 0x0fff) data[i] >>= 4; data[i] &= s->maxdata; From 212efdb1be77ae97e21afc35310f7f9c428f875c Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Sat, 31 Oct 2015 06:34:29 -0700 Subject: [PATCH 027/843] Staging: comedi: ni_mio_common: Fix endian sparse warning Fix following sparse warnings: warning: cast to restricted __le32 warning: cast to restricted __le16 warning: incorrect type in assignment (different base types) expected unsigned short [unsigned] [assigned] val got restricted __le16 [usertype] Data is pointer of type void and can be used to store any type of data. In function ni_ai_munge: barray and array have the same 16 bit offset. blarray and larray have the same 32 bit offset. Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_mio_common.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 6cc304a4c59b..cbb44fc6940b 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -1516,13 +1516,17 @@ static void ni_ai_munge(struct comedi_device *dev, struct comedi_subdevice *s, unsigned short *array = data; unsigned int *larray = data; unsigned int i; +#ifdef PCIDMA + __le16 *barray = data; + __le32 *blarray = data; +#endif for (i = 0; i < nsamples; i++) { #ifdef PCIDMA if (s->subdev_flags & SDF_LSAMPL) - larray[i] = le32_to_cpu(larray[i]); + larray[i] = le32_to_cpu(blarray[i]); else - array[i] = le16_to_cpu(array[i]); + array[i] = le16_to_cpu(barray[i]); #endif if (s->subdev_flags & SDF_LSAMPL) larray[i] += devpriv->ai_offset[chan_index]; @@ -2574,6 +2578,9 @@ static void ni_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int nsamples = comedi_bytes_to_samples(s, num_bytes); unsigned short *array = data; unsigned int i; +#ifdef PCIDMA + __le16 buf, *barray = data; +#endif for (i = 0; i < nsamples; i++) { unsigned int range = CR_RANGE(cmd->chanlist[chan_index]); @@ -2586,10 +2593,11 @@ static void ni_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s, if (comedi_range_is_bipolar(s, range)) val = comedi_offset_munge(s, val); #ifdef PCIDMA - val = cpu_to_le16(val); -#endif + buf = cpu_to_le16(val); + barray[i] = buf; +#else array[i] = val; - +#endif chan_index++; chan_index %= cmd->chanlist_len; } From 2aadecb60a33c791bfb729d65c158a22f636961a Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Sat, 31 Oct 2015 06:36:44 -0700 Subject: [PATCH 028/843] Staging: comedi: adl_pci9118: Fix endian sparse warning Fix following sparse warning: warning: cast to restricted __be16 data is pointer of type void and can be used to store any type of data. barray and array have the same 16 bit offset. Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 0dff1dbb53fb..4437ea3abe8d 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -603,10 +603,11 @@ static void pci9118_ai_munge(struct comedi_device *dev, unsigned short *array = data; unsigned int num_samples = comedi_bytes_to_samples(s, num_bytes); unsigned int i; + __be16 *barray = data; for (i = 0; i < num_samples; i++) { if (devpriv->usedma) - array[i] = be16_to_cpu(array[i]); + array[i] = be16_to_cpu(barray[i]); if (s->maxdata == 0xffff) array[i] ^= 0x8000; else From b2cb0686041c91b0bfdd580e1b54eec06af3280d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 30 Oct 2015 11:10:05 -0700 Subject: [PATCH 029/843] staging: comedi: adv_pci1710: separate out PCI-1720 support as a new driver The PCI-1710 series boards are multifunction data acquisition boards with analog inputs and outputs, digital inputs and outputs, and counter/timer functions. The PCI-1720 is a simple 4 channel analog output board. It also uses a unique register map. Separate out the PCI-1720 support as a new driver, adv_pci1720, to ease maintainability. Fix some issues with the PCI-1720 support in the new driver: 1) the registers are all 8-bit 2) remove the analog output "reset" when the driver attaches/detaches 3) disable "synchronized output" to simplify the analog outputs 4) remove the need for the private data 5) add support for the BoardID register to allow multiple cards Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 12 +- drivers/staging/comedi/drivers/Makefile | 1 + drivers/staging/comedi/drivers/adv_pci1710.c | 109 +---------- drivers/staging/comedi/drivers/adv_pci1720.c | 195 +++++++++++++++++++ 4 files changed, 212 insertions(+), 105 deletions(-) create mode 100644 drivers/staging/comedi/drivers/adv_pci1720.c diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index ac0f01007abd..945c85a10793 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -737,15 +737,23 @@ config COMEDI_ADL_PCI9118 called adl_pci9118. config COMEDI_ADV_PCI1710 - tristate "Advantech PCI-171x, PCI-1720 and PCI-1731 support" + tristate "Advantech PCI-171x and PCI-1731 support" select COMEDI_8254 ---help--- Enable support for Advantech PCI-1710, PCI-1710HG, PCI-1711, - PCI-1713, PCI-1720 and PCI-1731 + PCI-1713 and PCI-1731 To compile this driver as a module, choose M here: the module will be called adv_pci1710. +config COMEDI_ADV_PCI1720 + tristate "Advantech PCI-1720 support" + ---help--- + Enable support for Advantech PCI-1720 Analog Output board. + + To compile this driver as a module, choose M here: the module will be + called adv_pci1720. + config COMEDI_ADV_PCI1723 tristate "Advantech PCI-1723 support" ---help--- diff --git a/drivers/staging/comedi/drivers/Makefile b/drivers/staging/comedi/drivers/Makefile index c3b8f2d7611b..94c179bea71e 100644 --- a/drivers/staging/comedi/drivers/Makefile +++ b/drivers/staging/comedi/drivers/Makefile @@ -78,6 +78,7 @@ obj-$(CONFIG_COMEDI_ADL_PCI8164) += adl_pci8164.o obj-$(CONFIG_COMEDI_ADL_PCI9111) += adl_pci9111.o obj-$(CONFIG_COMEDI_ADL_PCI9118) += adl_pci9118.o obj-$(CONFIG_COMEDI_ADV_PCI1710) += adv_pci1710.o +obj-$(CONFIG_COMEDI_ADV_PCI1720) += adv_pci1720.o obj-$(CONFIG_COMEDI_ADV_PCI1723) += adv_pci1723.o obj-$(CONFIG_COMEDI_ADV_PCI1724) += adv_pci1724.o obj-$(CONFIG_COMEDI_ADV_PCI_DIO) += adv_pci_dio.o diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 399c511cfe0a..45d7f42312ec 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -11,8 +11,9 @@ * Driver: adv_pci1710 * Description: Comedi driver for Advantech PCI-1710 series boards * Devices: [Advantech] PCI-1710 (adv_pci1710), PCI-1710HG, PCI-1711, - * PCI-1713, PCI-1720, PCI-1731 + * PCI-1713, PCI-1731 * Author: Michal Dobes + * Updated: Fri, 29 Oct 2015 17:19:35 -0700 * Status: works * * Configuration options: not applicable, uses PCI auto config @@ -62,16 +63,6 @@ #define PCI171X_DO_REG 0x10 /* W: digital outputs */ #define PCI171X_TIMER_BASE 0x18 /* R/W: 8254 timer */ -/* - * PCI-1720 only has analog outputs and has a different - * register map (dev->iobase) - */ -#define PCI1720_DA_REG(x) (0x00 + ((x) * 2)) /* W: D/A registers */ -#define PCI1720_RANGE_REG 0x08 /* R/W: D/A range register */ -#define PCI1720_SYNC_REG 0x09 /* W: D/A synchronized output */ -#define PCI1720_SYNC_CTRL_REG 0x0f /* R/W: D/A synchronized control */ -#define PCI1720_SYNC_CTRL_SC0 BIT(0) /* set synchronous output mode */ - static const struct comedi_lrange range_pci1710_3 = { 9, { BIP_RANGE(5), @@ -122,15 +113,6 @@ static const struct comedi_lrange range_pci17x1 = { static const char range_codes_pci17x1[] = { 0x00, 0x01, 0x02, 0x03, 0x04 }; -static const struct comedi_lrange pci1720_ao_range = { - 4, { - UNI_RANGE(5), - UNI_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(10) - } -}; - static const struct comedi_lrange pci171x_ao_range = { 2, { UNI_RANGE(5), @@ -143,7 +125,6 @@ enum pci1710_boardid { BOARD_PCI1710HG, BOARD_PCI1711, BOARD_PCI1713, - BOARD_PCI1720, BOARD_PCI1731, }; @@ -153,7 +134,6 @@ struct boardtype { const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ const char *rangecode_ai; /* range codes for programming */ unsigned int is_pci1713:1; - unsigned int is_pci1720:1; unsigned int has_irq:1; unsigned int has_large_fifo:1; /* 4K or 1K FIFO */ unsigned int has_diff_ai:1; @@ -207,11 +187,6 @@ static const struct boardtype boardtypes[] = { .has_large_fifo = 1, .has_diff_ai = 1, }, - [BOARD_PCI1720] = { - .name = "pci1720", - .is_pci1720 = 1, - .has_ao = 1, - }, [BOARD_PCI1731] = { .name = "pci1731", .n_aichan = 16, @@ -465,36 +440,6 @@ static int pci171x_do_insn_bits(struct comedi_device *dev, return insn->n; } -static int pci1720_ao_insn_write(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) -{ - struct pci1710_private *devpriv = dev->private; - unsigned int chan = CR_CHAN(insn->chanspec); - unsigned int range = CR_RANGE(insn->chanspec); - unsigned int val; - int i; - - val = devpriv->da_ranges & (~(0x03 << (chan << 1))); - val |= (range << (chan << 1)); - if (val != devpriv->da_ranges) { - outb(val, dev->iobase + PCI1720_RANGE_REG); - devpriv->da_ranges = val; - } - - val = s->readback[chan]; - for (i = 0; i < insn->n; i++) { - val = data[i]; - outw(val, dev->iobase + PCI1720_DA_REG(chan)); - outb(0, dev->iobase + PCI1720_SYNC_REG); /* update outputs */ - } - - s->readback[chan] = val; - - return insn->n; -} - static int pci171x_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { @@ -790,7 +735,7 @@ static int pci171x_insn_counter_config(struct comedi_device *dev, return insn->n; } -static int pci171x_reset(struct comedi_device *dev) +static int pci1710_reset(struct comedi_device *dev) { const struct boardtype *board = dev->board_ptr; struct pci1710_private *devpriv = dev->private; @@ -815,33 +760,6 @@ static int pci171x_reset(struct comedi_device *dev) return 0; } -static int pci1720_reset(struct comedi_device *dev) -{ - struct pci1710_private *devpriv = dev->private; - /* set synchronous output mode */ - outb(PCI1720_SYNC_CTRL_SC0, dev->iobase + PCI1720_SYNC_CTRL_REG); - devpriv->da_ranges = 0xAA; - /* set all ranges to +/-5V and outputs to 0V */ - outb(devpriv->da_ranges, dev->iobase + PCI1720_RANGE_REG); - outw(0x0800, dev->iobase + PCI1720_DA_REG(0)); - outw(0x0800, dev->iobase + PCI1720_DA_REG(1)); - outw(0x0800, dev->iobase + PCI1720_DA_REG(2)); - outw(0x0800, dev->iobase + PCI1720_DA_REG(3)); - outb(0, dev->iobase + PCI1720_SYNC_REG); /* update outputs */ - - return 0; -} - -static int pci1710_reset(struct comedi_device *dev) -{ - const struct boardtype *board = dev->board_ptr; - - if (board->is_pci1720) - return pci1720_reset(dev); - - return pci171x_reset(dev); -} - static int pci1710_auto_attach(struct comedi_device *dev, unsigned long context) { @@ -922,29 +840,15 @@ static int pci1710_auto_attach(struct comedi_device *dev, s = &dev->subdevices[subdev]; s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; + s->n_chan = 2; s->maxdata = 0x0fff; - if (board->is_pci1720) { - s->n_chan = 4; - s->range_table = &pci1720_ao_range; - s->insn_write = pci1720_ao_insn_write; - } else { - s->n_chan = 2; - s->range_table = &pci171x_ao_range; - s->insn_write = pci171x_ao_insn_write; - } + s->range_table = &pci171x_ao_range; + s->insn_write = pci171x_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) return ret; - /* initialize the readback values to match the board reset */ - if (board->is_pci1720) { - int i; - - for (i = 0; i < s->n_chan; i++) - s->readback[i] = 0x0800; - } - subdev++; } @@ -1063,7 +967,6 @@ static const struct pci_device_id adv_pci1710_pci_table[] = { }, { PCI_VDEVICE(ADVANTECH, 0x1711), BOARD_PCI1711 }, { PCI_VDEVICE(ADVANTECH, 0x1713), BOARD_PCI1713 }, - { PCI_VDEVICE(ADVANTECH, 0x1720), BOARD_PCI1720 }, { PCI_VDEVICE(ADVANTECH, 0x1731), BOARD_PCI1731 }, { 0 } }; diff --git a/drivers/staging/comedi/drivers/adv_pci1720.c b/drivers/staging/comedi/drivers/adv_pci1720.c new file mode 100644 index 000000000000..4830a1c93d15 --- /dev/null +++ b/drivers/staging/comedi/drivers/adv_pci1720.c @@ -0,0 +1,195 @@ +/* + * COMEDI driver for Advantech PCI-1720U + * Copyright (c) 2015 H Hartley Sweeten + * + * Separated from the adv_pci1710 driver written by: + * Michal Dobes + * + * COMEDI - Linux Control and Measurement Device Interface + * Copyright (C) 2000 David A. Schleef + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/* + * Driver: adv_pci1720 + * Description: 4-channel Isolated D/A Output board + * Devices: [Advantech] PCI-7120U (adv_pci1720) + * Author: H Hartley Sweeten + * Updated: Fri, 29 Oct 2015 17:19:35 -0700 + * Status: untested + * + * Configuration options: not applicable, uses PCI auto config + * + * The PCI-1720 has 4 isolated 12-bit analog output channels with multiple + * output ranges. It also has a BoardID switch to allow differentiating + * multiple boards in the system. + * + * The analog outputs can operate in two modes, immediate and synchronized. + * This driver currently does not support the synchronized output mode. + * + * Jumpers JP1 to JP4 are used to set the current sink ranges for each + * analog output channel. In order to use the current sink ranges, the + * unipolar 5V range must be used. The voltage output and sink output for + * each channel is available on the connector as separate pins. + * + * Jumper JP5 controls the "hot" reset state of the analog outputs. + * Depending on its setting, the analog outputs will either keep the + * last settings and output values or reset to the default state after + * a "hot" reset. The default state for all channels is uniploar 5V range + * and all the output values are 0V. To allow this feature to work, the + * analog outputs are not "reset" when the driver attaches. + */ + +#include +#include + +#include "../comedi_pci.h" + +/* + * PCI BAR2 Register map (dev->iobase) + */ +#define PCI1720_AO_LSB_REG(x) (0x00 + ((x) * 2)) +#define PCI1720_AO_MSB_REG(x) (0x01 + ((x) * 2)) +#define PCI1720_AO_RANGE_REG 0x08 +#define PCI1720_AO_RANGE(c, r) (((r) & 0x3) << ((c) * 2)) +#define PCI1720_AO_RANGE_MASK(c) PCI1720_AO_RANGE((c), 0x3) +#define PCI1720_SYNC_REG 0x09 +#define PCI1720_SYNC_CTRL_REG 0x0f +#define PCI1720_SYNC_CTRL_SC0 BIT(0) +#define PCI1720_BOARDID_REG 0x14 + +static const struct comedi_lrange pci1720_ao_range = { + 4, { + UNI_RANGE(5), + UNI_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(10) + } +}; + +static int pci1720_ao_insn_write(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + unsigned int chan = CR_CHAN(insn->chanspec); + unsigned int range = CR_RANGE(insn->chanspec); + unsigned int val; + int i; + + /* set the channel range and polarity */ + val = inb(dev->iobase + PCI1720_AO_RANGE_REG); + val &= ~PCI1720_AO_RANGE_MASK(chan); + val |= PCI1720_AO_RANGE(chan, range); + outb(val, dev->iobase + PCI1720_AO_RANGE_REG); + + val = s->readback[chan]; + for (i = 0; i < insn->n; i++) { + val = data[i]; + + outb(val & 0xff, dev->iobase + PCI1720_AO_LSB_REG(chan)); + outb((val >> 8) & 0xff, dev->iobase + PCI1720_AO_MSB_REG(chan)); + + /* conversion time is 2us (500 kHz throughput) */ + usleep_range(2, 100); + } + + s->readback[chan] = val; + + return insn->n; +} + +static int pci1720_di_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + data[1] = inb(dev->iobase + PCI1720_BOARDID_REG); + + return insn->n; +} + +static int pci1720_auto_attach(struct comedi_device *dev, + unsigned long context) +{ + struct pci_dev *pcidev = comedi_to_pci_dev(dev); + struct comedi_subdevice *s; + int ret; + + ret = comedi_pci_enable(dev); + if (ret) + return ret; + dev->iobase = pci_resource_start(pcidev, 2); + + ret = comedi_alloc_subdevices(dev, 2); + if (ret) + return ret; + + /* Analog Output subdevice */ + s = &dev->subdevices[0]; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 0x0fff; + s->range_table = &pci1720_ao_range; + s->insn_write = pci1720_ao_insn_write; + + ret = comedi_alloc_subdev_readback(s); + if (ret) + return ret; + + /* Digital Input subdevice (BoardID SW1) */ + s = &dev->subdevices[1]; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pci1720_di_insn_bits; + + /* disable synchronized output, channels update when written */ + outb(0, dev->iobase + PCI1720_SYNC_CTRL_REG); + + return 0; +} + +static struct comedi_driver adv_pci1720_driver = { + .driver_name = "adv_pci1720", + .module = THIS_MODULE, + .auto_attach = pci1720_auto_attach, + .detach = comedi_pci_detach, +}; + +static int adv_pci1720_pci_probe(struct pci_dev *dev, + const struct pci_device_id *id) +{ + return comedi_pci_auto_config(dev, &adv_pci1720_driver, + id->driver_data); +} + +static const struct pci_device_id adv_pci1720_pci_table[] = { + { PCI_DEVICE(PCI_VENDOR_ID_ADVANTECH, 0x1720) }, + { 0 } +}; +MODULE_DEVICE_TABLE(pci, adv_pci1720_pci_table); + +static struct pci_driver adv_pci1720_pci_driver = { + .name = "adv_pci1720", + .id_table = adv_pci1720_pci_table, + .probe = adv_pci1720_pci_probe, + .remove = comedi_pci_auto_unconfig, +}; +module_comedi_pci_driver(adv_pci1720_driver, adv_pci1720_pci_driver); + +MODULE_AUTHOR("H Hartley Sweeten "); +MODULE_DESCRIPTION("Comedi driver for Advantech PCI-1720 Analog Output board"); +MODULE_LICENSE("GPL"); From e5b6b5d48fa26dd5bb1ec8d6829d318ef4c8585b Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Wed, 28 Oct 2015 17:30:43 -0700 Subject: [PATCH 030/843] Staging: lustre: Replace LPROCFS_CLIMP_EXIT with up_read In all call sites type of argument that macro LPROCFS_CLIMP_EXIT use is the same, so replace it with up_read function. Also remove the macro since it's no longer used. Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/include/lprocfs_status.h | 3 --- drivers/staging/lustre/lustre/mgc/mgc_request.c | 2 +- .../staging/lustre/lustre/obdclass/lprocfs_status.c | 12 ++++++------ drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 6 +++--- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h index 9e654b218ca3..f18c0c75ef1e 100644 --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h @@ -624,9 +624,6 @@ void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx, int lprocfs_single_release(struct inode *, struct file *); int lprocfs_seq_release(struct inode *, struct file *); -#define LPROCFS_CLIMP_EXIT(obd) \ - up_read(&(obd)->u.cli.cl_sem) - /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only proc entries; otherwise, you will define name##_seq_write function also for a read-write proc entry, and then call LPROC_SEQ_SEQ instead. Finally, diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index 5f53f3b7ceff..2d6de6c19b9f 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -463,7 +463,7 @@ int lprocfs_mgc_rd_ir_state(struct seq_file *m, void *data) } spin_unlock(&config_list_lock); - LPROCFS_CLIMP_EXIT(obd); + up_read(&obd->u.cli.cl_sem); return 0; } diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index 333ac7d269b7..2de3c1b6fa49 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -502,7 +502,7 @@ int lprocfs_rd_server_uuid(struct seq_file *m, void *data) obd2cli_tgt(obd), imp_state_name, imp->imp_deactive ? "\tDEACTIVATED" : ""); - LPROCFS_CLIMP_EXIT(obd); + up_read(&obd->u.cli.cl_sem); return 0; } @@ -526,7 +526,7 @@ int lprocfs_rd_conn_uuid(struct seq_file *m, void *data) else seq_puts(m, "\n"); - LPROCFS_CLIMP_EXIT(obd); + up_read(&obd->u.cli.cl_sem); return 0; } @@ -765,7 +765,7 @@ int lprocfs_rd_import(struct seq_file *m, void *data) } out_climp: - LPROCFS_CLIMP_EXIT(obd); + up_read(&obd->u.cli.cl_sem); return 0; } EXPORT_SYMBOL(lprocfs_rd_import); @@ -796,7 +796,7 @@ int lprocfs_rd_state(struct seq_file *m, void *data) ptlrpc_import_state_name(ish->ish_state)); } - LPROCFS_CLIMP_EXIT(obd); + up_read(&obd->u.cli.cl_sem); return 0; } EXPORT_SYMBOL(lprocfs_rd_state); @@ -857,7 +857,7 @@ int lprocfs_rd_timeouts(struct seq_file *m, void *data) lprocfs_at_hist_helper(m, &imp->imp_at.iat_service_estimate[i]); } - LPROCFS_CLIMP_EXIT(obd); + up_read(&obd->u.cli.cl_sem); return 0; } EXPORT_SYMBOL(lprocfs_rd_timeouts); @@ -876,7 +876,7 @@ int lprocfs_rd_connect_flags(struct seq_file *m, void *data) seq_printf(m, "flags=%#llx\n", flags); obd_connect_seq_flags2str(m, flags, "\n"); seq_printf(m, "\n"); - LPROCFS_CLIMP_EXIT(obd); + up_read(&obd->u.cli.cl_sem); return 0; } EXPORT_SYMBOL(lprocfs_rd_connect_flags); diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c index afab0dee7a5c..2aecab21e3e1 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c @@ -1197,7 +1197,7 @@ int lprocfs_wr_ping(struct file *file, const char __user *buffer, return rc; req = ptlrpc_prep_ping(obd->u.cli.cl_import); - LPROCFS_CLIMP_EXIT(obd); + up_read(&obd->u.cli.cl_sem); if (req == NULL) return -ENOMEM; @@ -1291,7 +1291,7 @@ int lprocfs_rd_pinger_recov(struct seq_file *m, void *n) return rc; seq_printf(m, "%d\n", !imp->imp_no_pinger_recover); - LPROCFS_CLIMP_EXIT(obd); + up_read(&obd->u.cli.cl_sem); return 0; } @@ -1319,7 +1319,7 @@ int lprocfs_wr_pinger_recov(struct file *file, const char __user *buffer, spin_lock(&imp->imp_lock); imp->imp_no_pinger_recover = !val; spin_unlock(&imp->imp_lock); - LPROCFS_CLIMP_EXIT(obd); + up_read(&obd->u.cli.cl_sem); return count; From 33db686a22e502ba127138912814e8468ac51ed6 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Thu, 29 Oct 2015 11:02:23 +0530 Subject: [PATCH 031/843] Staging: lustre: console: Drop unnecessary wrapper function Remove the function lstcon_group_put() and replace all its calls with the function lstcon_group_decref() because the former function just performs the job of calling the latter. Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lnet/selftest/console.c | 78 +++++++++---------- 1 file changed, 36 insertions(+), 42 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index d315dd44ae3b..9748a0907c02 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -277,12 +277,6 @@ lstcon_group_find(const char *name, lstcon_group_t **grpp) return -ENOENT; } -static void -lstcon_group_put(lstcon_group_t *grp) -{ - lstcon_group_decref(grp); -} - static int lstcon_group_ndlink_find(lstcon_group_t *grp, lnet_process_id_t id, lstcon_ndlink_t **ndlpp, int create) @@ -436,7 +430,7 @@ lstcon_group_nodes_add(lstcon_group_t *grp, } if (rc != 0) { - lstcon_group_put(tmp); + lstcon_group_decref(tmp); return rc; } @@ -445,7 +439,7 @@ lstcon_group_nodes_add(lstcon_group_t *grp, tmp, lstcon_sesrpc_condition, &trans); if (rc != 0) { CERROR("Can't create transaction: %d\n", rc); - lstcon_group_put(tmp); + lstcon_group_decref(tmp); return rc; } @@ -460,7 +454,7 @@ lstcon_group_nodes_add(lstcon_group_t *grp, lstcon_rpc_trans_destroy(trans); lstcon_group_move(tmp, grp); - lstcon_group_put(tmp); + lstcon_group_decref(tmp); return rc; } @@ -510,12 +504,12 @@ lstcon_group_nodes_remove(lstcon_group_t *grp, lstcon_rpc_trans_destroy(trans); /* release nodes anyway, because we can't rollback status */ - lstcon_group_put(tmp); + lstcon_group_decref(tmp); return rc; error: lstcon_group_move(tmp, grp); - lstcon_group_put(tmp); + lstcon_group_decref(tmp); return rc; } @@ -529,7 +523,7 @@ lstcon_group_add(char *name) rc = (lstcon_group_find(name, &grp) == 0) ? -EEXIST : 0; if (rc != 0) { /* find a group with same name */ - lstcon_group_put(grp); + lstcon_group_decref(grp); return rc; } @@ -563,14 +557,14 @@ lstcon_nodes_add(char *name, int count, lnet_process_id_t *ids_up, if (grp->grp_ref > 2) { /* referred by other threads or test */ CDEBUG(D_NET, "Group %s is busy\n", name); - lstcon_group_put(grp); + lstcon_group_decref(grp); return -EBUSY; } rc = lstcon_group_nodes_add(grp, count, ids_up, featp, result_up); - lstcon_group_put(grp); + lstcon_group_decref(grp); return rc; } @@ -591,7 +585,7 @@ lstcon_group_del(char *name) if (grp->grp_ref > 2) { /* referred by others threads or test */ CDEBUG(D_NET, "Group %s is busy\n", name); - lstcon_group_put(grp); + lstcon_group_decref(grp); return -EBUSY; } @@ -600,7 +594,7 @@ lstcon_group_del(char *name) grp, lstcon_sesrpc_condition, &trans); if (rc != 0) { CERROR("Can't create transaction: %d\n", rc); - lstcon_group_put(grp); + lstcon_group_decref(grp); return rc; } @@ -608,10 +602,10 @@ lstcon_group_del(char *name) lstcon_rpc_trans_destroy(trans); - lstcon_group_put(grp); + lstcon_group_decref(grp); /* -ref for session, it's destroyed, * status can't be rolled back, destroy group anyway */ - lstcon_group_put(grp); + lstcon_group_decref(grp); return rc; } @@ -631,7 +625,7 @@ lstcon_group_clean(char *name, int args) if (grp->grp_ref > 2) { /* referred by test */ CDEBUG(D_NET, "Group %s is busy\n", name); - lstcon_group_put(grp); + lstcon_group_decref(grp); return -EBUSY; } @@ -640,10 +634,10 @@ lstcon_group_clean(char *name, int args) lstcon_group_drain(grp, args); - lstcon_group_put(grp); + lstcon_group_decref(grp); /* release empty group */ if (list_empty(&grp->grp_ndl_list)) - lstcon_group_put(grp); + lstcon_group_decref(grp); return 0; } @@ -664,16 +658,16 @@ lstcon_nodes_remove(char *name, int count, if (grp->grp_ref > 2) { /* referred by test */ CDEBUG(D_NET, "Group %s is busy\n", name); - lstcon_group_put(grp); + lstcon_group_decref(grp); return -EBUSY; } rc = lstcon_group_nodes_remove(grp, count, ids_up, result_up); - lstcon_group_put(grp); + lstcon_group_decref(grp); /* release empty group */ if (list_empty(&grp->grp_ndl_list)) - lstcon_group_put(grp); + lstcon_group_decref(grp); return rc; } @@ -694,7 +688,7 @@ lstcon_group_refresh(char *name, struct list_head *result_up) if (grp->grp_ref > 2) { /* referred by test */ CDEBUG(D_NET, "Group %s is busy\n", name); - lstcon_group_put(grp); + lstcon_group_decref(grp); return -EBUSY; } @@ -705,7 +699,7 @@ lstcon_group_refresh(char *name, struct list_head *result_up) if (rc != 0) { /* local error, return */ CDEBUG(D_NET, "Can't create transaction: %d\n", rc); - lstcon_group_put(grp); + lstcon_group_decref(grp); return rc; } @@ -715,7 +709,7 @@ lstcon_group_refresh(char *name, struct list_head *result_up) lstcon_rpc_trans_destroy(trans); /* -ref for me */ - lstcon_group_put(grp); + lstcon_group_decref(grp); return rc; } @@ -797,7 +791,7 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p, /* verbose query */ rc = lstcon_nodes_getent(&grp->grp_ndl_list, index_p, count_p, dents_up); - lstcon_group_put(grp); + lstcon_group_decref(grp); return rc; } @@ -806,7 +800,7 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p, LIBCFS_ALLOC(gentp, sizeof(lstcon_ndlist_ent_t)); if (gentp == NULL) { CERROR("Can't allocate ndlist_ent\n"); - lstcon_group_put(grp); + lstcon_group_decref(grp); return -ENOMEM; } @@ -819,7 +813,7 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p, LIBCFS_FREE(gentp, sizeof(lstcon_ndlist_ent_t)); - lstcon_group_put(grp); + lstcon_group_decref(grp); return 0; } @@ -1096,8 +1090,8 @@ lstcon_batch_destroy(lstcon_batch_t *bat) list_del(&test->tes_link); - lstcon_group_put(test->tes_src_grp); - lstcon_group_put(test->tes_dst_grp); + lstcon_group_decref(test->tes_src_grp); + lstcon_group_decref(test->tes_dst_grp); LIBCFS_FREE(test, offsetof(lstcon_test_t, tes_param[test->tes_paramlen])); @@ -1352,10 +1346,10 @@ out: LIBCFS_FREE(test, offsetof(lstcon_test_t, tes_param[paramlen])); if (dst_grp != NULL) - lstcon_group_put(dst_grp); + lstcon_group_decref(dst_grp); if (src_grp != NULL) - lstcon_group_put(src_grp); + lstcon_group_decref(src_grp); return rc; } @@ -1518,7 +1512,7 @@ lstcon_group_stat(char *grp_name, int timeout, struct list_head *result_up) rc = lstcon_ndlist_stat(&grp->grp_ndl_list, timeout, result_up); - lstcon_group_put(grp); + lstcon_group_decref(grp); return rc; } @@ -1556,13 +1550,13 @@ lstcon_nodes_stat(int count, lnet_process_id_t *ids_up, } if (rc != 0) { - lstcon_group_put(tmp); + lstcon_group_decref(tmp); return rc; } rc = lstcon_ndlist_stat(&tmp->grp_ndl_list, timeout, result_up); - lstcon_group_put(tmp); + lstcon_group_decref(tmp); return rc; } @@ -1629,7 +1623,7 @@ lstcon_group_debug(int timeout, char *name, rc = lstcon_debug_ndlist(&grp->grp_ndl_list, NULL, timeout, result_up); - lstcon_group_put(grp); + lstcon_group_decref(grp); return rc; } @@ -1666,14 +1660,14 @@ lstcon_nodes_debug(int timeout, } if (rc != 0) { - lstcon_group_put(grp); + lstcon_group_decref(grp); return rc; } rc = lstcon_debug_ndlist(&grp->grp_ndl_list, NULL, timeout, result_up); - lstcon_group_put(grp); + lstcon_group_decref(grp); return rc; } @@ -1847,7 +1841,7 @@ lstcon_session_end(void) lstcon_group_t, grp_link); LASSERT(grp->grp_ref == 1); - lstcon_group_put(grp); + lstcon_group_decref(grp); } /* all nodes should be released */ @@ -1966,7 +1960,7 @@ lstcon_acceptor_handle(srpc_server_rpc_t *rpc) out: rep->msg_ses_feats = console_session.ses_features; if (grp != NULL) - lstcon_group_put(grp); + lstcon_group_decref(grp); mutex_unlock(&console_session.ses_mutex); From a2ce13a7bb03f7e09514e2022cf019ae790a97f0 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Thu, 29 Oct 2015 11:50:35 +0530 Subject: [PATCH 032/843] Staging: lustre: console: Remove irrelevant return statement Remove return statement from the function lstcon_group_ndlink_move() as its return type is void. Fix checkpatch WARNING: void function return statements are not generally useful Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/selftest/console.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index 9748a0907c02..b1eceb4f4838 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -318,8 +318,6 @@ lstcon_group_ndlink_move(lstcon_group_t *old, list_add_tail(&ndl->ndl_hlink, &new->grp_ndl_hash[idx]); list_add_tail(&ndl->ndl_link, &new->grp_ndl_list); new->grp_nnode++; - - return; } static void From 7bcd831b8579212303ec7c30e975432b914493dc Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Thu, 29 Oct 2015 12:08:06 +0530 Subject: [PATCH 033/843] Staging: lustre: api-ni: Drop unneeded wrapper function Remove the function lnet_create_interface_cookie() and replace its call with the function ktime_get_ns(). Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/lnet/api-ni.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index 395412639935..284150f53f7d 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -356,15 +356,6 @@ lnet_counters_reset(void) } EXPORT_SYMBOL(lnet_counters_reset); -static __u64 -lnet_create_interface_cookie(void) -{ - /* NB the interface cookie in wire handles guards against delayed - * replies and ACKs appearing valid after reboot. - */ - return ktime_get_ns(); -} - static char * lnet_res_type2str(int type) { @@ -553,8 +544,11 @@ lnet_prepare(lnet_pid_t requested_pid) rc = lnet_create_remote_nets_table(); if (rc != 0) goto failed; - - the_lnet.ln_interface_cookie = lnet_create_interface_cookie(); + /* + * NB the interface cookie in wire handles guards against delayed + * replies and ACKs appearing valid after reboot. + */ + the_lnet.ln_interface_cookie = ktime_get_ns(); the_lnet.ln_counters = cfs_percpt_alloc(lnet_cpt_table(), sizeof(lnet_counters_t)); From cfa38118d3d736c7586e5b9a92b36c9b9b2bf5f3 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Thu, 29 Oct 2015 12:28:31 +0530 Subject: [PATCH 034/843] Staging: lustre: config: Remove unnecessary wrapper functions Remove the function lnet_ipaddr_free_enumeration() and replace all its calls with LIBCFS_FREE(). Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/lnet/config.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/config.c b/drivers/staging/lustre/lnet/lnet/config.c index 1b3bc8386524..4e8b54b86c7d 100644 --- a/drivers/staging/lustre/lnet/lnet/config.c +++ b/drivers/staging/lustre/lnet/lnet/config.c @@ -1103,12 +1103,6 @@ lnet_match_networks(char **networksp, char *ip2nets, __u32 *ipaddrs, int nip) return count; } -static void -lnet_ipaddr_free_enumeration(__u32 *ipaddrs, int nip) -{ - LIBCFS_FREE(ipaddrs, nip * sizeof(*ipaddrs)); -} - static int lnet_ipaddr_enumerate(__u32 **ipaddrsp) { @@ -1169,7 +1163,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp) rc = nip; } } - lnet_ipaddr_free_enumeration(ipaddrs, nif); + LIBCFS_FREE(ipaddrs, nip * sizeof(*ipaddrs)); } return nip; } @@ -1195,7 +1189,7 @@ lnet_parse_ip2nets(char **networksp, char *ip2nets) } rc = lnet_match_networks(networksp, ip2nets, ipaddrs, nip); - lnet_ipaddr_free_enumeration(ipaddrs, nip); + LIBCFS_FREE(ipaddrs, nip * sizeof(*ipaddrs)); if (rc < 0) { LCONSOLE_ERROR_MSG(0x119, "Error %d parsing ip2nets\n", rc); From ab4199034f2ba29f6512e9eccbed46bdb0772e44 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Thu, 29 Oct 2015 18:59:14 +0530 Subject: [PATCH 035/843] Staging: lustre: rpc: Drop unnecessary wrapper function Remove the function srpc_post_active_rqtbuf() and replace its only call with the function srpc_post_active_rdma() by adding appropriate parameters. Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/selftest/rpc.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c index 7005002c15da..0d1e7caf7cd6 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.c +++ b/drivers/staging/lustre/lnet/selftest/rpc.c @@ -444,15 +444,6 @@ srpc_post_active_rdma(int portal, __u64 matchbits, void *buf, int len, return 0; } -static int -srpc_post_active_rqtbuf(lnet_process_id_t peer, int service, void *buf, - int len, lnet_handle_md_t *mdh, srpc_event_t *ev) -{ - return srpc_post_active_rdma(srpc_serv_portal(service), service, - buf, len, LNET_MD_OP_PUT, peer, - LNET_NID_ANY, mdh, ev); -} - static int srpc_post_passive_rqtbuf(int service, int local, void *buf, int len, lnet_handle_md_t *mdh, srpc_event_t *ev) @@ -798,9 +789,11 @@ srpc_send_request(srpc_client_rpc_t *rpc) ev->ev_data = rpc; ev->ev_type = SRPC_REQUEST_SENT; - rc = srpc_post_active_rqtbuf(rpc->crpc_dest, rpc->crpc_service, - &rpc->crpc_reqstmsg, sizeof(srpc_msg_t), - &rpc->crpc_reqstmdh, ev); + rc = srpc_post_active_rdma(srpc_serv_portal(rpc->crpc_service), + rpc->crpc_service, &rpc->crpc_reqstmsg, + sizeof(srpc_msg_t), LNET_MD_OP_PUT, + rpc->crpc_dest, LNET_NID_ANY, + &rpc->crpc_reqstmdh, ev); if (rc != 0) { LASSERT(rc == -ENOMEM); ev->ev_fired = 1; /* no more event expected */ From a13b1f3241fcc4fa09851dca1d73d9fca11d6275 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 29 Oct 2015 12:24:40 +0300 Subject: [PATCH 036/843] staging: lustre: remove o_ prefix from function pointers We mostly refer to these function pointers using macros that use macro magic to add the "o_" prefix to the front. It means that you can't use cscope to find the caller. Heck, you can't even grep for it. I looked at preserving the "o_" prefix by removing the macro magic and adding "o_" to all the call sites but then I realized that, really, the prefix doesn't add any value. Let's just remove it. Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/include/obd.h | 188 +++++++++--------- .../staging/lustre/lustre/include/obd_class.h | 8 +- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 34 ++-- drivers/staging/lustre/lustre/lov/lov_obd.c | 58 +++--- .../staging/lustre/lustre/mdc/mdc_request.c | 40 ++-- .../staging/lustre/lustre/mgc/mgc_request.c | 28 +-- .../staging/lustre/lustre/obdclass/genops.c | 4 +- .../lustre/lustre/obdecho/echo_client.c | 8 +- .../staging/lustre/lustre/osc/osc_request.c | 54 ++--- 9 files changed, 211 insertions(+), 211 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 5e93afca3435..5aca9bb4b536 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -963,123 +963,123 @@ struct md_enqueue_info { }; struct obd_ops { - struct module *o_owner; - int (*o_iocontrol)(unsigned int cmd, struct obd_export *exp, int len, - void *karg, void *uarg); - int (*o_get_info)(const struct lu_env *env, struct obd_export *, - __u32 keylen, void *key, __u32 *vallen, void *val, - struct lov_stripe_md *lsm); - int (*o_set_info_async)(const struct lu_env *, struct obd_export *, - __u32 keylen, void *key, - __u32 vallen, void *val, - struct ptlrpc_request_set *set); - int (*o_attach)(struct obd_device *dev, u32 len, void *data); - int (*o_detach)(struct obd_device *dev); - int (*o_setup)(struct obd_device *dev, struct lustre_cfg *cfg); - int (*o_precleanup)(struct obd_device *dev, - enum obd_cleanup_stage cleanup_stage); - int (*o_cleanup)(struct obd_device *dev); - int (*o_process_config)(struct obd_device *dev, u32 len, void *data); - int (*o_postrecov)(struct obd_device *dev); - int (*o_add_conn)(struct obd_import *imp, struct obd_uuid *uuid, - int priority); - int (*o_del_conn)(struct obd_import *imp, struct obd_uuid *uuid); + struct module *owner; + int (*iocontrol)(unsigned int cmd, struct obd_export *exp, int len, + void *karg, void *uarg); + int (*get_info)(const struct lu_env *env, struct obd_export *, + __u32 keylen, void *key, __u32 *vallen, void *val, + struct lov_stripe_md *lsm); + int (*set_info_async)(const struct lu_env *, struct obd_export *, + __u32 keylen, void *key, + __u32 vallen, void *val, + struct ptlrpc_request_set *set); + int (*attach)(struct obd_device *dev, u32 len, void *data); + int (*detach)(struct obd_device *dev); + int (*setup)(struct obd_device *dev, struct lustre_cfg *cfg); + int (*precleanup)(struct obd_device *dev, + enum obd_cleanup_stage cleanup_stage); + int (*cleanup)(struct obd_device *dev); + int (*process_config)(struct obd_device *dev, u32 len, void *data); + int (*postrecov)(struct obd_device *dev); + int (*add_conn)(struct obd_import *imp, struct obd_uuid *uuid, + int priority); + int (*del_conn)(struct obd_import *imp, struct obd_uuid *uuid); /* connect to the target device with given connection * data. @ocd->ocd_connect_flags is modified to reflect flags actually * granted by the target, which are guaranteed to be a subset of flags * asked for. If @ocd == NULL, use default parameters. */ - int (*o_connect)(const struct lu_env *env, - struct obd_export **exp, struct obd_device *src, - struct obd_uuid *cluuid, struct obd_connect_data *ocd, + int (*connect)(const struct lu_env *env, + struct obd_export **exp, struct obd_device *src, + struct obd_uuid *cluuid, struct obd_connect_data *ocd, + void *localdata); + int (*reconnect)(const struct lu_env *env, + struct obd_export *exp, struct obd_device *src, + struct obd_uuid *cluuid, + struct obd_connect_data *ocd, void *localdata); - int (*o_reconnect)(const struct lu_env *env, - struct obd_export *exp, struct obd_device *src, - struct obd_uuid *cluuid, - struct obd_connect_data *ocd, - void *localdata); - int (*o_disconnect)(struct obd_export *exp); + int (*disconnect)(struct obd_export *exp); /* Initialize/finalize fids infrastructure. */ - int (*o_fid_init)(struct obd_device *obd, - struct obd_export *exp, enum lu_cli_type type); - int (*o_fid_fini)(struct obd_device *obd); + int (*fid_init)(struct obd_device *obd, + struct obd_export *exp, enum lu_cli_type type); + int (*fid_fini)(struct obd_device *obd); /* Allocate new fid according to passed @hint. */ - int (*o_fid_alloc)(struct obd_export *exp, struct lu_fid *fid, - struct md_op_data *op_data); + int (*fid_alloc)(struct obd_export *exp, struct lu_fid *fid, + struct md_op_data *op_data); /* * Object with @fid is getting deleted, we may want to do something * about this. */ - int (*o_statfs)(const struct lu_env *, struct obd_export *exp, - struct obd_statfs *osfs, __u64 max_age, __u32 flags); - int (*o_statfs_async)(struct obd_export *exp, struct obd_info *oinfo, - __u64 max_age, struct ptlrpc_request_set *set); - int (*o_packmd)(struct obd_export *exp, struct lov_mds_md **disk_tgt, - struct lov_stripe_md *mem_src); - int (*o_unpackmd)(struct obd_export *exp, - struct lov_stripe_md **mem_tgt, - struct lov_mds_md *disk_src, int disk_len); - int (*o_preallocate)(struct lustre_handle *, u32 *req, u64 *ids); - int (*o_create)(const struct lu_env *env, struct obd_export *exp, - struct obdo *oa, struct lov_stripe_md **ea, - struct obd_trans_info *oti); - int (*o_destroy)(const struct lu_env *env, struct obd_export *exp, - struct obdo *oa, struct lov_stripe_md *ea, - struct obd_trans_info *oti, struct obd_export *md_exp); - int (*o_setattr)(const struct lu_env *, struct obd_export *exp, - struct obd_info *oinfo, struct obd_trans_info *oti); - int (*o_setattr_async)(struct obd_export *exp, struct obd_info *oinfo, - struct obd_trans_info *oti, - struct ptlrpc_request_set *rqset); - int (*o_getattr)(const struct lu_env *env, struct obd_export *exp, - struct obd_info *oinfo); - int (*o_getattr_async)(struct obd_export *exp, struct obd_info *oinfo, - struct ptlrpc_request_set *set); - int (*o_adjust_kms)(struct obd_export *exp, struct lov_stripe_md *lsm, - u64 size, int shrink); - int (*o_preprw)(const struct lu_env *env, int cmd, - struct obd_export *exp, struct obdo *oa, int objcount, - struct obd_ioobj *obj, struct niobuf_remote *remote, - int *nr_pages, struct niobuf_local *local, - struct obd_trans_info *oti); - int (*o_commitrw)(const struct lu_env *env, int cmd, - struct obd_export *exp, struct obdo *oa, - int objcount, struct obd_ioobj *obj, - struct niobuf_remote *remote, int pages, - struct niobuf_local *local, - struct obd_trans_info *oti, int rc); - int (*o_find_cbdata)(struct obd_export *, struct lov_stripe_md *, - ldlm_iterator_t it, void *data); - int (*o_init_export)(struct obd_export *exp); - int (*o_destroy_export)(struct obd_export *exp); + int (*statfs)(const struct lu_env *, struct obd_export *exp, + struct obd_statfs *osfs, __u64 max_age, __u32 flags); + int (*statfs_async)(struct obd_export *exp, struct obd_info *oinfo, + __u64 max_age, struct ptlrpc_request_set *set); + int (*packmd)(struct obd_export *exp, struct lov_mds_md **disk_tgt, + struct lov_stripe_md *mem_src); + int (*unpackmd)(struct obd_export *exp, + struct lov_stripe_md **mem_tgt, + struct lov_mds_md *disk_src, int disk_len); + int (*preallocate)(struct lustre_handle *, u32 *req, u64 *ids); + int (*create)(const struct lu_env *env, struct obd_export *exp, + struct obdo *oa, struct lov_stripe_md **ea, + struct obd_trans_info *oti); + int (*destroy)(const struct lu_env *env, struct obd_export *exp, + struct obdo *oa, struct lov_stripe_md *ea, + struct obd_trans_info *oti, struct obd_export *md_exp); + int (*setattr)(const struct lu_env *, struct obd_export *exp, + struct obd_info *oinfo, struct obd_trans_info *oti); + int (*setattr_async)(struct obd_export *exp, struct obd_info *oinfo, + struct obd_trans_info *oti, + struct ptlrpc_request_set *rqset); + int (*getattr)(const struct lu_env *env, struct obd_export *exp, + struct obd_info *oinfo); + int (*getattr_async)(struct obd_export *exp, struct obd_info *oinfo, + struct ptlrpc_request_set *set); + int (*adjust_kms)(struct obd_export *exp, struct lov_stripe_md *lsm, + u64 size, int shrink); + int (*preprw)(const struct lu_env *env, int cmd, + struct obd_export *exp, struct obdo *oa, int objcount, + struct obd_ioobj *obj, struct niobuf_remote *remote, + int *nr_pages, struct niobuf_local *local, + struct obd_trans_info *oti); + int (*commitrw)(const struct lu_env *env, int cmd, + struct obd_export *exp, struct obdo *oa, + int objcount, struct obd_ioobj *obj, + struct niobuf_remote *remote, int pages, + struct niobuf_local *local, + struct obd_trans_info *oti, int rc); + int (*find_cbdata)(struct obd_export *, struct lov_stripe_md *, + ldlm_iterator_t it, void *data); + int (*init_export)(struct obd_export *exp); + int (*destroy_export)(struct obd_export *exp); /* metadata-only methods */ - int (*o_import_event)(struct obd_device *, struct obd_import *, - enum obd_import_event); + int (*import_event)(struct obd_device *, struct obd_import *, + enum obd_import_event); - int (*o_notify)(struct obd_device *obd, struct obd_device *watched, - enum obd_notify_event ev, void *data); + int (*notify)(struct obd_device *obd, struct obd_device *watched, + enum obd_notify_event ev, void *data); - int (*o_health_check)(const struct lu_env *env, struct obd_device *); - struct obd_uuid *(*o_get_uuid)(struct obd_export *exp); + int (*health_check)(const struct lu_env *env, struct obd_device *); + struct obd_uuid *(*get_uuid)(struct obd_export *exp); /* quota methods */ - int (*o_quotacheck)(struct obd_device *, struct obd_export *, - struct obd_quotactl *); - int (*o_quotactl)(struct obd_device *, struct obd_export *, + int (*quotacheck)(struct obd_device *, struct obd_export *, struct obd_quotactl *); + int (*quotactl)(struct obd_device *, struct obd_export *, + struct obd_quotactl *); /* pools methods */ - int (*o_pool_new)(struct obd_device *obd, char *poolname); - int (*o_pool_del)(struct obd_device *obd, char *poolname); - int (*o_pool_add)(struct obd_device *obd, char *poolname, - char *ostname); - int (*o_pool_rem)(struct obd_device *obd, char *poolname, - char *ostname); - void (*o_getref)(struct obd_device *obd); - void (*o_putref)(struct obd_device *obd); + int (*pool_new)(struct obd_device *obd, char *poolname); + int (*pool_del)(struct obd_device *obd, char *poolname); + int (*pool_add)(struct obd_device *obd, char *poolname, + char *ostname); + int (*pool_rem)(struct obd_device *obd, char *poolname, + char *ostname); + void (*getref)(struct obd_device *obd); + void (*putref)(struct obd_device *obd); /* * NOTE: If adding ops, add another LPROCFS_OBD_OP_INIT() line * to lprocfs_alloc_obd_stats() in obdclass/lprocfs_status.c. diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index fd5f3731db92..84bd62258d51 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -270,7 +270,7 @@ void obdo_to_ioobj(struct obdo *oa, struct obd_ioobj *ioobj); void md_from_obdo(struct md_op_data *op_data, struct obdo *oa, u32 valid); #define OBT(dev) (dev)->obd_type -#define OBP(dev, op) (dev)->obd_type->typ_dt_ops->o_ ## op +#define OBP(dev, op) (dev)->obd_type->typ_dt_ops->op #define MDP(dev, op) (dev)->obd_type->typ_md_ops->m_ ## op #define CTXTP(ctxt, op) (ctxt)->loc_logops->lop_##op @@ -301,9 +301,9 @@ static inline int obd_check_dev_active(struct obd_device *obd) } #define OBD_COUNTER_OFFSET(op) \ - ((offsetof(struct obd_ops, o_ ## op) - \ - offsetof(struct obd_ops, o_iocontrol)) \ - / sizeof(((struct obd_ops *)(0))->o_iocontrol)) + ((offsetof(struct obd_ops, op) - \ + offsetof(struct obd_ops, iocontrol)) \ + / sizeof(((struct obd_ops *)(0))->iocontrol)) #define OBD_COUNTER_INCREMENT(obdx, op) \ if ((obdx)->obd_stats != NULL) { \ diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 635a93cc94de..947a127c48d0 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -2744,23 +2744,23 @@ static int lmv_quotacheck(struct obd_device *unused, struct obd_export *exp, } static struct obd_ops lmv_obd_ops = { - .o_owner = THIS_MODULE, - .o_setup = lmv_setup, - .o_cleanup = lmv_cleanup, - .o_precleanup = lmv_precleanup, - .o_process_config = lmv_process_config, - .o_connect = lmv_connect, - .o_disconnect = lmv_disconnect, - .o_statfs = lmv_statfs, - .o_get_info = lmv_get_info, - .o_set_info_async = lmv_set_info_async, - .o_packmd = lmv_packmd, - .o_unpackmd = lmv_unpackmd, - .o_notify = lmv_notify, - .o_get_uuid = lmv_get_uuid, - .o_iocontrol = lmv_iocontrol, - .o_quotacheck = lmv_quotacheck, - .o_quotactl = lmv_quotactl + .owner = THIS_MODULE, + .setup = lmv_setup, + .cleanup = lmv_cleanup, + .precleanup = lmv_precleanup, + .process_config = lmv_process_config, + .connect = lmv_connect, + .disconnect = lmv_disconnect, + .statfs = lmv_statfs, + .get_info = lmv_get_info, + .set_info_async = lmv_set_info_async, + .packmd = lmv_packmd, + .unpackmd = lmv_unpackmd, + .notify = lmv_notify, + .get_uuid = lmv_get_uuid, + .iocontrol = lmv_iocontrol, + .quotacheck = lmv_quotacheck, + .quotactl = lmv_quotactl }; static struct md_ops lmv_md_ops = { diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index 7abe484c07c0..6bd4ac051274 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -2277,35 +2277,35 @@ out: } static struct obd_ops lov_obd_ops = { - .o_owner = THIS_MODULE, - .o_setup = lov_setup, - .o_precleanup = lov_precleanup, - .o_cleanup = lov_cleanup, - /*.o_process_config = lov_process_config,*/ - .o_connect = lov_connect, - .o_disconnect = lov_disconnect, - .o_statfs = lov_statfs, - .o_statfs_async = lov_statfs_async, - .o_packmd = lov_packmd, - .o_unpackmd = lov_unpackmd, - .o_create = lov_create, - .o_destroy = lov_destroy, - .o_getattr_async = lov_getattr_async, - .o_setattr_async = lov_setattr_async, - .o_adjust_kms = lov_adjust_kms, - .o_find_cbdata = lov_find_cbdata, - .o_iocontrol = lov_iocontrol, - .o_get_info = lov_get_info, - .o_set_info_async = lov_set_info_async, - .o_notify = lov_notify, - .o_pool_new = lov_pool_new, - .o_pool_rem = lov_pool_remove, - .o_pool_add = lov_pool_add, - .o_pool_del = lov_pool_del, - .o_getref = lov_getref, - .o_putref = lov_putref, - .o_quotactl = lov_quotactl, - .o_quotacheck = lov_quotacheck, + .owner = THIS_MODULE, + .setup = lov_setup, + .precleanup = lov_precleanup, + .cleanup = lov_cleanup, + /*.process_config = lov_process_config,*/ + .connect = lov_connect, + .disconnect = lov_disconnect, + .statfs = lov_statfs, + .statfs_async = lov_statfs_async, + .packmd = lov_packmd, + .unpackmd = lov_unpackmd, + .create = lov_create, + .destroy = lov_destroy, + .getattr_async = lov_getattr_async, + .setattr_async = lov_setattr_async, + .adjust_kms = lov_adjust_kms, + .find_cbdata = lov_find_cbdata, + .iocontrol = lov_iocontrol, + .get_info = lov_get_info, + .set_info_async = lov_set_info_async, + .notify = lov_notify, + .pool_new = lov_pool_new, + .pool_rem = lov_pool_remove, + .pool_add = lov_pool_add, + .pool_del = lov_pool_del, + .getref = lov_getref, + .putref = lov_putref, + .quotactl = lov_quotactl, + .quotacheck = lov_quotacheck, }; struct kmem_cache *lov_oinfo_slab; diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 16a5a10d371e..34a88675e361 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -2460,26 +2460,26 @@ static int mdc_get_remote_perm(struct obd_export *exp, const struct lu_fid *fid, } static struct obd_ops mdc_obd_ops = { - .o_owner = THIS_MODULE, - .o_setup = mdc_setup, - .o_precleanup = mdc_precleanup, - .o_cleanup = mdc_cleanup, - .o_add_conn = client_import_add_conn, - .o_del_conn = client_import_del_conn, - .o_connect = client_connect_import, - .o_disconnect = client_disconnect_export, - .o_iocontrol = mdc_iocontrol, - .o_set_info_async = mdc_set_info_async, - .o_statfs = mdc_statfs, - .o_fid_init = client_fid_init, - .o_fid_fini = client_fid_fini, - .o_fid_alloc = mdc_fid_alloc, - .o_import_event = mdc_import_event, - .o_get_info = mdc_get_info, - .o_process_config = mdc_process_config, - .o_get_uuid = mdc_get_uuid, - .o_quotactl = mdc_quotactl, - .o_quotacheck = mdc_quotacheck + .owner = THIS_MODULE, + .setup = mdc_setup, + .precleanup = mdc_precleanup, + .cleanup = mdc_cleanup, + .add_conn = client_import_add_conn, + .del_conn = client_import_del_conn, + .connect = client_connect_import, + .disconnect = client_disconnect_export, + .iocontrol = mdc_iocontrol, + .set_info_async = mdc_set_info_async, + .statfs = mdc_statfs, + .fid_init = client_fid_init, + .fid_fini = client_fid_fini, + .fid_alloc = mdc_fid_alloc, + .import_event = mdc_import_event, + .get_info = mdc_get_info, + .process_config = mdc_process_config, + .get_uuid = mdc_get_uuid, + .quotactl = mdc_quotactl, + .quotacheck = mdc_quotacheck }; static struct md_ops mdc_md_ops = { diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index 2d6de6c19b9f..b73f8f21b6c5 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -1698,20 +1698,20 @@ out: } static struct obd_ops mgc_obd_ops = { - .o_owner = THIS_MODULE, - .o_setup = mgc_setup, - .o_precleanup = mgc_precleanup, - .o_cleanup = mgc_cleanup, - .o_add_conn = client_import_add_conn, - .o_del_conn = client_import_del_conn, - .o_connect = client_connect_import, - .o_disconnect = client_disconnect_export, - /* .o_enqueue = mgc_enqueue, */ - /* .o_iocontrol = mgc_iocontrol, */ - .o_set_info_async = mgc_set_info_async, - .o_get_info = mgc_get_info, - .o_import_event = mgc_import_event, - .o_process_config = mgc_process_config, + .owner = THIS_MODULE, + .setup = mgc_setup, + .precleanup = mgc_precleanup, + .cleanup = mgc_cleanup, + .add_conn = client_import_add_conn, + .del_conn = client_import_del_conn, + .connect = client_connect_import, + .disconnect = client_disconnect_export, + /* .enqueue = mgc_enqueue, */ + /* .iocontrol = mgc_iocontrol, */ + .set_info_async = mgc_set_info_async, + .get_info = mgc_get_info, + .import_event = mgc_import_event, + .process_config = mgc_process_config, }; static int __init mgc_init(void) diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index 6477aeb88028..08966562d7fe 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -132,7 +132,7 @@ static struct obd_type *class_get_type(const char *name) if (type) { spin_lock(&type->obd_type_lock); type->typ_refcnt++; - try_module_get(type->typ_dt_ops->o_owner); + try_module_get(type->typ_dt_ops->owner); spin_unlock(&type->obd_type_lock); } return type; @@ -143,7 +143,7 @@ void class_put_type(struct obd_type *type) LASSERT(type); spin_lock(&type->obd_type_lock); type->typ_refcnt--; - module_put(type->typ_dt_ops->o_owner); + module_put(type->typ_dt_ops->owner); spin_unlock(&type->obd_type_lock); } EXPORT_SYMBOL(class_put_type); diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index f61ef669644c..f49564f6bb89 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -2128,10 +2128,10 @@ static int echo_client_disconnect(struct obd_export *exp) } static struct obd_ops echo_client_obd_ops = { - .o_owner = THIS_MODULE, - .o_iocontrol = echo_client_iocontrol, - .o_connect = echo_client_connect, - .o_disconnect = echo_client_disconnect + .owner = THIS_MODULE, + .iocontrol = echo_client_iocontrol, + .connect = echo_client_connect, + .disconnect = echo_client_disconnect }; static int echo_client_init(void) diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index 367f83af12c0..18118fcf7d37 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -3255,33 +3255,33 @@ static int osc_process_config(struct obd_device *obd, u32 len, void *buf) } struct obd_ops osc_obd_ops = { - .o_owner = THIS_MODULE, - .o_setup = osc_setup, - .o_precleanup = osc_precleanup, - .o_cleanup = osc_cleanup, - .o_add_conn = client_import_add_conn, - .o_del_conn = client_import_del_conn, - .o_connect = client_connect_import, - .o_reconnect = osc_reconnect, - .o_disconnect = osc_disconnect, - .o_statfs = osc_statfs, - .o_statfs_async = osc_statfs_async, - .o_packmd = osc_packmd, - .o_unpackmd = osc_unpackmd, - .o_create = osc_create, - .o_destroy = osc_destroy, - .o_getattr = osc_getattr, - .o_getattr_async = osc_getattr_async, - .o_setattr = osc_setattr, - .o_setattr_async = osc_setattr_async, - .o_find_cbdata = osc_find_cbdata, - .o_iocontrol = osc_iocontrol, - .o_get_info = osc_get_info, - .o_set_info_async = osc_set_info_async, - .o_import_event = osc_import_event, - .o_process_config = osc_process_config, - .o_quotactl = osc_quotactl, - .o_quotacheck = osc_quotacheck, + .owner = THIS_MODULE, + .setup = osc_setup, + .precleanup = osc_precleanup, + .cleanup = osc_cleanup, + .add_conn = client_import_add_conn, + .del_conn = client_import_del_conn, + .connect = client_connect_import, + .reconnect = osc_reconnect, + .disconnect = osc_disconnect, + .statfs = osc_statfs, + .statfs_async = osc_statfs_async, + .packmd = osc_packmd, + .unpackmd = osc_unpackmd, + .create = osc_create, + .destroy = osc_destroy, + .getattr = osc_getattr, + .getattr_async = osc_getattr_async, + .setattr = osc_setattr, + .setattr_async = osc_setattr_async, + .find_cbdata = osc_find_cbdata, + .iocontrol = osc_iocontrol, + .get_info = osc_get_info, + .set_info_async = osc_set_info_async, + .import_event = osc_import_event, + .process_config = osc_process_config, + .quotactl = osc_quotactl, + .quotacheck = osc_quotacheck, }; extern struct lu_kmem_descr osc_caches[]; From df18a80af3d77d58223d8d88c1660c51108106e8 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 29 Oct 2015 12:26:36 +0300 Subject: [PATCH 037/843] staging: lustre: remove m_ prefix from function pointers All the callers call these function pointers without the "m_" prefix and use macro magic to add it later behind the scenes. It means that you can't grep for the call sites. I considered modifying the call sites but in the end I decided that the "m_" prefix doesn't add anything so we can just get rid of it. Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/include/obd.h | 136 +++++++++--------- .../staging/lustre/lustre/include/obd_class.h | 8 +- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 58 ++++---- .../staging/lustre/lustre/mdc/mdc_request.c | 60 ++++---- 4 files changed, 131 insertions(+), 131 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 5aca9bb4b536..5c90b59cf0db 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -1124,89 +1124,89 @@ struct md_open_data { struct lookup_intent; struct md_ops { - int (*m_getstatus)(struct obd_export *, struct lu_fid *); - int (*m_null_inode)(struct obd_export *, const struct lu_fid *); - int (*m_find_cbdata)(struct obd_export *, const struct lu_fid *, - ldlm_iterator_t, void *); - int (*m_close)(struct obd_export *, struct md_op_data *, - struct md_open_data *, struct ptlrpc_request **); - int (*m_create)(struct obd_export *, struct md_op_data *, - const void *, int, int, __u32, __u32, cfs_cap_t, - __u64, struct ptlrpc_request **); - int (*m_done_writing)(struct obd_export *, struct md_op_data *, - struct md_open_data *); - int (*m_enqueue)(struct obd_export *, struct ldlm_enqueue_info *, - struct lookup_intent *, struct md_op_data *, - struct lustre_handle *, void *, int, - struct ptlrpc_request **, __u64); - int (*m_getattr)(struct obd_export *, struct md_op_data *, - struct ptlrpc_request **); - int (*m_getattr_name)(struct obd_export *, struct md_op_data *, - struct ptlrpc_request **); - int (*m_intent_lock)(struct obd_export *, struct md_op_data *, - void *, int, struct lookup_intent *, int, - struct ptlrpc_request **, - ldlm_blocking_callback, __u64); - int (*m_link)(struct obd_export *, struct md_op_data *, + int (*getstatus)(struct obd_export *, struct lu_fid *); + int (*null_inode)(struct obd_export *, const struct lu_fid *); + int (*find_cbdata)(struct obd_export *, const struct lu_fid *, + ldlm_iterator_t, void *); + int (*close)(struct obd_export *, struct md_op_data *, + struct md_open_data *, struct ptlrpc_request **); + int (*create)(struct obd_export *, struct md_op_data *, + const void *, int, int, __u32, __u32, cfs_cap_t, + __u64, struct ptlrpc_request **); + int (*done_writing)(struct obd_export *, struct md_op_data *, + struct md_open_data *); + int (*enqueue)(struct obd_export *, struct ldlm_enqueue_info *, + struct lookup_intent *, struct md_op_data *, + struct lustre_handle *, void *, int, + struct ptlrpc_request **, __u64); + int (*getattr)(struct obd_export *, struct md_op_data *, + struct ptlrpc_request **); + int (*getattr_name)(struct obd_export *, struct md_op_data *, + struct ptlrpc_request **); + int (*intent_lock)(struct obd_export *, struct md_op_data *, + void *, int, struct lookup_intent *, int, + struct ptlrpc_request **, + ldlm_blocking_callback, __u64); + int (*link)(struct obd_export *, struct md_op_data *, + struct ptlrpc_request **); + int (*rename)(struct obd_export *, struct md_op_data *, + const char *, int, const char *, int, struct ptlrpc_request **); - int (*m_rename)(struct obd_export *, struct md_op_data *, - const char *, int, const char *, int, - struct ptlrpc_request **); - int (*m_is_subdir)(struct obd_export *, const struct lu_fid *, - const struct lu_fid *, + int (*is_subdir)(struct obd_export *, const struct lu_fid *, + const struct lu_fid *, struct ptlrpc_request **); - int (*m_setattr)(struct obd_export *, struct md_op_data *, void *, - int, void *, int, struct ptlrpc_request **, + int (*setattr)(struct obd_export *, struct md_op_data *, void *, + int, void *, int, struct ptlrpc_request **, struct md_open_data **mod); - int (*m_sync)(struct obd_export *, const struct lu_fid *, - struct ptlrpc_request **); - int (*m_readpage)(struct obd_export *, struct md_op_data *, - struct page **, struct ptlrpc_request **); + int (*sync)(struct obd_export *, const struct lu_fid *, + struct ptlrpc_request **); + int (*readpage)(struct obd_export *, struct md_op_data *, + struct page **, struct ptlrpc_request **); - int (*m_unlink)(struct obd_export *, struct md_op_data *, + int (*unlink)(struct obd_export *, struct md_op_data *, + struct ptlrpc_request **); + + int (*setxattr)(struct obd_export *, const struct lu_fid *, + u64, const char *, const char *, int, int, int, __u32, struct ptlrpc_request **); - int (*m_setxattr)(struct obd_export *, const struct lu_fid *, - u64, const char *, const char *, int, int, int, __u32, - struct ptlrpc_request **); + int (*getxattr)(struct obd_export *, const struct lu_fid *, + u64, const char *, const char *, int, int, int, + struct ptlrpc_request **); - int (*m_getxattr)(struct obd_export *, const struct lu_fid *, - u64, const char *, const char *, int, int, int, - struct ptlrpc_request **); + int (*init_ea_size)(struct obd_export *, int, int, int, int); - int (*m_init_ea_size)(struct obd_export *, int, int, int, int); + int (*get_lustre_md)(struct obd_export *, struct ptlrpc_request *, + struct obd_export *, struct obd_export *, + struct lustre_md *); - int (*m_get_lustre_md)(struct obd_export *, struct ptlrpc_request *, - struct obd_export *, struct obd_export *, - struct lustre_md *); + int (*free_lustre_md)(struct obd_export *, struct lustre_md *); - int (*m_free_lustre_md)(struct obd_export *, struct lustre_md *); + int (*set_open_replay_data)(struct obd_export *, + struct obd_client_handle *, + struct lookup_intent *); + int (*clear_open_replay_data)(struct obd_export *, + struct obd_client_handle *); + int (*set_lock_data)(struct obd_export *, __u64 *, void *, __u64 *); - int (*m_set_open_replay_data)(struct obd_export *, - struct obd_client_handle *, - struct lookup_intent *); - int (*m_clear_open_replay_data)(struct obd_export *, - struct obd_client_handle *); - int (*m_set_lock_data)(struct obd_export *, __u64 *, void *, __u64 *); + ldlm_mode_t (*lock_match)(struct obd_export *, __u64, + const struct lu_fid *, ldlm_type_t, + ldlm_policy_data_t *, ldlm_mode_t, + struct lustre_handle *); - ldlm_mode_t (*m_lock_match)(struct obd_export *, __u64, - const struct lu_fid *, ldlm_type_t, - ldlm_policy_data_t *, ldlm_mode_t, - struct lustre_handle *); + int (*cancel_unused)(struct obd_export *, const struct lu_fid *, + ldlm_policy_data_t *, ldlm_mode_t, + ldlm_cancel_flags_t flags, void *opaque); - int (*m_cancel_unused)(struct obd_export *, const struct lu_fid *, - ldlm_policy_data_t *, ldlm_mode_t, - ldlm_cancel_flags_t flags, void *opaque); + int (*get_remote_perm)(struct obd_export *, const struct lu_fid *, + __u32, struct ptlrpc_request **); - int (*m_get_remote_perm)(struct obd_export *, const struct lu_fid *, - __u32, struct ptlrpc_request **); + int (*intent_getattr_async)(struct obd_export *, + struct md_enqueue_info *, + struct ldlm_enqueue_info *); - int (*m_intent_getattr_async)(struct obd_export *, - struct md_enqueue_info *, - struct ldlm_enqueue_info *); - - int (*m_revalidate_lock)(struct obd_export *, struct lookup_intent *, - struct lu_fid *, __u64 *bits); + int (*revalidate_lock)(struct obd_export *, struct lookup_intent *, + struct lu_fid *, __u64 *bits); /* * NOTE: If adding ops, add another LPROCFS_MD_OP_INIT() line to diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index 84bd62258d51..0b7e90ac7818 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -271,7 +271,7 @@ void md_from_obdo(struct md_op_data *op_data, struct obdo *oa, u32 valid); #define OBT(dev) (dev)->obd_type #define OBP(dev, op) (dev)->obd_type->typ_dt_ops->op -#define MDP(dev, op) (dev)->obd_type->typ_md_ops->m_ ## op +#define MDP(dev, op) (dev)->obd_type->typ_md_ops->op #define CTXTP(ctxt, op) (ctxt)->loc_logops->lop_##op /* Ensure obd_setup: used for cleanup which must be called @@ -324,9 +324,9 @@ static inline int obd_check_dev_active(struct obd_device *obd) } #define MD_COUNTER_OFFSET(op) \ - ((offsetof(struct md_ops, m_ ## op) - \ - offsetof(struct md_ops, m_getstatus)) \ - / sizeof(((struct md_ops *)(0))->m_getstatus)) + ((offsetof(struct md_ops, op) - \ + offsetof(struct md_ops, getstatus)) \ + / sizeof(((struct md_ops *)(0))->getstatus)) #define MD_COUNTER_INCREMENT(obdx, op) \ if ((obd)->md_stats != NULL) { \ diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 947a127c48d0..55f801ba9826 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -2764,35 +2764,35 @@ static struct obd_ops lmv_obd_ops = { }; static struct md_ops lmv_md_ops = { - .m_getstatus = lmv_getstatus, - .m_null_inode = lmv_null_inode, - .m_find_cbdata = lmv_find_cbdata, - .m_close = lmv_close, - .m_create = lmv_create, - .m_done_writing = lmv_done_writing, - .m_enqueue = lmv_enqueue, - .m_getattr = lmv_getattr, - .m_getxattr = lmv_getxattr, - .m_getattr_name = lmv_getattr_name, - .m_intent_lock = lmv_intent_lock, - .m_link = lmv_link, - .m_rename = lmv_rename, - .m_setattr = lmv_setattr, - .m_setxattr = lmv_setxattr, - .m_sync = lmv_sync, - .m_readpage = lmv_readpage, - .m_unlink = lmv_unlink, - .m_init_ea_size = lmv_init_ea_size, - .m_cancel_unused = lmv_cancel_unused, - .m_set_lock_data = lmv_set_lock_data, - .m_lock_match = lmv_lock_match, - .m_get_lustre_md = lmv_get_lustre_md, - .m_free_lustre_md = lmv_free_lustre_md, - .m_set_open_replay_data = lmv_set_open_replay_data, - .m_clear_open_replay_data = lmv_clear_open_replay_data, - .m_get_remote_perm = lmv_get_remote_perm, - .m_intent_getattr_async = lmv_intent_getattr_async, - .m_revalidate_lock = lmv_revalidate_lock + .getstatus = lmv_getstatus, + .null_inode = lmv_null_inode, + .find_cbdata = lmv_find_cbdata, + .close = lmv_close, + .create = lmv_create, + .done_writing = lmv_done_writing, + .enqueue = lmv_enqueue, + .getattr = lmv_getattr, + .getxattr = lmv_getxattr, + .getattr_name = lmv_getattr_name, + .intent_lock = lmv_intent_lock, + .link = lmv_link, + .rename = lmv_rename, + .setattr = lmv_setattr, + .setxattr = lmv_setxattr, + .sync = lmv_sync, + .readpage = lmv_readpage, + .unlink = lmv_unlink, + .init_ea_size = lmv_init_ea_size, + .cancel_unused = lmv_cancel_unused, + .set_lock_data = lmv_set_lock_data, + .lock_match = lmv_lock_match, + .get_lustre_md = lmv_get_lustre_md, + .free_lustre_md = lmv_free_lustre_md, + .set_open_replay_data = lmv_set_open_replay_data, + .clear_open_replay_data = lmv_clear_open_replay_data, + .get_remote_perm = lmv_get_remote_perm, + .intent_getattr_async = lmv_intent_getattr_async, + .revalidate_lock = lmv_revalidate_lock }; static int __init lmv_init(void) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 34a88675e361..5b78e7ab6d0b 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -2483,36 +2483,36 @@ static struct obd_ops mdc_obd_ops = { }; static struct md_ops mdc_md_ops = { - .m_getstatus = mdc_getstatus, - .m_null_inode = mdc_null_inode, - .m_find_cbdata = mdc_find_cbdata, - .m_close = mdc_close, - .m_create = mdc_create, - .m_done_writing = mdc_done_writing, - .m_enqueue = mdc_enqueue, - .m_getattr = mdc_getattr, - .m_getattr_name = mdc_getattr_name, - .m_intent_lock = mdc_intent_lock, - .m_link = mdc_link, - .m_is_subdir = mdc_is_subdir, - .m_rename = mdc_rename, - .m_setattr = mdc_setattr, - .m_setxattr = mdc_setxattr, - .m_getxattr = mdc_getxattr, - .m_sync = mdc_sync, - .m_readpage = mdc_readpage, - .m_unlink = mdc_unlink, - .m_cancel_unused = mdc_cancel_unused, - .m_init_ea_size = mdc_init_ea_size, - .m_set_lock_data = mdc_set_lock_data, - .m_lock_match = mdc_lock_match, - .m_get_lustre_md = mdc_get_lustre_md, - .m_free_lustre_md = mdc_free_lustre_md, - .m_set_open_replay_data = mdc_set_open_replay_data, - .m_clear_open_replay_data = mdc_clear_open_replay_data, - .m_get_remote_perm = mdc_get_remote_perm, - .m_intent_getattr_async = mdc_intent_getattr_async, - .m_revalidate_lock = mdc_revalidate_lock + .getstatus = mdc_getstatus, + .null_inode = mdc_null_inode, + .find_cbdata = mdc_find_cbdata, + .close = mdc_close, + .create = mdc_create, + .done_writing = mdc_done_writing, + .enqueue = mdc_enqueue, + .getattr = mdc_getattr, + .getattr_name = mdc_getattr_name, + .intent_lock = mdc_intent_lock, + .link = mdc_link, + .is_subdir = mdc_is_subdir, + .rename = mdc_rename, + .setattr = mdc_setattr, + .setxattr = mdc_setxattr, + .getxattr = mdc_getxattr, + .sync = mdc_sync, + .readpage = mdc_readpage, + .unlink = mdc_unlink, + .cancel_unused = mdc_cancel_unused, + .init_ea_size = mdc_init_ea_size, + .set_lock_data = mdc_set_lock_data, + .lock_match = mdc_lock_match, + .get_lustre_md = mdc_get_lustre_md, + .free_lustre_md = mdc_free_lustre_md, + .set_open_replay_data = mdc_set_open_replay_data, + .clear_open_replay_data = mdc_clear_open_replay_data, + .get_remote_perm = mdc_get_remote_perm, + .intent_getattr_async = mdc_intent_getattr_async, + .revalidate_lock = mdc_revalidate_lock }; static int __init mdc_init(void) From 54cc3794cec410ec2f7daa00089777562218780a Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 29 Oct 2015 16:51:23 +0300 Subject: [PATCH 038/843] staging: lustre: potential underflow in libcfs_kkuc_group_add() My static checker says that "group" is a user controlled number that can be negative leading to an array underflow. I have looked at it, and I'm not an expert enough in lustre to say for sure if it is really a bug. Anyway, it's simple enough to make the variable unsigned which pleases the static checker and makes it easier to audit. Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h | 2 +- drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h index a989d2666230..41f3d810aea4 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h @@ -91,7 +91,7 @@ typedef int (*libcfs_kkuc_cb_t)(__u32 data, void *cb_arg); /* Kernel methods */ int libcfs_kkuc_msg_put(struct file *fp, void *payload); int libcfs_kkuc_group_put(int group, void *payload); -int libcfs_kkuc_group_add(struct file *fp, int uid, int group, +int libcfs_kkuc_group_add(struct file *fp, int uid, unsigned int group, __u32 data); int libcfs_kkuc_group_rem(int uid, int group); int libcfs_kkuc_group_foreach(int group, libcfs_kkuc_cb_t cb_func, diff --git a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c index ad661a33a211..d8230aec9a2b 100644 --- a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c +++ b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c @@ -110,7 +110,8 @@ static DECLARE_RWSEM(kg_sem); * @param uid identifier for this receiver * @param group group number */ -int libcfs_kkuc_group_add(struct file *filp, int uid, int group, __u32 data) +int libcfs_kkuc_group_add(struct file *filp, int uid, unsigned int group, + __u32 data) { struct kkuc_reg *reg; From 358855b2681e16d047357599efd0884fab367419 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Fri, 30 Oct 2015 20:59:03 +0530 Subject: [PATCH 039/843] Staging: lustre: mdc: Declare local functions as static Declare mdc_get_lustre_md, mdc_free_lustre_md and mdc_clear_open_replay_data as static since they are used only in this particular file. Also remove corresponding declarations from header files. Signed-off-by: Shraddha Barke Reviewed-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/mdc/mdc_internal.h | 8 -------- drivers/staging/lustre/lustre/mdc/mdc_request.c | 14 ++++++++------ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_internal.h b/drivers/staging/lustre/lustre/mdc/mdc_internal.h index 29b46f754726..5e0c8b5ca573 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_internal.h +++ b/drivers/staging/lustre/lustre/mdc/mdc_internal.h @@ -104,18 +104,10 @@ int mdc_open(struct obd_export *exp, u64 ino, int type, int flags, struct obd_client_handle; -int mdc_get_lustre_md(struct obd_export *md_exp, struct ptlrpc_request *req, - struct obd_export *dt_exp, struct obd_export *lmv_exp, - struct lustre_md *md); - -int mdc_free_lustre_md(struct obd_export *exp, struct lustre_md *md); - int mdc_set_open_replay_data(struct obd_export *exp, struct obd_client_handle *och, struct lookup_intent *it); -int mdc_clear_open_replay_data(struct obd_export *exp, - struct obd_client_handle *och); void mdc_commit_open(struct ptlrpc_request *req); void mdc_replay_open(struct ptlrpc_request *req); diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 5b78e7ab6d0b..3dd0d01856f1 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -447,9 +447,11 @@ static int mdc_unpack_acl(struct ptlrpc_request *req, struct lustre_md *md) #define mdc_unpack_acl(req, md) 0 #endif -int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req, - struct obd_export *dt_exp, struct obd_export *md_exp, - struct lustre_md *md) +static int mdc_get_lustre_md(struct obd_export *exp, + struct ptlrpc_request *req, + struct obd_export *dt_exp, + struct obd_export *md_exp, + struct lustre_md *md) { struct req_capsule *pill = &req->rq_pill; int rc; @@ -573,7 +575,7 @@ out: return rc; } -int mdc_free_lustre_md(struct obd_export *exp, struct lustre_md *md) +static int mdc_free_lustre_md(struct obd_export *exp, struct lustre_md *md) { return 0; } @@ -737,8 +739,8 @@ static void mdc_free_open(struct md_open_data *mod) ptlrpc_request_committed(mod->mod_close_req, committed); } -int mdc_clear_open_replay_data(struct obd_export *exp, - struct obd_client_handle *och) +static int mdc_clear_open_replay_data(struct obd_export *exp, + struct obd_client_handle *och) { struct md_open_data *mod = och->och_mod; From c3cdad8899c6608a2e928e1ce4fcaaddbf17cc96 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Fri, 30 Oct 2015 20:59:04 +0530 Subject: [PATCH 040/843] Staging: lustre: mdc: Remove unused mdc_open function from header Function mdc_open is declared in header file but it is not used anywhere. Hence drop the declaration. Signed-off-by: Shraddha Barke Reviewed-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/mdc/mdc_internal.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_internal.h b/drivers/staging/lustre/lustre/mdc/mdc_internal.h index 5e0c8b5ca573..a41e2b9396cd 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_internal.h +++ b/drivers/staging/lustre/lustre/mdc/mdc_internal.h @@ -97,11 +97,6 @@ int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid, /* mdc/mdc_request.c */ int mdc_fid_alloc(struct obd_export *exp, struct lu_fid *fid, struct md_op_data *op_data); - -int mdc_open(struct obd_export *exp, u64 ino, int type, int flags, - struct lov_mds_md *lmm, int lmm_size, struct lustre_handle *fh, - struct ptlrpc_request **); - struct obd_client_handle; int mdc_set_open_replay_data(struct obd_export *exp, From bbbc18ebdb23ed82424672f25b35aa84b3cdcad9 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Fri, 30 Oct 2015 20:59:05 +0530 Subject: [PATCH 041/843] Staging: lustre: fld: Remove unused seq_client_alloc_super Remove function seq_client_alloc_super since it is defined but not used. Also remove corresponding declaration from header file. Signed-off-by: Shraddha Barke Reviewed-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/fid/fid_internal.h | 2 -- .../staging/lustre/lustre/fid/fid_request.c | 21 ------------------- 2 files changed, 23 deletions(-) diff --git a/drivers/staging/lustre/lustre/fid/fid_internal.h b/drivers/staging/lustre/lustre/fid/fid_internal.h index 84daee1154dc..b79a813977cf 100644 --- a/drivers/staging/lustre/lustre/fid/fid_internal.h +++ b/drivers/staging/lustre/lustre/fid/fid_internal.h @@ -44,8 +44,6 @@ #include "../../include/linux/libcfs/libcfs.h" /* Functions used internally in module. */ -int seq_client_alloc_super(struct lu_client_seq *seq, - const struct lu_env *env); extern struct lprocfs_vars seq_client_debugfs_list[]; diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c index 7c45e7479087..e8176288452c 100644 --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -142,27 +142,6 @@ out_req: return rc; } -/* Request sequence-controller node to allocate new super-sequence. */ -int seq_client_alloc_super(struct lu_client_seq *seq, - const struct lu_env *env) -{ - int rc; - - mutex_lock(&seq->lcs_mutex); - - /* Check whether the connection to seq controller has been - * setup (lcs_exp != NULL) */ - if (!seq->lcs_exp) { - mutex_unlock(&seq->lcs_mutex); - return -EINPROGRESS; - } - - rc = seq_client_rpc(seq, &seq->lcs_space, - SEQ_ALLOC_SUPER, "super"); - mutex_unlock(&seq->lcs_mutex); - return rc; -} - /* Request sequence-controller node to allocate new meta-sequence. */ static int seq_client_alloc_meta(const struct lu_env *env, struct lu_client_seq *seq) From 741fddbf504815e2e19d02c9a0a73757d8afc594 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Fri, 30 Oct 2015 20:59:06 +0530 Subject: [PATCH 042/843] Staging: lustre: fld: Declare local functions as static Declare fld_cache_entry_delete and fld_cache_insert_nolock as static since they are used only in this particular file. Also remove corresponding declarations from header file. Signed-off-by: Shraddha Barke Reviewed-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/fld/fld_cache.c | 8 ++++---- drivers/staging/lustre/lustre/fld/fld_internal.h | 4 ---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/lustre/fld/fld_cache.c b/drivers/staging/lustre/lustre/fld/fld_cache.c index 446917484637..c4db390a73d5 100644 --- a/drivers/staging/lustre/lustre/fld/fld_cache.c +++ b/drivers/staging/lustre/lustre/fld/fld_cache.c @@ -121,8 +121,8 @@ void fld_cache_fini(struct fld_cache *cache) /** * delete given node from list. */ -void fld_cache_entry_delete(struct fld_cache *cache, - struct fld_cache_entry *node) +static void fld_cache_entry_delete(struct fld_cache *cache, + struct fld_cache_entry *node) { list_del(&node->fce_list); list_del(&node->fce_lru); @@ -377,8 +377,8 @@ struct fld_cache_entry * This function handles all cases of merging and breaking up of * ranges. */ -int fld_cache_insert_nolock(struct fld_cache *cache, - struct fld_cache_entry *f_new) +static int fld_cache_insert_nolock(struct fld_cache *cache, + struct fld_cache_entry *f_new) { struct fld_cache_entry *f_curr; struct fld_cache_entry *n; diff --git a/drivers/staging/lustre/lustre/fld/fld_internal.h b/drivers/staging/lustre/lustre/fld/fld_internal.h index fbb232de6c74..ab184a685287 100644 --- a/drivers/staging/lustre/lustre/fld/fld_internal.h +++ b/drivers/staging/lustre/lustre/fld/fld_internal.h @@ -156,8 +156,6 @@ int fld_cache_insert(struct fld_cache *cache, struct fld_cache_entry *fld_cache_entry_create(const struct lu_seq_range *range); -int fld_cache_insert_nolock(struct fld_cache *cache, - struct fld_cache_entry *f_new); void fld_cache_delete(struct fld_cache *cache, const struct lu_seq_range *range); void fld_cache_delete_nolock(struct fld_cache *cache, @@ -167,8 +165,6 @@ int fld_cache_lookup(struct fld_cache *cache, struct fld_cache_entry* fld_cache_entry_lookup(struct fld_cache *cache, struct lu_seq_range *range); -void fld_cache_entry_delete(struct fld_cache *cache, - struct fld_cache_entry *node); void fld_dump_cache_entries(struct fld_cache *cache); struct fld_cache_entry From 649280ab5bcd1918774b6206f410d08c055341a6 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Fri, 30 Oct 2015 20:59:07 +0530 Subject: [PATCH 043/843] Staging: lustre: fld: Remove unused functions Remove functions fld_cache_delete and fld_cache_delete_nolock since they are defined but not used. Signed-off-by: Shraddha Barke Reviewed-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/fld/fld_cache.c | 26 ------------------- .../staging/lustre/lustre/fld/fld_internal.h | 4 --- 2 files changed, 30 deletions(-) diff --git a/drivers/staging/lustre/lustre/fld/fld_cache.c b/drivers/staging/lustre/lustre/fld/fld_cache.c index c4db390a73d5..baa04074a61f 100644 --- a/drivers/staging/lustre/lustre/fld/fld_cache.c +++ b/drivers/staging/lustre/lustre/fld/fld_cache.c @@ -444,36 +444,10 @@ int fld_cache_insert(struct fld_cache *cache, return rc; } -void fld_cache_delete_nolock(struct fld_cache *cache, - const struct lu_seq_range *range) -{ - struct fld_cache_entry *flde; - struct fld_cache_entry *tmp; - struct list_head *head; - - head = &cache->fci_entries_head; - list_for_each_entry_safe(flde, tmp, head, fce_list) { - /* add list if next is end of list */ - if (range->lsr_start == flde->fce_range.lsr_start || - (range->lsr_end == flde->fce_range.lsr_end && - range->lsr_flags == flde->fce_range.lsr_flags)) { - fld_cache_entry_delete(cache, flde); - break; - } - } -} - /** * Delete FLD entry in FLD cache. * */ -void fld_cache_delete(struct fld_cache *cache, - const struct lu_seq_range *range) -{ - write_lock(&cache->fci_lock); - fld_cache_delete_nolock(cache, range); - write_unlock(&cache->fci_lock); -} struct fld_cache_entry *fld_cache_entry_lookup_nolock(struct fld_cache *cache, diff --git a/drivers/staging/lustre/lustre/fld/fld_internal.h b/drivers/staging/lustre/lustre/fld/fld_internal.h index ab184a685287..88ec7b114caa 100644 --- a/drivers/staging/lustre/lustre/fld/fld_internal.h +++ b/drivers/staging/lustre/lustre/fld/fld_internal.h @@ -156,10 +156,6 @@ int fld_cache_insert(struct fld_cache *cache, struct fld_cache_entry *fld_cache_entry_create(const struct lu_seq_range *range); -void fld_cache_delete(struct fld_cache *cache, - const struct lu_seq_range *range); -void fld_cache_delete_nolock(struct fld_cache *cache, - const struct lu_seq_range *range); int fld_cache_lookup(struct fld_cache *cache, const u64 seq, struct lu_seq_range *range); From 66a9c9a8c2fa23476dc2701a69ad09cc3ecf2146 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Fri, 30 Oct 2015 20:59:08 +0530 Subject: [PATCH 044/843] Staging: lustre: fld: Remove unused declaration Function fld_dump_cache_entries is declared in header file but not used. Hence remove the declaration. Signed-off-by: Shraddha Barke Reviewed-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/fld/fld_internal.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/fld/fld_internal.h b/drivers/staging/lustre/lustre/fld/fld_internal.h index 88ec7b114caa..959b8e6bba95 100644 --- a/drivers/staging/lustre/lustre/fld/fld_internal.h +++ b/drivers/staging/lustre/lustre/fld/fld_internal.h @@ -161,7 +161,6 @@ int fld_cache_lookup(struct fld_cache *cache, struct fld_cache_entry* fld_cache_entry_lookup(struct fld_cache *cache, struct lu_seq_range *range); -void fld_dump_cache_entries(struct fld_cache *cache); struct fld_cache_entry *fld_cache_entry_lookup_nolock(struct fld_cache *cache, From 74d4ec114972d0ea0489db2d1fb772b9d5bd64ce Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Fri, 30 Oct 2015 20:59:09 +0530 Subject: [PATCH 045/843] Staging: lustre: osc: Declare local functions as static Declare osc_real_create, osc_create and osc_cleanup as static since they are used only in this particular file. Also remove the corresponding declarations from header file. Signed-off-by: Shraddha Barke Reviewed-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/osc/osc_internal.h | 6 ------ drivers/staging/lustre/lustre/osc/osc_request.c | 13 +++++++------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_internal.h b/drivers/staging/lustre/lustre/osc/osc_internal.h index 5ed30ecc84e3..db2ee9c23b42 100644 --- a/drivers/staging/lustre/lustre/osc/osc_internal.h +++ b/drivers/staging/lustre/lustre/osc/osc_internal.h @@ -89,11 +89,6 @@ struct osc_cache_waiter { int ocw_rc; }; -int osc_create(const struct lu_env *env, struct obd_export *exp, - struct obdo *oa, struct lov_stripe_md **ea, - struct obd_trans_info *oti); -int osc_real_create(struct obd_export *exp, struct obdo *oa, - struct lov_stripe_md **ea, struct obd_trans_info *oti); void osc_wake_cache_waiters(struct client_obd *cli); int osc_shrink_grant_to_target(struct client_obd *cli, __u64 target_bytes); void osc_update_next_shrink(struct client_obd *cli); @@ -137,7 +132,6 @@ int osc_lru_shrink(struct client_obd *cli, int target); extern spinlock_t osc_ast_guard; -int osc_cleanup(struct obd_device *obd); int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg); int lproc_osc_attach_seqstat(struct obd_device *dev); diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index 18118fcf7d37..cfb3ce2111f8 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -104,7 +104,7 @@ struct osc_enqueue_args { static void osc_release_ppga(struct brw_page **ppga, u32 count); static int brw_interpret(const struct lu_env *env, struct ptlrpc_request *req, void *data, int rc); -int osc_cleanup(struct obd_device *obd); +static int osc_cleanup(struct obd_device *obd); /* Pack OSC object metadata for disk storage (LE byte order). */ static int osc_packmd(struct obd_export *exp, struct lov_mds_md **lmmp, @@ -431,8 +431,9 @@ static int osc_setattr_async(struct obd_export *exp, struct obd_info *oinfo, oinfo->oi_cb_up, oinfo, rqset); } -int osc_real_create(struct obd_export *exp, struct obdo *oa, - struct lov_stripe_md **ea, struct obd_trans_info *oti) +static int osc_real_create(struct obd_export *exp, struct obdo *oa, + struct lov_stripe_md **ea, + struct obd_trans_info *oti) { struct ptlrpc_request *req; struct ost_body *body; @@ -689,9 +690,9 @@ static int osc_can_send_destroy(struct client_obd *cli) return 0; } -int osc_create(const struct lu_env *env, struct obd_export *exp, - struct obdo *oa, struct lov_stripe_md **ea, - struct obd_trans_info *oti) +static int osc_create(const struct lu_env *env, struct obd_export *exp, + struct obdo *oa, struct lov_stripe_md **ea, + struct obd_trans_info *oti) { int rc = 0; From abcf8080eb444a432f9166acac940b19b45907b5 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Sat, 31 Oct 2015 15:58:41 +0530 Subject: [PATCH 046/843] Staging: lustre: lclient: Remove wrapper functions The functions cl_isize_lock and cl_isize_unlock can be replaced with direct calls to ll_inode_size_lock and ll_inode_size_unlock. Thus drop the wrapper functions. Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 4 ++-- drivers/staging/lustre/lustre/llite/llite_internal.h | 10 ---------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c index 0b8e4d2175ae..12c7f0e669d4 100644 --- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c +++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c @@ -427,7 +427,7 @@ static void ccc_object_size_lock(struct cl_object *obj) { struct inode *inode = ccc_object_inode(obj); - cl_isize_lock(inode); + ll_inode_size_lock(inode); cl_object_attr_lock(obj); } @@ -436,7 +436,7 @@ static void ccc_object_size_unlock(struct cl_object *obj) struct inode *inode = ccc_object_inode(obj); cl_object_attr_unlock(obj); - cl_isize_unlock(inode); + ll_inode_size_unlock(inode); } /***************************************************************************** diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 9096d311e45d..157c32840e06 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -1285,16 +1285,6 @@ static inline struct ll_file_data *cl_iattr2fd(struct inode *inode, return LUSTRE_FPRIVATE(attr->ia_file); } -static inline void cl_isize_lock(struct inode *inode) -{ - ll_inode_size_lock(inode); -} - -static inline void cl_isize_unlock(struct inode *inode) -{ - ll_inode_size_unlock(inode); -} - static inline void cl_isize_write_nolock(struct inode *inode, loff_t kms) { LASSERT(mutex_is_locked(&ll_i2info(inode)->lli_size_mutex)); From 1251604b0eb7e58110c5d7fc025b01ecb19de9ef Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Sat, 31 Oct 2015 15:58:42 +0530 Subject: [PATCH 047/843] Staging: lustre: lmv: Remove unused function declaration The function lmv_blocking_ast is declared in header file but not used. Hence remove the declaration. Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lmv/lmv_internal.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/lmv/lmv_internal.h b/drivers/staging/lustre/lustre/lmv/lmv_internal.h index b808728daee7..c8f40d960318 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_internal.h +++ b/drivers/staging/lustre/lustre/lmv/lmv_internal.h @@ -68,8 +68,6 @@ int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data, ldlm_blocking_callback cb_blocking, __u64 extra_lock_flags); -int lmv_blocking_ast(struct ldlm_lock *, struct ldlm_lock_desc *, - void *, int); int lmv_fld_lookup(struct lmv_obd *lmv, const struct lu_fid *fid, u32 *mds); int __lmv_fid_alloc(struct lmv_obd *lmv, struct lu_fid *fid, u32 mds); int lmv_fid_alloc(struct obd_export *exp, struct lu_fid *fid, From c8b3c83e3b8c45083983c89d3ee08d3c5035c4cf Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Sat, 31 Oct 2015 15:58:43 +0530 Subject: [PATCH 048/843] Staging: lustre: lmv: Declare local functions as static Declare functions lmv_intent_open and lmv_intent_lookup as static since they are used only in this particular file. Also remove corresponding declarations from header file. Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/lmv/lmv_intent.c | 21 ++++++++++--------- .../staging/lustre/lustre/lmv/lmv_internal.h | 12 ----------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/drivers/staging/lustre/lustre/lmv/lmv_intent.c b/drivers/staging/lustre/lustre/lmv/lmv_intent.c index eebe45bdceb6..3c585aea5bb8 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_intent.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_intent.c @@ -156,11 +156,11 @@ out: * IT_OPEN is intended to open (and create, possible) an object. Parent (pid) * may be split dir. */ -int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data, - void *lmm, int lmmsize, struct lookup_intent *it, - int flags, struct ptlrpc_request **reqp, - ldlm_blocking_callback cb_blocking, - __u64 extra_lock_flags) +static int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data, + void *lmm, int lmmsize, struct lookup_intent *it, + int flags, struct ptlrpc_request **reqp, + ldlm_blocking_callback cb_blocking, + __u64 extra_lock_flags) { struct obd_device *obd = exp->exp_obd; struct lmv_obd *lmv = &obd->u.lmv; @@ -239,11 +239,12 @@ int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data, /* * Handler for: getattr, lookup and revalidate cases. */ -int lmv_intent_lookup(struct obd_export *exp, struct md_op_data *op_data, - void *lmm, int lmmsize, struct lookup_intent *it, - int flags, struct ptlrpc_request **reqp, - ldlm_blocking_callback cb_blocking, - __u64 extra_lock_flags) +static int lmv_intent_lookup(struct obd_export *exp, + struct md_op_data *op_data, + void *lmm, int lmmsize, struct lookup_intent *it, + int flags, struct ptlrpc_request **reqp, + ldlm_blocking_callback cb_blocking, + __u64 extra_lock_flags) { struct obd_device *obd = exp->exp_obd; struct lmv_obd *lmv = &obd->u.lmv; diff --git a/drivers/staging/lustre/lustre/lmv/lmv_internal.h b/drivers/staging/lustre/lustre/lmv/lmv_internal.h index c8f40d960318..467cfb3e7fca 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_internal.h +++ b/drivers/staging/lustre/lustre/lmv/lmv_internal.h @@ -56,18 +56,6 @@ int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data, ldlm_blocking_callback cb_blocking, __u64 extra_lock_flags); -int lmv_intent_lookup(struct obd_export *exp, struct md_op_data *op_data, - void *lmm, int lmmsize, struct lookup_intent *it, - int flags, struct ptlrpc_request **reqp, - ldlm_blocking_callback cb_blocking, - __u64 extra_lock_flags); - -int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data, - void *lmm, int lmmsize, struct lookup_intent *it, - int flags, struct ptlrpc_request **reqp, - ldlm_blocking_callback cb_blocking, - __u64 extra_lock_flags); - int lmv_fld_lookup(struct lmv_obd *lmv, const struct lu_fid *fid, u32 *mds); int __lmv_fid_alloc(struct lmv_obd *lmv, struct lu_fid *fid, u32 mds); int lmv_fid_alloc(struct obd_export *exp, struct lu_fid *fid, From 4b520fef890f0963e96496ec4291a98e8f4629a3 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Sat, 31 Oct 2015 15:58:44 +0530 Subject: [PATCH 049/843] Staging: lustre: lov: Remove unused function declarations These functions have been declared in header but not used anywhere. Thus drop the declarations. Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lov/lov_internal.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index 515a5c147827..87bc1dcb3515 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -151,14 +151,6 @@ int lov_stripe_number(struct lov_stripe_md *lsm, u64 lov_off); /* lov_qos.c */ #define LOV_USES_ASSIGNED_STRIPE 0 #define LOV_USES_DEFAULT_STRIPE 1 -int qos_add_tgt(struct obd_device *obd, __u32 index); -int qos_del_tgt(struct obd_device *obd, struct lov_tgt_desc *tgt); -void qos_shrink_lsm(struct lov_request_set *set); -int qos_prep_create(struct obd_export *exp, struct lov_request_set *set); -void qos_update(struct lov_obd *lov); -void qos_statfs_done(struct lov_obd *lov); -void qos_statfs_update(struct obd_device *obd, __u64 max_age, int wait); -int qos_remedy_create(struct lov_request_set *set, struct lov_request *req); /* lov_request.c */ void lov_set_add_req(struct lov_request *req, struct lov_request_set *set); From 2408e54dcab7f6faa0099a3cc0f67e2e823c2321 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Sat, 31 Oct 2015 15:58:45 +0530 Subject: [PATCH 050/843] Staging: lustre: lov: Declare local functions as static Declare functions lov_set_add_req, lov_set_finished, lov_update_set, lov_check_and_wait_active and lov_update_statfs as static since they are used only in this particular file. Also remove corresponding declarations from header file. Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lov/lov_internal.h | 7 ------- drivers/staging/lustre/lustre/lov/lov_request.c | 16 +++++++++------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index 87bc1dcb3515..b8028735e568 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -153,13 +153,8 @@ int lov_stripe_number(struct lov_stripe_md *lsm, u64 lov_off); #define LOV_USES_DEFAULT_STRIPE 1 /* lov_request.c */ -void lov_set_add_req(struct lov_request *req, struct lov_request_set *set); -int lov_set_finished(struct lov_request_set *set, int idempotent); -void lov_update_set(struct lov_request_set *set, - struct lov_request *req, int rc); int lov_update_common_set(struct lov_request_set *set, struct lov_request *req, int rc); -int lov_check_and_wait_active(struct lov_obd *lov, int ost_idx); int lov_prep_getattr_set(struct obd_export *exp, struct obd_info *oinfo, struct lov_request_set **reqset); int lov_fini_getattr_set(struct lov_request_set *set); @@ -176,8 +171,6 @@ int lov_update_setattr_set(struct lov_request_set *set, int lov_fini_setattr_set(struct lov_request_set *set); int lov_prep_statfs_set(struct obd_device *obd, struct obd_info *oinfo, struct lov_request_set **reqset); -void lov_update_statfs(struct obd_statfs *osfs, struct obd_statfs *lov_sfs, - int success); int lov_fini_statfs(struct obd_device *obd, struct obd_statfs *osfs, int success); int lov_fini_statfs_set(struct lov_request_set *set); diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c index 1a150c26798d..bb1a03fef60d 100644 --- a/drivers/staging/lustre/lustre/lov/lov_request.c +++ b/drivers/staging/lustre/lustre/lov/lov_request.c @@ -74,7 +74,7 @@ void lov_finish_set(struct lov_request_set *set) kfree(set); } -int lov_set_finished(struct lov_request_set *set, int idempotent) +static int lov_set_finished(struct lov_request_set *set, int idempotent) { int completes = atomic_read(&set->set_completes); @@ -89,8 +89,8 @@ int lov_set_finished(struct lov_request_set *set, int idempotent) return 0; } -void lov_update_set(struct lov_request_set *set, - struct lov_request *req, int rc) +static void lov_update_set(struct lov_request_set *set, + struct lov_request *req, int rc) { req->rq_complete = 1; req->rq_rc = rc; @@ -118,7 +118,8 @@ int lov_update_common_set(struct lov_request_set *set, return rc; } -void lov_set_add_req(struct lov_request *req, struct lov_request_set *set) +static void lov_set_add_req(struct lov_request *req, + struct lov_request_set *set) { list_add_tail(&req->rq_link, &set->set_list); set->set_count++; @@ -144,7 +145,7 @@ static int lov_check_set(struct lov_obd *lov, int idx) * If the OSC has not yet had a chance to connect to the OST the first time, * wait once for it to connect instead of returning an error. */ -int lov_check_and_wait_active(struct lov_obd *lov, int ost_idx) +static int lov_check_and_wait_active(struct lov_obd *lov, int ost_idx) { wait_queue_head_t waitq; struct l_wait_info lwi; @@ -591,8 +592,9 @@ int lov_fini_statfs_set(struct lov_request_set *set) return rc; } -void lov_update_statfs(struct obd_statfs *osfs, struct obd_statfs *lov_sfs, - int success) +static void lov_update_statfs(struct obd_statfs *osfs, + struct obd_statfs *lov_sfs, + int success) { int shift = 0, quit = 0; __u64 tmp; From ae0c6f01f3686a1a0dac6f27505f1365102bf5a3 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Sat, 31 Oct 2015 15:58:46 +0530 Subject: [PATCH 051/843] Staging: lustre: mdc: Remove unused declarations The functions mdc_pack_req and mdc_getxattr_pack have been declared in header file but not used. Thus remove the declarations. Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/mdc/mdc_internal.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_internal.h b/drivers/staging/lustre/lustre/mdc/mdc_internal.h index a41e2b9396cd..df50bdbcde19 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_internal.h +++ b/drivers/staging/lustre/lustre/mdc/mdc_internal.h @@ -44,7 +44,6 @@ void lprocfs_mdc_init_vars(struct lprocfs_static_vars *lvars); void mdc_pack_body(struct ptlrpc_request *req, const struct lu_fid *fid, __u64 valid, int ea_size, __u32 suppgid, int flags); -int mdc_pack_req(struct ptlrpc_request *req, int version, int opc); void mdc_is_subdir_pack(struct ptlrpc_request *req, const struct lu_fid *pfid, const struct lu_fid *cfid, int flags); void mdc_swap_layouts_pack(struct ptlrpc_request *req, @@ -62,7 +61,6 @@ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data, __u32 mode, __u64 rdev, __u64 flags, const void *data, int datalen); void mdc_unlink_pack(struct ptlrpc_request *req, struct md_op_data *op_data); -void mdc_getxattr_pack(struct ptlrpc_request *req, struct md_op_data *op_data); void mdc_link_pack(struct ptlrpc_request *req, struct md_op_data *op_data); void mdc_rename_pack(struct ptlrpc_request *req, struct md_op_data *op_data, const char *old, int oldlen, const char *new, int newlen); From 5d21c5a8835795ce8cbd87e5f08b266094a54863 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Sat, 31 Oct 2015 20:26:56 +0530 Subject: [PATCH 052/843] Staging: lustre: Drop wrapper functions Remove the functions node_equal() and node_compare() and replace their calls with appropriate functions. Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/ldlm/interval_tree.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/interval_tree.c b/drivers/staging/lustre/lustre/ldlm/interval_tree.c index 39b571721881..a2ea8e5b93d8 100644 --- a/drivers/staging/lustre/lustre/ldlm/interval_tree.c +++ b/drivers/staging/lustre/lustre/ldlm/interval_tree.c @@ -96,18 +96,6 @@ static inline int extent_equal(struct interval_node_extent *e1, return (e1->start == e2->start) && (e1->end == e2->end); } -static inline int node_compare(struct interval_node *n1, - struct interval_node *n2) -{ - return extent_compare(&n1->in_extent, &n2->in_extent); -} - -static inline int node_equal(struct interval_node *n1, - struct interval_node *n2) -{ - return extent_equal(&n1->in_extent, &n2->in_extent); -} - static inline __u64 max_u64(__u64 x, __u64 y) { return x > y ? x : y; @@ -278,14 +266,14 @@ struct interval_node *interval_insert(struct interval_node *node, p = root; while (*p) { parent = *p; - if (node_equal(parent, node)) + if (extent_equal(&parent->in_extent, &node->in_extent)) return parent; /* max_high field must be updated after each iteration */ if (parent->in_max_high < interval_high(node)) parent->in_max_high = interval_high(node); - if (node_compare(node, parent) < 0) + if (extent_compare(&node->in_extent, &parent->in_extent) < 0) p = &parent->in_left; else p = &parent->in_right; From bf2ca1b1bc926016bf496b0f13eebd584c41d7a1 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Thu, 29 Oct 2015 17:35:17 -0400 Subject: [PATCH 053/843] staging: lustre: remove white space in libcfs_hash.h Cleanup all the unneeded white space in libcfs_hash.h. Signed-off-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- .../lustre/include/linux/libcfs/libcfs_hash.h | 135 +++++++++--------- 1 file changed, 70 insertions(+), 65 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h index 70b8b29e831c..4d73f8a2c6d1 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h @@ -66,12 +66,12 @@ #include /** disable debug */ -#define CFS_HASH_DEBUG_NONE 0 +#define CFS_HASH_DEBUG_NONE 0 /** record hash depth and output to console when it's too deep, * computing overhead is low but consume more memory */ -#define CFS_HASH_DEBUG_1 1 +#define CFS_HASH_DEBUG_1 1 /** expensive, check key validation */ -#define CFS_HASH_DEBUG_2 2 +#define CFS_HASH_DEBUG_2 2 #define CFS_HASH_DEBUG_LEVEL CFS_HASH_DEBUG_NONE @@ -108,16 +108,18 @@ struct cfs_hash_bucket { * cfs_hash bucket descriptor, it's normally in stack of caller */ struct cfs_hash_bd { - struct cfs_hash_bucket *bd_bucket; /**< address of bucket */ - unsigned int bd_offset; /**< offset in bucket */ + /* address of bucket */ + struct cfs_hash_bucket *bd_bucket; + /* offset in bucket */ + unsigned int bd_offset; }; -#define CFS_HASH_NAME_LEN 16 /**< default name length */ -#define CFS_HASH_BIGNAME_LEN 64 /**< bigname for param tree */ +#define CFS_HASH_NAME_LEN 16 /**< default name length */ +#define CFS_HASH_BIGNAME_LEN 64 /**< bigname for param tree */ -#define CFS_HASH_BKT_BITS 3 /**< default bits of bucket */ -#define CFS_HASH_BITS_MAX 30 /**< max bits of bucket */ -#define CFS_HASH_BITS_MIN CFS_HASH_BKT_BITS +#define CFS_HASH_BKT_BITS 3 /**< default bits of bucket */ +#define CFS_HASH_BITS_MAX 30 /**< max bits of bucket */ +#define CFS_HASH_BITS_MIN CFS_HASH_BKT_BITS /** * common hash attributes. @@ -133,41 +135,41 @@ enum cfs_hash_tag { */ CFS_HASH_NO_LOCK = 1 << 0, /** no bucket lock, use one spinlock to protect the whole hash */ - CFS_HASH_NO_BKTLOCK = 1 << 1, + CFS_HASH_NO_BKTLOCK = 1 << 1, /** rwlock to protect bucket */ - CFS_HASH_RW_BKTLOCK = 1 << 2, + CFS_HASH_RW_BKTLOCK = 1 << 2, /** spinlock to protect bucket */ - CFS_HASH_SPIN_BKTLOCK = 1 << 3, + CFS_HASH_SPIN_BKTLOCK = 1 << 3, /** always add new item to tail */ - CFS_HASH_ADD_TAIL = 1 << 4, + CFS_HASH_ADD_TAIL = 1 << 4, /** hash-table doesn't have refcount on item */ - CFS_HASH_NO_ITEMREF = 1 << 5, + CFS_HASH_NO_ITEMREF = 1 << 5, /** big name for param-tree */ CFS_HASH_BIGNAME = 1 << 6, /** track global count */ CFS_HASH_COUNTER = 1 << 7, /** rehash item by new key */ - CFS_HASH_REHASH_KEY = 1 << 8, + CFS_HASH_REHASH_KEY = 1 << 8, /** Enable dynamic hash resizing */ - CFS_HASH_REHASH = 1 << 9, + CFS_HASH_REHASH = 1 << 9, /** can shrink hash-size */ - CFS_HASH_SHRINK = 1 << 10, + CFS_HASH_SHRINK = 1 << 10, /** assert hash is empty on exit */ - CFS_HASH_ASSERT_EMPTY = 1 << 11, + CFS_HASH_ASSERT_EMPTY = 1 << 11, /** record hlist depth */ - CFS_HASH_DEPTH = 1 << 12, + CFS_HASH_DEPTH = 1 << 12, /** * rehash is always scheduled in a different thread, so current * change on hash table is non-blocking */ - CFS_HASH_NBLK_CHANGE = 1 << 13, + CFS_HASH_NBLK_CHANGE = 1 << 13, /** NB, we typed hs_flags as __u16, please change it * if you need to extend >=16 flags */ }; /** most used attributes */ -#define CFS_HASH_DEFAULT (CFS_HASH_RW_BKTLOCK | \ - CFS_HASH_COUNTER | CFS_HASH_REHASH) +#define CFS_HASH_DEFAULT (CFS_HASH_RW_BKTLOCK | \ + CFS_HASH_COUNTER | CFS_HASH_REHASH) /** * cfs_hash is a hash-table implementation for general purpose, it can support: @@ -211,7 +213,7 @@ enum cfs_hash_tag { struct cfs_hash { /** serialize with rehash, or serialize all operations if * the hash-table has CFS_HASH_NO_BKTLOCK */ - union cfs_hash_lock hs_lock; + union cfs_hash_lock hs_lock; /** hash operations */ struct cfs_hash_ops *hs_ops; /** hash lock operations */ @@ -219,57 +221,57 @@ struct cfs_hash { /** hash list operations */ struct cfs_hash_hlist_ops *hs_hops; /** hash buckets-table */ - struct cfs_hash_bucket **hs_buckets; + struct cfs_hash_bucket **hs_buckets; /** total number of items on this hash-table */ - atomic_t hs_count; + atomic_t hs_count; /** hash flags, see cfs_hash_tag for detail */ - __u16 hs_flags; + __u16 hs_flags; /** # of extra-bytes for bucket, for user saving extended attributes */ - __u16 hs_extra_bytes; + __u16 hs_extra_bytes; /** wants to iterate */ - __u8 hs_iterating; + __u8 hs_iterating; /** hash-table is dying */ - __u8 hs_exiting; + __u8 hs_exiting; /** current hash bits */ - __u8 hs_cur_bits; + __u8 hs_cur_bits; /** min hash bits */ - __u8 hs_min_bits; + __u8 hs_min_bits; /** max hash bits */ - __u8 hs_max_bits; + __u8 hs_max_bits; /** bits for rehash */ - __u8 hs_rehash_bits; + __u8 hs_rehash_bits; /** bits for each bucket */ - __u8 hs_bkt_bits; + __u8 hs_bkt_bits; /** resize min threshold */ - __u16 hs_min_theta; + __u16 hs_min_theta; /** resize max threshold */ - __u16 hs_max_theta; + __u16 hs_max_theta; /** resize count */ - __u32 hs_rehash_count; + __u32 hs_rehash_count; /** # of iterators (caller of cfs_hash_for_each_*) */ - __u32 hs_iterators; + __u32 hs_iterators; /** rehash workitem */ - cfs_workitem_t hs_rehash_wi; + cfs_workitem_t hs_rehash_wi; /** refcount on this hash table */ - atomic_t hs_refcount; + atomic_t hs_refcount; /** rehash buckets-table */ - struct cfs_hash_bucket **hs_rehash_buckets; + struct cfs_hash_bucket **hs_rehash_buckets; #if CFS_HASH_DEBUG_LEVEL >= CFS_HASH_DEBUG_1 /** serialize debug members */ spinlock_t hs_dep_lock; /** max depth */ - unsigned int hs_dep_max; + unsigned int hs_dep_max; /** id of the deepest bucket */ - unsigned int hs_dep_bkt; + unsigned int hs_dep_bkt; /** offset in the deepest bucket */ - unsigned int hs_dep_off; + unsigned int hs_dep_off; /** bits when we found the max depth */ - unsigned int hs_dep_bits; + unsigned int hs_dep_bits; /** workitem to output max depth */ - cfs_workitem_t hs_dep_wi; + cfs_workitem_t hs_dep_wi; #endif /** name of htable */ - char hs_name[0]; + char hs_name[0]; }; struct cfs_hash_lock_ops { @@ -324,11 +326,11 @@ struct cfs_hash_ops { }; /** total number of buckets in @hs */ -#define CFS_HASH_NBKT(hs) \ +#define CFS_HASH_NBKT(hs) \ (1U << ((hs)->hs_cur_bits - (hs)->hs_bkt_bits)) /** total number of buckets in @hs while rehashing */ -#define CFS_HASH_RH_NBKT(hs) \ +#define CFS_HASH_RH_NBKT(hs) \ (1U << ((hs)->hs_rehash_bits - (hs)->hs_bkt_bits)) /** number of hlist for in bucket */ @@ -433,19 +435,22 @@ cfs_hash_with_nblk_change(struct cfs_hash *hs) static inline int cfs_hash_is_exiting(struct cfs_hash *hs) -{ /* cfs_hash_destroy is called */ +{ + /* cfs_hash_destroy is called */ return hs->hs_exiting; } static inline int cfs_hash_is_rehashing(struct cfs_hash *hs) -{ /* rehash is launched */ +{ + /* rehash is launched */ return hs->hs_rehash_bits != 0; } static inline int cfs_hash_is_iterating(struct cfs_hash *hs) -{ /* someone is calling cfs_hash_for_each_* */ +{ + /* someone is calling cfs_hash_for_each_* */ return hs->hs_iterating || hs->hs_iterators != 0; } @@ -758,7 +763,7 @@ static inline void cfs_hash_bucket_validate(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnode) { - struct cfs_hash_bd bds[2]; + struct cfs_hash_bd bds[2]; cfs_hash_dual_bd_get(hs, cfs_hash_key(hs, hnode), bds); LASSERT(bds[0].bd_bucket == bd->bd_bucket || @@ -777,9 +782,9 @@ cfs_hash_bucket_validate(struct cfs_hash *hs, struct cfs_hash_bd *bd, #endif /* CFS_HASH_DEBUG_LEVEL */ -#define CFS_HASH_THETA_BITS 10 -#define CFS_HASH_MIN_THETA (1U << (CFS_HASH_THETA_BITS - 1)) -#define CFS_HASH_MAX_THETA (1U << (CFS_HASH_THETA_BITS + 1)) +#define CFS_HASH_THETA_BITS 10 +#define CFS_HASH_MIN_THETA (1U << (CFS_HASH_THETA_BITS - 1)) +#define CFS_HASH_MAX_THETA (1U << (CFS_HASH_THETA_BITS + 1)) /* Return integer component of theta */ static inline int __cfs_hash_theta_int(int theta) @@ -848,20 +853,20 @@ cfs_hash_u64_hash(const __u64 key, unsigned mask) } /** iterate over all buckets in @bds (array of struct cfs_hash_bd) */ -#define cfs_hash_for_each_bd(bds, n, i) \ +#define cfs_hash_for_each_bd(bds, n, i) \ for (i = 0; i < n && (bds)[i].bd_bucket != NULL; i++) /** iterate over all buckets of @hs */ -#define cfs_hash_for_each_bucket(hs, bd, pos) \ - for (pos = 0; \ - pos < CFS_HASH_NBKT(hs) && \ +#define cfs_hash_for_each_bucket(hs, bd, pos) \ + for (pos = 0; \ + pos < CFS_HASH_NBKT(hs) && \ ((bd)->bd_bucket = (hs)->hs_buckets[pos]) != NULL; pos++) /** iterate over all hlist of bucket @bd */ -#define cfs_hash_bd_for_each_hlist(hs, bd, hlist) \ - for ((bd)->bd_offset = 0; \ - (bd)->bd_offset < CFS_HASH_BKT_NHLIST(hs) && \ - (hlist = cfs_hash_bd_hhead(hs, bd)) != NULL; \ +#define cfs_hash_bd_for_each_hlist(hs, bd, hlist) \ + for ((bd)->bd_offset = 0; \ + (bd)->bd_offset < CFS_HASH_BKT_NHLIST(hs) && \ + (hlist = cfs_hash_bd_hhead(hs, bd)) != NULL; \ (bd)->bd_offset++) /* !__LIBCFS__HASH_H__ */ From 9600d8f80b378e8eae0b55edf937b087d1e4c032 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Thu, 29 Oct 2015 17:35:18 -0400 Subject: [PATCH 054/843] staging: lustre: remove obsolete comment in libcfs_hash.h Remove comment hash_long which was removed long ago. Signed-off-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h index 4d73f8a2c6d1..4a78e6d8dc1f 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h @@ -56,13 +56,6 @@ /* 2^63 + 2^61 - 2^57 + 2^54 - 2^51 - 2^18 + 1 */ #define CFS_GOLDEN_RATIO_PRIME_64 0x9e37fffffffc0001ULL -/* - * Ideally we would use HAVE_HASH_LONG for this, but on linux we configure - * the linux kernel and user space at the same time, so we need to differentiate - * between them explicitly. If this is not needed on other architectures, then - * we'll need to move the functions to architecture specific headers. - */ - #include /** disable debug */ From 12550e0cab229fd24241e4950c075361aad76b27 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Thu, 29 Oct 2015 17:35:19 -0400 Subject: [PATCH 055/843] staging: lustre: move linux hash.h header to start of libcfs_hash.h Minor style cleanup to put hash.h header to the top of the libcfs_hash.h file. Signed-off-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h index 4a78e6d8dc1f..2e0c89228013 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h @@ -41,6 +41,9 @@ #ifndef __LIBCFS_HASH_H__ #define __LIBCFS_HASH_H__ + +#include + /* * Knuth recommends primes in approximately golden ratio to the maximum * integer representable by a machine word for multiplicative hashing. @@ -56,8 +59,6 @@ /* 2^63 + 2^61 - 2^57 + 2^54 - 2^51 - 2^18 + 1 */ #define CFS_GOLDEN_RATIO_PRIME_64 0x9e37fffffffc0001ULL -#include - /** disable debug */ #define CFS_HASH_DEBUG_NONE 0 /** record hash depth and output to console when it's too deep, From b2f005f7157eb77e6992206f5739effc0051a27a Mon Sep 17 00:00:00 2001 From: James Simmons Date: Thu, 29 Oct 2015 17:35:21 -0400 Subject: [PATCH 056/843] staging: lustre: remove white space in hash.c Cleanup all the unneeded white space in hash.c. Signed-off-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/hash.c | 342 ++++++++++---------- 1 file changed, 177 insertions(+), 165 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index 030874428952..ed4e1f1c4307 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -161,49 +161,49 @@ cfs_hash_rw_unlock(union cfs_hash_lock *lock, int exclusive) /** No lock hash */ static struct cfs_hash_lock_ops cfs_hash_nl_lops = { .hs_lock = cfs_hash_nl_lock, - .hs_unlock = cfs_hash_nl_unlock, - .hs_bkt_lock = cfs_hash_nl_lock, - .hs_bkt_unlock = cfs_hash_nl_unlock, + .hs_unlock = cfs_hash_nl_unlock, + .hs_bkt_lock = cfs_hash_nl_lock, + .hs_bkt_unlock = cfs_hash_nl_unlock, }; /** no bucket lock, one spinlock to protect everything */ static struct cfs_hash_lock_ops cfs_hash_nbl_lops = { .hs_lock = cfs_hash_spin_lock, - .hs_unlock = cfs_hash_spin_unlock, - .hs_bkt_lock = cfs_hash_nl_lock, - .hs_bkt_unlock = cfs_hash_nl_unlock, + .hs_unlock = cfs_hash_spin_unlock, + .hs_bkt_lock = cfs_hash_nl_lock, + .hs_bkt_unlock = cfs_hash_nl_unlock, }; /** spin bucket lock, rehash is enabled */ static struct cfs_hash_lock_ops cfs_hash_bkt_spin_lops = { .hs_lock = cfs_hash_rw_lock, - .hs_unlock = cfs_hash_rw_unlock, - .hs_bkt_lock = cfs_hash_spin_lock, - .hs_bkt_unlock = cfs_hash_spin_unlock, + .hs_unlock = cfs_hash_rw_unlock, + .hs_bkt_lock = cfs_hash_spin_lock, + .hs_bkt_unlock = cfs_hash_spin_unlock, }; /** rw bucket lock, rehash is enabled */ static struct cfs_hash_lock_ops cfs_hash_bkt_rw_lops = { .hs_lock = cfs_hash_rw_lock, - .hs_unlock = cfs_hash_rw_unlock, - .hs_bkt_lock = cfs_hash_rw_lock, - .hs_bkt_unlock = cfs_hash_rw_unlock, + .hs_unlock = cfs_hash_rw_unlock, + .hs_bkt_lock = cfs_hash_rw_lock, + .hs_bkt_unlock = cfs_hash_rw_unlock, }; /** spin bucket lock, rehash is disabled */ static struct cfs_hash_lock_ops cfs_hash_nr_bkt_spin_lops = { .hs_lock = cfs_hash_nl_lock, - .hs_unlock = cfs_hash_nl_unlock, - .hs_bkt_lock = cfs_hash_spin_lock, - .hs_bkt_unlock = cfs_hash_spin_unlock, + .hs_unlock = cfs_hash_nl_unlock, + .hs_bkt_lock = cfs_hash_spin_lock, + .hs_bkt_unlock = cfs_hash_spin_unlock, }; /** rw bucket lock, rehash is disabled */ static struct cfs_hash_lock_ops cfs_hash_nr_bkt_rw_lops = { .hs_lock = cfs_hash_nl_lock, - .hs_unlock = cfs_hash_nl_unlock, - .hs_bkt_lock = cfs_hash_rw_lock, - .hs_bkt_unlock = cfs_hash_rw_unlock, + .hs_unlock = cfs_hash_nl_unlock, + .hs_bkt_lock = cfs_hash_rw_lock, + .hs_bkt_unlock = cfs_hash_rw_unlock, }; static void @@ -280,7 +280,7 @@ cfs_hash_hh_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd, */ struct cfs_hash_head_dep { struct hlist_head hd_head; /**< entries list */ - unsigned int hd_depth; /**< list length */ + unsigned int hd_depth; /**< list length */ }; static int @@ -328,7 +328,7 @@ cfs_hash_hd_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd, */ struct cfs_hash_dhead { struct hlist_head dh_head; /**< entries list */ - struct hlist_node *dh_tail; /**< the last entry */ + struct hlist_node *dh_tail; /**< the last entry */ }; static int @@ -384,8 +384,8 @@ cfs_hash_dh_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd, */ struct cfs_hash_dhead_dep { struct hlist_head dd_head; /**< entries list */ - struct hlist_node *dd_tail; /**< the last entry */ - unsigned int dd_depth; /**< list length */ + struct hlist_node *dd_tail; /**< the last entry */ + unsigned int dd_depth; /**< list length */ }; static int @@ -436,31 +436,31 @@ cfs_hash_dd_hnode_del(struct cfs_hash *hs, struct cfs_hash_bd *bd, } static struct cfs_hash_hlist_ops cfs_hash_hh_hops = { - .hop_hhead = cfs_hash_hh_hhead, - .hop_hhead_size = cfs_hash_hh_hhead_size, - .hop_hnode_add = cfs_hash_hh_hnode_add, - .hop_hnode_del = cfs_hash_hh_hnode_del, + .hop_hhead = cfs_hash_hh_hhead, + .hop_hhead_size = cfs_hash_hh_hhead_size, + .hop_hnode_add = cfs_hash_hh_hnode_add, + .hop_hnode_del = cfs_hash_hh_hnode_del, }; static struct cfs_hash_hlist_ops cfs_hash_hd_hops = { - .hop_hhead = cfs_hash_hd_hhead, - .hop_hhead_size = cfs_hash_hd_hhead_size, - .hop_hnode_add = cfs_hash_hd_hnode_add, - .hop_hnode_del = cfs_hash_hd_hnode_del, + .hop_hhead = cfs_hash_hd_hhead, + .hop_hhead_size = cfs_hash_hd_hhead_size, + .hop_hnode_add = cfs_hash_hd_hnode_add, + .hop_hnode_del = cfs_hash_hd_hnode_del, }; static struct cfs_hash_hlist_ops cfs_hash_dh_hops = { - .hop_hhead = cfs_hash_dh_hhead, - .hop_hhead_size = cfs_hash_dh_hhead_size, - .hop_hnode_add = cfs_hash_dh_hnode_add, - .hop_hnode_del = cfs_hash_dh_hnode_del, + .hop_hhead = cfs_hash_dh_hhead, + .hop_hhead_size = cfs_hash_dh_hhead_size, + .hop_hnode_add = cfs_hash_dh_hnode_add, + .hop_hnode_del = cfs_hash_dh_hnode_del, }; static struct cfs_hash_hlist_ops cfs_hash_dd_hops = { - .hop_hhead = cfs_hash_dd_hhead, - .hop_hhead_size = cfs_hash_dd_hhead_size, - .hop_hnode_add = cfs_hash_dd_hnode_add, - .hop_hnode_del = cfs_hash_dd_hnode_del, + .hop_hhead = cfs_hash_dd_hhead, + .hop_hhead_size = cfs_hash_dd_hhead_size, + .hop_hnode_add = cfs_hash_dd_hnode_add, + .hop_hnode_del = cfs_hash_dd_hnode_del, }; static void @@ -529,7 +529,7 @@ void cfs_hash_bd_add_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnode) { - int rc; + int rc; rc = hs->hs_hops->hop_hnode_add(hs, bd, hnode); cfs_hash_bd_dep_record(hs, bd, rc); @@ -572,7 +572,7 @@ cfs_hash_bd_move_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd_old, { struct cfs_hash_bucket *obkt = bd_old->bd_bucket; struct cfs_hash_bucket *nbkt = bd_new->bd_bucket; - int rc; + int rc; if (cfs_hash_bd_compare(bd_old, bd_new) == 0) return; @@ -597,30 +597,30 @@ EXPORT_SYMBOL(cfs_hash_bd_move_locked); enum { /** always set, for sanity (avoid ZERO intent) */ - CFS_HS_LOOKUP_MASK_FIND = BIT(0), + CFS_HS_LOOKUP_MASK_FIND = BIT(0), /** return entry with a ref */ - CFS_HS_LOOKUP_MASK_REF = BIT(1), + CFS_HS_LOOKUP_MASK_REF = BIT(1), /** add entry if not existing */ - CFS_HS_LOOKUP_MASK_ADD = BIT(2), + CFS_HS_LOOKUP_MASK_ADD = BIT(2), /** delete entry, ignore other masks */ - CFS_HS_LOOKUP_MASK_DEL = BIT(3), + CFS_HS_LOOKUP_MASK_DEL = BIT(3), }; enum cfs_hash_lookup_intent { /** return item w/o refcount */ - CFS_HS_LOOKUP_IT_PEEK = CFS_HS_LOOKUP_MASK_FIND, + CFS_HS_LOOKUP_IT_PEEK = CFS_HS_LOOKUP_MASK_FIND, /** return item with refcount */ - CFS_HS_LOOKUP_IT_FIND = (CFS_HS_LOOKUP_MASK_FIND | - CFS_HS_LOOKUP_MASK_REF), + CFS_HS_LOOKUP_IT_FIND = (CFS_HS_LOOKUP_MASK_FIND | + CFS_HS_LOOKUP_MASK_REF), /** return item w/o refcount if existed, otherwise add */ - CFS_HS_LOOKUP_IT_ADD = (CFS_HS_LOOKUP_MASK_FIND | - CFS_HS_LOOKUP_MASK_ADD), + CFS_HS_LOOKUP_IT_ADD = (CFS_HS_LOOKUP_MASK_FIND | + CFS_HS_LOOKUP_MASK_ADD), /** return item with refcount if existed, otherwise add */ - CFS_HS_LOOKUP_IT_FINDADD = (CFS_HS_LOOKUP_IT_FIND | - CFS_HS_LOOKUP_MASK_ADD), + CFS_HS_LOOKUP_IT_FINDADD = (CFS_HS_LOOKUP_IT_FIND | + CFS_HS_LOOKUP_MASK_ADD), /** delete if existed */ - CFS_HS_LOOKUP_IT_FINDDEL = (CFS_HS_LOOKUP_MASK_FIND | - CFS_HS_LOOKUP_MASK_DEL) + CFS_HS_LOOKUP_IT_FINDDEL = (CFS_HS_LOOKUP_MASK_FIND | + CFS_HS_LOOKUP_MASK_DEL) }; static struct hlist_node * @@ -629,10 +629,10 @@ cfs_hash_bd_lookup_intent(struct cfs_hash *hs, struct cfs_hash_bd *bd, enum cfs_hash_lookup_intent intent) { - struct hlist_head *hhead = cfs_hash_bd_hhead(hs, bd); - struct hlist_node *ehnode; - struct hlist_node *match; - int intent_add = (intent & CFS_HS_LOOKUP_MASK_ADD) != 0; + struct hlist_head *hhead = cfs_hash_bd_hhead(hs, bd); + struct hlist_node *ehnode; + struct hlist_node *match; + int intent_add = (intent & CFS_HS_LOOKUP_MASK_ADD) != 0; /* with this function, we can avoid a lot of useless refcount ops, * which are expensive atomic operations most time. */ @@ -665,7 +665,8 @@ cfs_hash_bd_lookup_intent(struct cfs_hash *hs, struct cfs_hash_bd *bd, } struct hlist_node * -cfs_hash_bd_lookup_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, const void *key) +cfs_hash_bd_lookup_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, + const void *key) { return cfs_hash_bd_lookup_intent(hs, bd, key, NULL, CFS_HS_LOOKUP_IT_FIND); @@ -673,7 +674,8 @@ cfs_hash_bd_lookup_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, const voi EXPORT_SYMBOL(cfs_hash_bd_lookup_locked); struct hlist_node * -cfs_hash_bd_peek_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, const void *key) +cfs_hash_bd_peek_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, + const void *key) { return cfs_hash_bd_lookup_intent(hs, bd, key, NULL, CFS_HS_LOOKUP_IT_PEEK); @@ -706,7 +708,7 @@ cfs_hash_multi_bd_lock(struct cfs_hash *hs, struct cfs_hash_bd *bds, unsigned n, int excl) { struct cfs_hash_bucket *prev = NULL; - int i; + int i; /** * bds must be ascendantly ordered by bd->bd_bucket->hsb_index. @@ -729,7 +731,7 @@ cfs_hash_multi_bd_unlock(struct cfs_hash *hs, struct cfs_hash_bd *bds, unsigned n, int excl) { struct cfs_hash_bucket *prev = NULL; - int i; + int i; cfs_hash_for_each_bd(bds, n, i) { if (prev != bds[i].bd_bucket) { @@ -743,8 +745,8 @@ static struct hlist_node * cfs_hash_multi_bd_lookup_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, unsigned n, const void *key) { - struct hlist_node *ehnode; - unsigned i; + struct hlist_node *ehnode; + unsigned i; cfs_hash_for_each_bd(bds, n, i) { ehnode = cfs_hash_bd_lookup_intent(hs, &bds[i], key, NULL, @@ -756,13 +758,13 @@ cfs_hash_multi_bd_lookup_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, } static struct hlist_node * -cfs_hash_multi_bd_findadd_locked(struct cfs_hash *hs, - struct cfs_hash_bd *bds, unsigned n, const void *key, +cfs_hash_multi_bd_findadd_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, + unsigned n, const void *key, struct hlist_node *hnode, int noref) { - struct hlist_node *ehnode; - int intent; - unsigned i; + struct hlist_node *ehnode; + int intent; + unsigned i; LASSERT(hnode != NULL); intent = (!noref * CFS_HS_LOOKUP_MASK_REF) | CFS_HS_LOOKUP_IT_PEEK; @@ -777,7 +779,7 @@ cfs_hash_multi_bd_findadd_locked(struct cfs_hash *hs, if (i == 1) { /* only one bucket */ cfs_hash_bd_add_locked(hs, &bds[0], hnode); } else { - struct cfs_hash_bd mybd; + struct cfs_hash_bd mybd; cfs_hash_bd_get(hs, key, &mybd); cfs_hash_bd_add_locked(hs, &mybd, hnode); @@ -791,8 +793,8 @@ cfs_hash_multi_bd_finddel_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, unsigned n, const void *key, struct hlist_node *hnode) { - struct hlist_node *ehnode; - unsigned i; + struct hlist_node *ehnode; + unsigned int i; cfs_hash_for_each_bd(bds, n, i) { ehnode = cfs_hash_bd_lookup_intent(hs, &bds[i], key, hnode, @@ -806,7 +808,7 @@ cfs_hash_multi_bd_finddel_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, static void cfs_hash_bd_order(struct cfs_hash_bd *bd1, struct cfs_hash_bd *bd2) { - int rc; + int rc; if (bd2->bd_bucket == NULL) return; @@ -831,7 +833,8 @@ cfs_hash_bd_order(struct cfs_hash_bd *bd1, struct cfs_hash_bd *bd2) } void -cfs_hash_dual_bd_get(struct cfs_hash *hs, const void *key, struct cfs_hash_bd *bds) +cfs_hash_dual_bd_get(struct cfs_hash *hs, const void *key, + struct cfs_hash_bd *bds) { /* NB: caller should hold hs_lock.rw if REHASH is set */ cfs_hash_bd_from_key(hs, hs->hs_buckets, @@ -894,7 +897,7 @@ static void cfs_hash_buckets_free(struct cfs_hash_bucket **buckets, int bkt_size, int prev_size, int size) { - int i; + int i; for (i = prev_size; i < size; i++) { if (buckets[i] != NULL) @@ -914,7 +917,7 @@ cfs_hash_buckets_realloc(struct cfs_hash *hs, struct cfs_hash_bucket **old_bkts, unsigned int old_size, unsigned int new_size) { struct cfs_hash_bucket **new_bkts; - int i; + int i; LASSERT(old_size == 0 || old_bkts != NULL); @@ -932,7 +935,7 @@ cfs_hash_buckets_realloc(struct cfs_hash *hs, struct cfs_hash_bucket **old_bkts, for (i = old_size; i < new_size; i++) { struct hlist_head *hhead; - struct cfs_hash_bd bd; + struct cfs_hash_bd bd; LIBCFS_ALLOC(new_bkts[i], cfs_hash_bkt_size(hs)); if (new_bkts[i] == NULL) { @@ -969,7 +972,7 @@ cfs_hash_buckets_realloc(struct cfs_hash *hs, struct cfs_hash_bucket **old_bkts, * @max_bits - Maximum allowed hash table resize, in bits * @ops - Registered hash table operations * @flags - CFS_HASH_REHASH enable synamic hash resizing - * - CFS_HASH_SORT enable chained hash sort + * - CFS_HASH_SORT enable chained hash sort */ static int cfs_hash_rehash_worker(cfs_workitem_t *wi); @@ -977,10 +980,10 @@ static int cfs_hash_rehash_worker(cfs_workitem_t *wi); static int cfs_hash_dep_print(cfs_workitem_t *wi) { struct cfs_hash *hs = container_of(wi, struct cfs_hash, hs_dep_wi); - int dep; - int bkt; - int off; - int bits; + int dep; + int bkt; + int off; + int bits; spin_lock(&hs->hs_dep_lock); dep = hs->hs_dep_max; @@ -1031,7 +1034,7 @@ cfs_hash_create(char *name, unsigned cur_bits, unsigned max_bits, struct cfs_hash_ops *ops, unsigned flags) { struct cfs_hash *hs; - int len; + int len; CLASSERT(CFS_HASH_THETA_BITS < 15); @@ -1077,7 +1080,7 @@ cfs_hash_create(char *name, unsigned cur_bits, unsigned max_bits, hs->hs_max_bits = (__u8)max_bits; hs->hs_bkt_bits = (__u8)bkt_bits; - hs->hs_ops = ops; + hs->hs_ops = ops; hs->hs_extra_bytes = extra_bytes; hs->hs_rehash_bits = 0; cfs_wi_init(&hs->hs_rehash_wi, hs, cfs_hash_rehash_worker); @@ -1102,10 +1105,10 @@ EXPORT_SYMBOL(cfs_hash_create); static void cfs_hash_destroy(struct cfs_hash *hs) { - struct hlist_node *hnode; - struct hlist_node *pos; - struct cfs_hash_bd bd; - int i; + struct hlist_node *hnode; + struct hlist_node *pos; + struct cfs_hash_bd bd; + int i; LASSERT(hs != NULL); LASSERT(!cfs_hash_is_exiting(hs) && @@ -1223,8 +1226,8 @@ cfs_hash_rehash_inline(struct cfs_hash *hs) void cfs_hash_add(struct cfs_hash *hs, const void *key, struct hlist_node *hnode) { - struct cfs_hash_bd bd; - int bits; + struct cfs_hash_bd bd; + int bits; LASSERT(hlist_unhashed(hnode)); @@ -1248,8 +1251,8 @@ cfs_hash_find_or_add(struct cfs_hash *hs, const void *key, struct hlist_node *hnode, int noref) { struct hlist_node *ehnode; - struct cfs_hash_bd bds[2]; - int bits = 0; + struct cfs_hash_bd bds[2]; + int bits = 0; LASSERT(hlist_unhashed(hnode)); @@ -1261,7 +1264,7 @@ cfs_hash_find_or_add(struct cfs_hash *hs, const void *key, hnode, noref); cfs_hash_dual_bd_unlock(hs, bds, 1); - if (ehnode == hnode) /* new item added */ + if (ehnode == hnode) /* new item added */ bits = cfs_hash_rehash_bits(hs); cfs_hash_unlock(hs, 0); if (bits > 0) @@ -1276,7 +1279,8 @@ cfs_hash_find_or_add(struct cfs_hash *hs, const void *key, * Returns 0 on success or -EALREADY on key collisions. */ int -cfs_hash_add_unique(struct cfs_hash *hs, const void *key, struct hlist_node *hnode) +cfs_hash_add_unique(struct cfs_hash *hs, const void *key, + struct hlist_node *hnode) { return cfs_hash_find_or_add(hs, key, hnode, 1) != hnode ? -EALREADY : 0; @@ -1309,9 +1313,9 @@ EXPORT_SYMBOL(cfs_hash_findadd_unique); void * cfs_hash_del(struct cfs_hash *hs, const void *key, struct hlist_node *hnode) { - void *obj = NULL; - int bits = 0; - struct cfs_hash_bd bds[2]; + void *obj = NULL; + int bits = 0; + struct cfs_hash_bd bds[2]; cfs_hash_lock(hs, 0); cfs_hash_dual_bd_get_and_lock(hs, key, bds, 1); @@ -1364,9 +1368,9 @@ EXPORT_SYMBOL(cfs_hash_del_key); void * cfs_hash_lookup(struct cfs_hash *hs, const void *key) { - void *obj = NULL; - struct hlist_node *hnode; - struct cfs_hash_bd bds[2]; + void *obj = NULL; + struct hlist_node *hnode; + struct cfs_hash_bd bds[2]; cfs_hash_lock(hs, 0); cfs_hash_dual_bd_get_and_lock(hs, key, bds, 0); @@ -1383,7 +1387,8 @@ cfs_hash_lookup(struct cfs_hash *hs, const void *key) EXPORT_SYMBOL(cfs_hash_lookup); static void -cfs_hash_for_each_enter(struct cfs_hash *hs) { +cfs_hash_for_each_enter(struct cfs_hash *hs) +{ LASSERT(!cfs_hash_is_exiting(hs)); if (!cfs_hash_with_rehash(hs)) @@ -1408,7 +1413,8 @@ cfs_hash_for_each_enter(struct cfs_hash *hs) { } static void -cfs_hash_for_each_exit(struct cfs_hash *hs) { +cfs_hash_for_each_exit(struct cfs_hash *hs) +{ int remained; int bits; @@ -1439,14 +1445,15 @@ cfs_hash_for_each_exit(struct cfs_hash *hs) { */ static __u64 cfs_hash_for_each_tight(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, - void *data, int remove_safe) { - struct hlist_node *hnode; - struct hlist_node *pos; - struct cfs_hash_bd bd; - __u64 count = 0; - int excl = !!remove_safe; - int loop = 0; - int i; + void *data, int remove_safe) +{ + struct hlist_node *hnode; + struct hlist_node *pos; + struct cfs_hash_bd bd; + __u64 count = 0; + int excl = !!remove_safe; + int loop = 0; + int i; cfs_hash_for_each_enter(hs); @@ -1514,8 +1521,8 @@ void cfs_hash_cond_del(struct cfs_hash *hs, cfs_hash_cond_opt_cb_t func, void *data) { struct cfs_hash_cond_arg arg = { - .func = func, - .arg = data, + .func = func, + .arg = data, }; cfs_hash_for_each_tight(hs, cfs_hash_cond_del_locked, &arg, 1); @@ -1523,16 +1530,17 @@ cfs_hash_cond_del(struct cfs_hash *hs, cfs_hash_cond_opt_cb_t func, void *data) EXPORT_SYMBOL(cfs_hash_cond_del); void -cfs_hash_for_each(struct cfs_hash *hs, - cfs_hash_for_each_cb_t func, void *data) +cfs_hash_for_each(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, + void *data) { cfs_hash_for_each_tight(hs, func, data, 0); } EXPORT_SYMBOL(cfs_hash_for_each); void -cfs_hash_for_each_safe(struct cfs_hash *hs, - cfs_hash_for_each_cb_t func, void *data) { +cfs_hash_for_each_safe(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, + void *data) +{ cfs_hash_for_each_tight(hs, func, data, 1); } EXPORT_SYMBOL(cfs_hash_for_each_safe); @@ -1581,15 +1589,16 @@ EXPORT_SYMBOL(cfs_hash_size_get); */ static int cfs_hash_for_each_relax(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, - void *data) { + void *data) +{ struct hlist_node *hnode; struct hlist_node *tmp; - struct cfs_hash_bd bd; - __u32 version; - int count = 0; - int stop_on_change; - int rc; - int i; + struct cfs_hash_bd bd; + __u32 version; + int count = 0; + int stop_on_change; + int rc; + int i; stop_on_change = cfs_hash_with_rehash_key(hs) || !cfs_hash_with_no_itemref(hs) || @@ -1645,8 +1654,9 @@ cfs_hash_for_each_relax(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, } int -cfs_hash_for_each_nolock(struct cfs_hash *hs, - cfs_hash_for_each_cb_t func, void *data) { +cfs_hash_for_each_nolock(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, + void *data) +{ if (cfs_hash_with_no_lock(hs) || cfs_hash_with_rehash_key(hs) || !cfs_hash_with_no_itemref(hs)) @@ -1677,9 +1687,10 @@ EXPORT_SYMBOL(cfs_hash_for_each_nolock); * the required locking is in place to prevent concurrent insertions. */ int -cfs_hash_for_each_empty(struct cfs_hash *hs, - cfs_hash_for_each_cb_t func, void *data) { - unsigned i = 0; +cfs_hash_for_each_empty(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, + void *data) +{ + unsigned i = 0; if (cfs_hash_with_no_lock(hs)) return -EOPNOTSUPP; @@ -1703,9 +1714,9 @@ void cfs_hash_hlist_for_each(struct cfs_hash *hs, unsigned hindex, cfs_hash_for_each_cb_t func, void *data) { - struct hlist_head *hhead; - struct hlist_node *hnode; - struct cfs_hash_bd bd; + struct hlist_head *hhead; + struct hlist_node *hnode; + struct cfs_hash_bd bd; cfs_hash_for_each_enter(hs); cfs_hash_lock(hs, 0); @@ -1721,7 +1732,7 @@ cfs_hash_hlist_for_each(struct cfs_hash *hs, unsigned hindex, break; } cfs_hash_bd_unlock(hs, &bd, 0); - out: +out: cfs_hash_unlock(hs, 0); cfs_hash_for_each_exit(hs); } @@ -1736,10 +1747,11 @@ EXPORT_SYMBOL(cfs_hash_hlist_for_each); */ void cfs_hash_for_each_key(struct cfs_hash *hs, const void *key, - cfs_hash_for_each_cb_t func, void *data) { - struct hlist_node *hnode; - struct cfs_hash_bd bds[2]; - unsigned i; + cfs_hash_for_each_cb_t func, void *data) +{ + struct hlist_node *hnode; + struct cfs_hash_bd bds[2]; + unsigned int i; cfs_hash_lock(hs, 0); @@ -1777,7 +1789,7 @@ EXPORT_SYMBOL(cfs_hash_for_each_key); void cfs_hash_rehash_cancel_locked(struct cfs_hash *hs) { - int i; + int i; /* need hold cfs_hash_lock(hs, 1) */ LASSERT(cfs_hash_with_rehash(hs) && @@ -1815,7 +1827,7 @@ EXPORT_SYMBOL(cfs_hash_rehash_cancel); int cfs_hash_rehash(struct cfs_hash *hs, int do_rehash) { - int rc; + int rc; LASSERT(cfs_hash_with_rehash(hs) && !cfs_hash_with_no_lock(hs)); @@ -1845,12 +1857,12 @@ EXPORT_SYMBOL(cfs_hash_rehash); static int cfs_hash_rehash_bd(struct cfs_hash *hs, struct cfs_hash_bd *old) { - struct cfs_hash_bd new; - struct hlist_head *hhead; - struct hlist_node *hnode; - struct hlist_node *pos; - void *key; - int c = 0; + struct cfs_hash_bd new; + struct hlist_head *hhead; + struct hlist_node *hnode; + struct hlist_node *pos; + void *key; + int c = 0; /* hold cfs_hash_lock(hs, 1), so don't need any bucket lock */ cfs_hash_bd_for_each_hlist(hs, old, hhead) { @@ -1876,17 +1888,17 @@ cfs_hash_rehash_bd(struct cfs_hash *hs, struct cfs_hash_bd *old) static int cfs_hash_rehash_worker(cfs_workitem_t *wi) { - struct cfs_hash *hs = container_of(wi, struct cfs_hash, hs_rehash_wi); + struct cfs_hash *hs = container_of(wi, struct cfs_hash, hs_rehash_wi); struct cfs_hash_bucket **bkts; - struct cfs_hash_bd bd; - unsigned int old_size; - unsigned int new_size; - int bsize; - int count = 0; - int rc = 0; - int i; + struct cfs_hash_bd bd; + unsigned int old_size; + unsigned int new_size; + int bsize; + int count = 0; + int rc = 0; + int i; - LASSERT (hs != NULL && cfs_hash_with_rehash(hs)); + LASSERT(hs != NULL && cfs_hash_with_rehash(hs)); cfs_hash_lock(hs, 0); LASSERT(cfs_hash_is_rehashing(hs)); @@ -1958,7 +1970,7 @@ cfs_hash_rehash_worker(cfs_workitem_t *wi) hs->hs_rehash_buckets = NULL; hs->hs_cur_bits = hs->hs_rehash_bits; - out: +out: hs->hs_rehash_bits = 0; if (rc == -ESRCH) /* never be scheduled again */ cfs_wi_exit(cfs_sched_rehash, wi); @@ -1986,9 +1998,9 @@ cfs_hash_rehash_worker(cfs_workitem_t *wi) void cfs_hash_rehash_key(struct cfs_hash *hs, const void *old_key, void *new_key, struct hlist_node *hnode) { - struct cfs_hash_bd bds[3]; - struct cfs_hash_bd old_bds[2]; - struct cfs_hash_bd new_bd; + struct cfs_hash_bd bds[3]; + struct cfs_hash_bd old_bds[2]; + struct cfs_hash_bd new_bd; LASSERT(!hlist_unhashed(hnode)); @@ -2054,12 +2066,12 @@ cfs_hash_full_nbkt(struct cfs_hash *hs) void cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m) { - int dist[8] = { 0, }; - int maxdep = -1; - int maxdepb = -1; - int total = 0; - int theta; - int i; + int dist[8] = { 0, }; + int maxdep = -1; + int maxdepb = -1; + int total = 0; + int theta; + int i; cfs_hash_lock(hs, 0); theta = __cfs_hash_theta(hs); @@ -2085,11 +2097,11 @@ void cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m) * If you hash function results in a non-uniform hash the will * be observable by outlier bucks in the distribution histogram. * - * Uniform hash distribution: 128/128/0/0/0/0/0/0 - * Non-Uniform hash distribution: 128/125/0/0/0/0/2/1 + * Uniform hash distribution: 128/128/0/0/0/0/0/0 + * Non-Uniform hash distribution: 128/125/0/0/0/0/2/1 */ for (i = 0; i < cfs_hash_full_nbkt(hs); i++) { - struct cfs_hash_bd bd; + struct cfs_hash_bd bd; bd.bd_bucket = cfs_hash_full_bkts(hs)[i]; cfs_hash_bd_lock(hs, &bd, 0); From e72d97994bd7936bd24116b8fd4255e0ea2c1654 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Thu, 29 Oct 2015 17:35:22 -0400 Subject: [PATCH 057/843] staging: lustre: place linux header first in hash.c Always place linux headers first in libcfs header files. This avoid can potential build issues if any changes to a libcfs header land that starts using a linux header definition. Signed-off-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index ed4e1f1c4307..4cd8776ba84d 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -106,9 +106,9 @@ * Now we support both locked iteration & lockless iteration of hash * table. Also, user can break the iteration by return 1 in callback. */ +#include #include "../../include/linux/libcfs/libcfs.h" -#include #if CFS_HASH_DEBUG_LEVEL >= CFS_HASH_DEBUG_1 static unsigned int warn_on_depth = 8; From 168c7a13d4d923e56f64e34db1562f20006e2a1d Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Sun, 1 Nov 2015 12:21:37 +0530 Subject: [PATCH 058/843] Staging: lustre: lnet: Remove typedef srpc_server_rpc_t The Linux kernel coding style guidelines suggest not using typedefs for structure types. This patch gets rid of the typedef for srpc_server_rpc_t. Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/selftest/brw_test.c | 4 ++-- drivers/staging/lustre/lnet/selftest/console.c | 2 +- drivers/staging/lustre/lnet/selftest/framework.c | 8 ++++---- drivers/staging/lustre/lnet/selftest/rpc.c | 6 +++--- drivers/staging/lustre/lnet/selftest/selftest.h | 14 +++++++------- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c b/drivers/staging/lustre/lnet/selftest/brw_test.c index 0605c651f797..0f262267e01e 100644 --- a/drivers/staging/lustre/lnet/selftest/brw_test.c +++ b/drivers/staging/lustre/lnet/selftest/brw_test.c @@ -358,7 +358,7 @@ out: } static void -brw_server_rpc_done(srpc_server_rpc_t *rpc) +brw_server_rpc_done(struct srpc_server_rpc *rpc) { srpc_bulk_t *blk = rpc->srpc_bulk; @@ -378,7 +378,7 @@ brw_server_rpc_done(srpc_server_rpc_t *rpc) } static int -brw_bulk_ready(srpc_server_rpc_t *rpc, int status) +brw_bulk_ready(struct srpc_server_rpc *rpc, int status) { __u64 magic = BRW_MAGIC; srpc_brw_reply_t *reply = &rpc->srpc_replymsg.msg_body.brw_reply; diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index b1eceb4f4838..6862c9a15556 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -1883,7 +1883,7 @@ lstcon_session_feats_check(unsigned feats) } static int -lstcon_acceptor_handle(srpc_server_rpc_t *rpc) +lstcon_acceptor_handle(struct srpc_server_rpc *rpc) { srpc_msg_t *rep = &rpc->srpc_replymsg; srpc_msg_t *req = &rpc->srpc_reqstbuf->buf_msg; diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c index f18e50036809..1a2da7430190 100644 --- a/drivers/staging/lustre/lnet/selftest/framework.c +++ b/drivers/staging/lustre/lnet/selftest/framework.c @@ -111,7 +111,7 @@ static struct smoketest_framework { spinlock_t fw_lock; /* serialise */ sfw_session_t *fw_session; /* _the_ session */ int fw_shuttingdown; /* shutdown in progress */ - srpc_server_rpc_t *fw_active_srpc; /* running RPC */ + struct srpc_server_rpc *fw_active_srpc;/* running RPC */ } sfw_data; /* forward ref's */ @@ -722,7 +722,7 @@ sfw_unpack_addtest_req(srpc_msg_t *msg) } static int -sfw_add_test_instance(sfw_batch_t *tsb, srpc_server_rpc_t *rpc) +sfw_add_test_instance(sfw_batch_t *tsb, struct srpc_server_rpc *rpc) { srpc_msg_t *msg = &rpc->srpc_reqstbuf->buf_msg; srpc_test_reqst_t *req = &msg->msg_body.tes_reqst; @@ -1091,7 +1091,7 @@ sfw_query_batch(sfw_batch_t *tsb, int testidx, srpc_batch_reply_t *reply) } void -sfw_free_pages(srpc_server_rpc_t *rpc) +sfw_free_pages(struct srpc_server_rpc *rpc) { srpc_free_bulk(rpc->srpc_bulk); rpc->srpc_bulk = NULL; @@ -1112,7 +1112,7 @@ sfw_alloc_pages(struct srpc_server_rpc *rpc, int cpt, int npages, int len, } static int -sfw_add_test(srpc_server_rpc_t *rpc) +sfw_add_test(struct srpc_server_rpc *rpc) { sfw_session_t *sn = sfw_data.fw_session; srpc_test_reply_t *reply = &rpc->srpc_replymsg.msg_body.tes_reply; diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c index 0d1e7caf7cd6..86de68033f85 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.c +++ b/drivers/staging/lustre/lnet/selftest/rpc.c @@ -859,7 +859,7 @@ srpc_prepare_bulk(srpc_client_rpc_t *rpc) } static int -srpc_do_bulk(srpc_server_rpc_t *rpc) +srpc_do_bulk(struct srpc_server_rpc *rpc) { srpc_event_t *ev = &rpc->srpc_ev; srpc_bulk_t *bk = rpc->srpc_bulk; @@ -887,7 +887,7 @@ srpc_do_bulk(srpc_server_rpc_t *rpc) /* only called from srpc_handle_rpc */ static void -srpc_server_rpc_done(srpc_server_rpc_t *rpc, int status) +srpc_server_rpc_done(struct srpc_server_rpc *rpc, int status) { struct srpc_service_cd *scd = rpc->srpc_scd; struct srpc_service *sv = scd->scd_svc; @@ -1397,7 +1397,7 @@ srpc_lnet_ev_handler(lnet_event_t *ev) struct srpc_service_cd *scd; srpc_event_t *rpcev = ev->md.user_ptr; srpc_client_rpc_t *crpc; - srpc_server_rpc_t *srpc; + struct srpc_server_rpc *srpc; srpc_buffer_t *buffer; srpc_service_t *sv; srpc_msg_t *msg; diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index 8a77d3fdfa54..0c0f177debc8 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -182,7 +182,7 @@ typedef struct swi_workitem { } swi_workitem_t; /* server-side state of a RPC */ -typedef struct srpc_server_rpc { +struct srpc_server_rpc { /* chain on srpc_service::*_rpcq */ struct list_head srpc_list; struct srpc_service_cd *srpc_scd; @@ -198,7 +198,7 @@ typedef struct srpc_server_rpc { unsigned int srpc_aborted; /* being given up */ int srpc_status; void (*srpc_done)(struct srpc_server_rpc *); -} srpc_server_rpc_t; +}; /* client-side state of a RPC */ typedef struct srpc_client_rpc { @@ -318,8 +318,8 @@ typedef struct srpc_service { * - sv_handler: process incoming RPC request * - sv_bulk_ready: notify bulk data */ - int (*sv_handler) (srpc_server_rpc_t *); - int (*sv_bulk_ready) (srpc_server_rpc_t *, int); + int (*sv_handler)(struct srpc_server_rpc *); + int (*sv_bulk_ready)(struct srpc_server_rpc *, int); } srpc_service_t; typedef struct { @@ -423,9 +423,9 @@ void sfw_abort_rpc(srpc_client_rpc_t *rpc); void sfw_post_rpc(srpc_client_rpc_t *rpc); void sfw_client_rpc_done(srpc_client_rpc_t *rpc); void sfw_unpack_message(srpc_msg_t *msg); -void sfw_free_pages(srpc_server_rpc_t *rpc); +void sfw_free_pages(struct srpc_server_rpc *rpc); void sfw_add_bulk_page(srpc_bulk_t *bk, struct page *pg, int i); -int sfw_alloc_pages(srpc_server_rpc_t *rpc, int cpt, int npages, int len, +int sfw_alloc_pages(struct srpc_server_rpc *rpc, int cpt, int npages, int len, int sink); int sfw_make_session (srpc_mksn_reqst_t *request, srpc_mksn_reply_t *reply); @@ -440,7 +440,7 @@ void srpc_free_bulk(srpc_bulk_t *bk); srpc_bulk_t *srpc_alloc_bulk(int cpt, unsigned bulk_npg, unsigned bulk_len, int sink); int srpc_send_rpc(swi_workitem_t *wi); -int srpc_send_reply(srpc_server_rpc_t *rpc); +int srpc_send_reply(struct srpc_server_rpc *rpc); int srpc_add_service(srpc_service_t *sv); int srpc_remove_service(srpc_service_t *sv); void srpc_shutdown_service(srpc_service_t *sv); From fb2358958785fa724a007671eb2bf848e8137354 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Sun, 1 Nov 2015 17:06:33 +0530 Subject: [PATCH 059/843] Staging: lustre: ptlrpc: Remove unused function declarations Functions ptlrpc_handle_failed_import and ptlrpc_lprocfs_do_request_stat have been declared but not used. Thus drop the declarations. Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h index ab6c4580f91c..833ed944125e 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h @@ -73,7 +73,6 @@ void ptlrpc_request_handle_notconn(struct ptlrpc_request *); void lustre_assert_wire_constants(void); int ptlrpc_import_in_recovery(struct obd_import *imp); int ptlrpc_set_import_discon(struct obd_import *imp, __u32 conn_cnt); -void ptlrpc_handle_failed_import(struct obd_import *imp); int ptlrpc_replay_next(struct obd_import *imp, int *inflight); void ptlrpc_initiate_recovery(struct obd_import *imp); @@ -88,8 +87,6 @@ void ptlrpc_ldebugfs_register_service(struct dentry *debugfs_entry, struct ptlrpc_service *svc); void ptlrpc_lprocfs_unregister_service(struct ptlrpc_service *svc); void ptlrpc_lprocfs_rpc_sent(struct ptlrpc_request *req, long amount); -void ptlrpc_lprocfs_do_request_stat(struct ptlrpc_request *req, - long q_usec, long work_usec); /* NRS */ From 5e6f5901f076ec578f68cd100cca8f0d0175c532 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Sun, 1 Nov 2015 17:06:34 +0530 Subject: [PATCH 060/843] Staging: lustre: obdclass: Declare local function cl_lock_mutex_try as static Function cl_lock_mutex_try has been used only in this particular file. Thus declare the function as static. Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/cl_lock.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_lock.c b/drivers/staging/lustre/lustre/obdclass/cl_lock.c index 5621bebf33a9..1836dc01499a 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_lock.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_lock.c @@ -687,7 +687,7 @@ EXPORT_SYMBOL(cl_lock_mutex_get); * * \see cl_lock_mutex_get() */ -int cl_lock_mutex_try(const struct lu_env *env, struct cl_lock *lock) +static int cl_lock_mutex_try(const struct lu_env *env, struct cl_lock *lock) { int result; @@ -705,7 +705,6 @@ int cl_lock_mutex_try(const struct lu_env *env, struct cl_lock *lock) result = -EBUSY; return result; } -EXPORT_SYMBOL(cl_lock_mutex_try); /** {* Unlocks cl_lock object. From a2aadf23d1437ddcce86fa0673a6ecb5f932d3ec Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Sun, 1 Nov 2015 17:06:32 +0530 Subject: [PATCH 061/843] Staging: lustre: libcfs: Remove unused functions The functions cfs_hash_bd_findadd_locked and cfs_hash_bd_finddel_locked are not used anywhere. Thus remove these functions. Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- .../lustre/include/linux/libcfs/libcfs_hash.h | 7 ------- drivers/staging/lustre/lustre/libcfs/hash.c | 21 ------------------- 2 files changed, 28 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h index 2e0c89228013..f14db92346ba 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h @@ -640,13 +640,6 @@ cfs_hash_bd_lookup_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node * cfs_hash_bd_peek_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, const void *key); -struct hlist_node * -cfs_hash_bd_findadd_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, - const void *key, struct hlist_node *hnode, - int insist_add); -struct hlist_node * -cfs_hash_bd_finddel_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, - const void *key, struct hlist_node *hnode); /** * operations on cfs_hash bucket (bd: bucket descriptor), diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index 4cd8776ba84d..98c19b6cd174 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -682,27 +682,6 @@ cfs_hash_bd_peek_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, } EXPORT_SYMBOL(cfs_hash_bd_peek_locked); -struct hlist_node * -cfs_hash_bd_findadd_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, - const void *key, struct hlist_node *hnode, - int noref) -{ - return cfs_hash_bd_lookup_intent(hs, bd, key, hnode, - (!noref * CFS_HS_LOOKUP_MASK_REF) | - CFS_HS_LOOKUP_IT_ADD); -} -EXPORT_SYMBOL(cfs_hash_bd_findadd_locked); - -struct hlist_node * -cfs_hash_bd_finddel_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, - const void *key, struct hlist_node *hnode) -{ - /* hnode can be NULL, we find the first item with @key */ - return cfs_hash_bd_lookup_intent(hs, bd, key, hnode, - CFS_HS_LOOKUP_IT_FINDDEL); -} -EXPORT_SYMBOL(cfs_hash_bd_finddel_locked); - static void cfs_hash_multi_bd_lock(struct cfs_hash *hs, struct cfs_hash_bd *bds, unsigned n, int excl) From 90f8b4643023b23061a15229c0c0b8ee747438a8 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Mon, 2 Nov 2015 22:55:36 +0530 Subject: [PATCH 062/843] Staging: lustre: linux-crypto-adler: Drop wrapper function Remove the function __adler32() and replace its calls with the function it wrapped. Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- .../lustre/lustre/libcfs/linux/linux-crypto-adler.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto-adler.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto-adler.c index 5d8d8b79fa1f..db0572733712 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto-adler.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-crypto-adler.c @@ -37,11 +37,6 @@ #define CHKSUM_BLOCK_SIZE 1 #define CHKSUM_DIGEST_SIZE 4 -static u32 __adler32(u32 cksum, unsigned char const *p, size_t len) -{ - return zlib_adler32(cksum, p, len); -} - static int adler32_cra_init(struct crypto_tfm *tfm) { u32 *key = crypto_tfm_ctx(tfm); @@ -79,14 +74,14 @@ static int adler32_update(struct shash_desc *desc, const u8 *data, { u32 *cksump = shash_desc_ctx(desc); - *cksump = __adler32(*cksump, data, len); + *cksump = zlib_adler32(*cksump, data, len); return 0; } static int __adler32_finup(u32 *cksump, const u8 *data, unsigned int len, u8 *out) { - *(u32 *)out = __adler32(*cksump, data, len); + *(u32 *)out = zlib_adler32(*cksump, data, len); return 0; } From 7d6e398ca61427e903246f1c11853f6f967bbb5e Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Mon, 2 Nov 2015 23:19:13 +0530 Subject: [PATCH 063/843] Staging: lustre: linux-cpu: Remove wrapper function Remove the function cfs_cpu_core_siblings() and replace its calls with the function it wrapped. Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c index 209736454d06..bd7a9ef0be14 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c @@ -78,12 +78,6 @@ struct cfs_cpt_data { static struct cfs_cpt_data cpt_data; -static void cfs_cpu_core_siblings(int cpu, cpumask_t *mask) -{ - /* return cpumask of cores in the same socket */ - cpumask_copy(mask, topology_core_cpumask(cpu)); -} - /* return cpumask of HTs in the same core */ static void cfs_cpu_ht_siblings(int cpu, cpumask_t *mask) { @@ -643,7 +637,7 @@ cfs_cpt_choose_ncpus(struct cfs_cpt_table *cptab, int cpt, cpu = cpumask_first(node); /* get cpumask for cores in the same socket */ - cfs_cpu_core_siblings(cpu, socket); + cpumask_copy(socket, topology_core_cpumask(cpu)); cpumask_and(socket, socket, node); LASSERT(!cpumask_empty(socket)); From 9561c25c590afdcb27002dc168bcecbf5a757308 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Mon, 2 Nov 2015 23:19:34 +0530 Subject: [PATCH 064/843] Staging: lustre: linux-cpu: Drop wrapper function Remove the function cfs_cpu_ht_siblings() and replace all its calls with the function it wrapped. Siigned-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/libcfs/linux/linux-cpu.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c index bd7a9ef0be14..df6c049b795a 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c @@ -78,12 +78,6 @@ struct cfs_cpt_data { static struct cfs_cpt_data cpt_data; -/* return cpumask of HTs in the same core */ -static void cfs_cpu_ht_siblings(int cpu, cpumask_t *mask) -{ - cpumask_copy(mask, topology_sibling_cpumask(cpu)); -} - static void cfs_node_to_cpumask(int node, cpumask_t *mask) { cpumask_copy(mask, cpumask_of_node(node)); @@ -646,7 +640,7 @@ cfs_cpt_choose_ncpus(struct cfs_cpt_table *cptab, int cpt, int i; /* get cpumask for hts in the same core */ - cfs_cpu_ht_siblings(cpu, core); + cpumask_copy(core, topology_sibling_cpumask(cpu)); cpumask_and(core, core, node); LASSERT(!cpumask_empty(core)); @@ -962,7 +956,8 @@ cfs_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu) mutex_lock(&cpt_data.cpt_mutex); /* if all HTs in a core are offline, it may break affinity */ - cfs_cpu_ht_siblings(cpu, cpt_data.cpt_cpumask); + cpumask_copy(cpt_data.cpt_cpumask, + topology_sibling_cpumask(cpu)); warn = cpumask_any_and(cpt_data.cpt_cpumask, cpu_online_mask) >= nr_cpu_ids; mutex_unlock(&cpt_data.cpt_mutex); From 26da323423666560dd8ebf05c719f7cbd82e3f62 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Mon, 2 Nov 2015 23:19:55 +0530 Subject: [PATCH 065/843] Staging: lustre: linux-cpu: Remove unnecessary wrapper function Remove the function cfs_node_to_cpumask() and replace all its calls with the function it wrapped. Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/libcfs/linux/linux-cpu.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c index df6c049b795a..58a4034be1b8 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c @@ -78,11 +78,6 @@ struct cfs_cpt_data { static struct cfs_cpt_data cpt_data; -static void cfs_node_to_cpumask(int node, cpumask_t *mask) -{ - cpumask_copy(mask, cpumask_of_node(node)); -} - void cfs_cpt_table_free(struct cfs_cpt_table *cptab) { @@ -414,7 +409,7 @@ cfs_cpt_set_node(struct cfs_cpt_table *cptab, int cpt, int node) mutex_lock(&cpt_data.cpt_mutex); mask = cpt_data.cpt_cpumask; - cfs_node_to_cpumask(node, mask); + cpumask_copy(mask, cpumask_of_node(node)); rc = cfs_cpt_set_cpumask(cptab, cpt, mask); @@ -438,7 +433,7 @@ cfs_cpt_unset_node(struct cfs_cpt_table *cptab, int cpt, int node) mutex_lock(&cpt_data.cpt_mutex); mask = cpt_data.cpt_cpumask; - cfs_node_to_cpumask(node, mask); + cpumask_copy(mask, cpumask_of_node(node)); cfs_cpt_unset_cpumask(cptab, cpt, mask); @@ -757,7 +752,7 @@ cfs_cpt_table_create(int ncpt) } for_each_online_node(i) { - cfs_node_to_cpumask(i, mask); + cpumask_copy(mask, cpumask_of_node(i)); while (!cpumask_empty(mask)) { struct cfs_cpu_partition *part; From 87af1d2e0c29ce4f025da0cdbb9c74a3958fd71d Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Tue, 3 Nov 2015 00:29:22 +0530 Subject: [PATCH 066/843] Staging: lustre: tracefile: Replace function calls Replace the calls of function cfs_trace_put_console_buffer() with put_cpu() as former is just a wrapper for latter. Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/tracefile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c b/drivers/staging/lustre/lustre/libcfs/tracefile.c index f2d018d7823c..f99d30f799e0 100644 --- a/drivers/staging/lustre/lustre/libcfs/tracefile.c +++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c @@ -451,7 +451,7 @@ console: cfs_print_to_console(&header, mask, string_buf, needed, file, msgdata->msg_fn); - cfs_trace_put_console_buffer(string_buf); + put_cpu(); } if (cdls != NULL && cdls->cdls_count != 0) { @@ -465,7 +465,7 @@ console: cfs_print_to_console(&header, mask, string_buf, needed, file, msgdata->msg_fn); - cfs_trace_put_console_buffer(string_buf); + put_cpu(); cdls->cdls_count = 0; } From 5a2f464af23bc90a77df6b9b30815e602efb99af Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Tue, 3 Nov 2015 00:29:43 +0530 Subject: [PATCH 067/843] Staging: lustre: tracefile: Remove wrapper function Remove the function cfs_trace_put_console_buffer() as it is no longer required. Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/tracefile.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.h b/drivers/staging/lustre/lustre/libcfs/tracefile.h index cb7a3963589f..73d60e056922 100644 --- a/drivers/staging/lustre/lustre/libcfs/tracefile.h +++ b/drivers/staging/lustre/lustre/libcfs/tracefile.h @@ -279,12 +279,6 @@ cfs_trace_get_console_buffer(void) return cfs_trace_console_buffers[i][j]; } -static inline void -cfs_trace_put_console_buffer(char *buffer) -{ - put_cpu(); -} - static inline struct cfs_trace_cpu_data * cfs_trace_get_tcd(void) { From c14291d2c3041237c2e26939d26fb67bb689bcc2 Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Wed, 28 Oct 2015 18:59:55 -0700 Subject: [PATCH 068/843] Staging: rtl8192u: Remove unused function Function rtl8192_try_wake_queue is defined but not used, so remove it. Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_core.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index e06864f64beb..f4a4eae72aa4 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -5114,21 +5114,6 @@ static void __exit rtl8192_usb_module_exit(void) RT_TRACE(COMP_DOWN, "Exiting"); } - -void rtl8192_try_wake_queue(struct net_device *dev, int pri) -{ - unsigned long flags; - short enough_desc; - struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); - - spin_lock_irqsave(&priv->tx_lock, flags); - enough_desc = check_nic_enough_desc(dev, pri); - spin_unlock_irqrestore(&priv->tx_lock, flags); - - if (enough_desc) - ieee80211_wake_queue(priv->ieee80211); -} - void EnableHWSecurityConfig8192(struct net_device *dev) { u8 SECR_value = 0x0; From d2071984b917784f74ab32c4f054e3503bc730e5 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Sat, 31 Oct 2015 20:25:29 +0530 Subject: [PATCH 069/843] staging: rtl8192u: Remove unnecessary function This patch solves two problems. The function rtl8192_CalculateBitShift() had an unnecessary variable i that could be removed by using a single line of code. After this change, rtl8192_CalculateBitShift() becomes a wrapper function, so the rtl8192_CalculateBitShift() function has been removed completely to replace it with a single line of code. Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r819xU_phy.c | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c index 70656441c145..f264d88364a1 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.c +++ b/drivers/staging/rtl8192u/r819xU_phy.c @@ -37,21 +37,6 @@ static u32 RF_CHANNEL_TABLE_ZEBRA[] = { #define rtl819XRadioD_Array Rtl8192UsbRadioD_Array #define rtl819XAGCTAB_Array Rtl8192UsbAGCTAB_Array -/****************************************************************************** - * function: This function reads BB parameters from header file we generate, - * and does register read/write - * input: u32 bitmask //taget bit pos in the addr to be modified - * output: none - * return: u32 return the shift bit position of the mask - ******************************************************************************/ -static u32 rtl8192_CalculateBitShift(u32 bitmask) -{ - u32 i; - - i = ffs(bitmask) - 1; - return i; -} - /****************************************************************************** * function: This function checks different RF type to execute legal judgement. * If RF Path is illegal, we will return false. @@ -94,7 +79,7 @@ void rtl8192_setBBreg(struct net_device *dev, u32 reg_addr, u32 bitmask, if (bitmask != bMaskDWord) { read_nic_dword(dev, reg_addr, ®); - bitshift = rtl8192_CalculateBitShift(bitmask); + bitshift = ffs(bitmask) - 1; reg &= ~bitmask; reg |= data << bitshift; write_nic_dword(dev, reg_addr, reg); @@ -117,7 +102,7 @@ u32 rtl8192_QueryBBReg(struct net_device *dev, u32 reg_addr, u32 bitmask) u32 reg, bitshift; read_nic_dword(dev, reg_addr, ®); - bitshift = rtl8192_CalculateBitShift(bitmask); + bitshift = ffs(bitmask) - 1; return (reg & bitmask) >> bitshift; } @@ -306,7 +291,7 @@ void rtl8192_phy_SetRFReg(struct net_device *dev, RF90_RADIO_PATH_E eRFPath, if (bitmask != bMask12Bits) { /* RF data is 12 bits only */ reg = phy_FwRFSerialRead(dev, eRFPath, reg_addr); - bitshift = rtl8192_CalculateBitShift(bitmask); + bitshift = ffs(bitmask) - 1; reg &= ~bitmask; reg |= data << bitshift; @@ -321,7 +306,7 @@ void rtl8192_phy_SetRFReg(struct net_device *dev, RF90_RADIO_PATH_E eRFPath, if (bitmask != bMask12Bits) { /* RF data is 12 bits only */ reg = rtl8192_phy_RFSerialRead(dev, eRFPath, reg_addr); - bitshift = rtl8192_CalculateBitShift(bitmask); + bitshift = ffs(bitmask) - 1; reg &= ~bitmask; reg |= data << bitshift; @@ -356,7 +341,7 @@ u32 rtl8192_phy_QueryRFReg(struct net_device *dev, RF90_RADIO_PATH_E eRFPath, } else { reg = rtl8192_phy_RFSerialRead(dev, eRFPath, reg_addr); } - bitshift = rtl8192_CalculateBitShift(bitmask); + bitshift = ffs(bitmask) - 1; reg = (reg & bitmask) >> bitshift; return reg; From e1fec5395af3502efce18906a58dc6a8d1ff697e Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Fri, 30 Oct 2015 02:12:16 +0530 Subject: [PATCH 070/843] staging: gdm72xx: Remove wrapper function Remove wrapper function that can be replaced by a single line of code. Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm72xx/gdm_wimax.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/staging/gdm72xx/gdm_wimax.c b/drivers/staging/gdm72xx/gdm_wimax.c index d9ddced96e19..b8eea21f2655 100644 --- a/drivers/staging/gdm72xx/gdm_wimax.c +++ b/drivers/staging/gdm72xx/gdm_wimax.c @@ -84,11 +84,6 @@ static inline struct evt_entry *alloc_event_entry(void) return kmalloc(sizeof(struct evt_entry), GFP_ATOMIC); } -static inline void free_event_entry(struct evt_entry *e) -{ - kfree(e); -} - static struct evt_entry *get_event_entry(void) { struct evt_entry *e; @@ -180,11 +175,11 @@ static void gdm_wimax_event_exit(void) list_for_each_entry_safe(e, temp, &wm_event.evtq, list) { list_del(&e->list); - free_event_entry(e); + kfree(e); } list_for_each_entry_safe(e, temp, &wm_event.freeq, list) { list_del(&e->list); - free_event_entry(e); + kfree(e); } spin_unlock_irqrestore(&wm_event.evt_lock, flags); From 24f49745df332421230dd613a218e1ce21b0502e Mon Sep 17 00:00:00 2001 From: Burcin Akalin Date: Sun, 1 Nov 2015 01:56:48 +0300 Subject: [PATCH 071/843] staging: gdm72xx: Add space around '&' Add space around operator '&'. Problem found using checkpatch.pl CHECK: spaces preferred around that '&' (ctx:VxV) Signed-off-by: Burcin Akalin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm72xx/gdm_qos.c | 40 +++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/staging/gdm72xx/gdm_qos.c b/drivers/staging/gdm72xx/gdm_qos.c index 81feffa5784a..220fcd298e05 100644 --- a/drivers/staging/gdm72xx/gdm_qos.c +++ b/drivers/staging/gdm72xx/gdm_qos.c @@ -143,18 +143,18 @@ static int chk_ipv4_rule(struct gdm_wimax_csr_s *csr, u8 *stream, u8 *port) { int i; - if (csr->classifier_rule_en&IPTYPEOFSERVICE) { + if (csr->classifier_rule_en & IPTYPEOFSERVICE) { if (((stream[1] & csr->ip2s_mask) < csr->ip2s_lo) || ((stream[1] & csr->ip2s_mask) > csr->ip2s_hi)) return 1; } - if (csr->classifier_rule_en&PROTOCOL) { + if (csr->classifier_rule_en & PROTOCOL) { if (stream[9] != csr->protocol) return 1; } - if (csr->classifier_rule_en&IPMASKEDSRCADDRESS) { + if (csr->classifier_rule_en & IPMASKEDSRCADDRESS) { for (i = 0; i < 4; i++) { if ((stream[12 + i] & csr->ipsrc_addrmask[i]) != (csr->ipsrc_addr[i] & csr->ipsrc_addrmask[i])) @@ -162,7 +162,7 @@ static int chk_ipv4_rule(struct gdm_wimax_csr_s *csr, u8 *stream, u8 *port) } } - if (csr->classifier_rule_en&IPMASKEDDSTADDRESS) { + if (csr->classifier_rule_en & IPMASKEDDSTADDRESS) { for (i = 0; i < 4; i++) { if ((stream[16 + i] & csr->ipdst_addrmask[i]) != (csr->ipdst_addr[i] & csr->ipdst_addrmask[i])) @@ -170,14 +170,14 @@ static int chk_ipv4_rule(struct gdm_wimax_csr_s *csr, u8 *stream, u8 *port) } } - if (csr->classifier_rule_en&PROTOCOLSRCPORTRANGE) { - i = ((port[0]<<8)&0xff00)+port[1]; + if (csr->classifier_rule_en & PROTOCOLSRCPORTRANGE) { + i = ((port[0]<<8) & 0xff00)+port[1]; if ((i < csr->srcport_lo) || (i > csr->srcport_hi)) return 1; } - if (csr->classifier_rule_en&PROTOCOLDSTPORTRANGE) { - i = ((port[2]<<8)&0xff00)+port[3]; + if (csr->classifier_rule_en & PROTOCOLDSTPORTRANGE) { + i = ((port[2]<<8) & 0xff00)+port[3]; if ((i < csr->dstport_lo) || (i > csr->dstport_hi)) return 1; } @@ -193,7 +193,7 @@ static int get_qos_index(struct nic *nic, u8 *iph, u8 *tcpudph) if (!iph || !tcpudph) return -1; - ip_ver = (iph[0]>>4)&0xf; + ip_ver = (iph[0]>>4) & 0xf; if (ip_ver != 4) return -1; @@ -342,9 +342,9 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) if (sub_cmd_evt == QOS_REPORT) { spin_lock_irqsave(&qcb->qos_lock, flags); for (i = 0; i < qcb->qos_list_cnt; i++) { - sfid = ((buf[(i*5)+6]<<24)&0xff000000); - sfid += ((buf[(i*5)+7]<<16)&0xff0000); - sfid += ((buf[(i*5)+8]<<8)&0xff00); + sfid = ((buf[(i*5)+6]<<24) & 0xff000000); + sfid += ((buf[(i*5)+7]<<16) & 0xff0000); + sfid += ((buf[(i*5)+8]<<8) & 0xff00); sfid += (buf[(i*5)+9]); index = get_csr(qcb, sfid, 0); if (index == -1) { @@ -363,9 +363,9 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) /* sub_cmd_evt == QOS_ADD || sub_cmd_evt == QOS_CHANG_DEL */ pos = 6; - sfid = ((buf[pos++]<<24)&0xff000000); - sfid += ((buf[pos++]<<16)&0xff0000); - sfid += ((buf[pos++]<<8)&0xff00); + sfid = ((buf[pos++]<<24) & 0xff000000); + sfid += ((buf[pos++]<<16) & 0xff0000); + sfid += ((buf[pos++]<<8) & 0xff00); sfid += (buf[pos++]); index = get_csr(qcb, sfid, 1); @@ -382,7 +382,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) spin_lock_irqsave(&qcb->qos_lock, flags); qcb->csr[index].sfid = sfid; - qcb->csr[index].classifier_rule_en = ((buf[pos++]<<8)&0xff00); + qcb->csr[index].classifier_rule_en = ((buf[pos++]<<8) & 0xff00); qcb->csr[index].classifier_rule_en += buf[pos++]; if (qcb->csr[index].classifier_rule_en == 0) qcb->qos_null_idx = index; @@ -406,13 +406,13 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) qcb->csr[index].ipdst_addr[1] = buf[pos++]; qcb->csr[index].ipdst_addr[2] = buf[pos++]; qcb->csr[index].ipdst_addr[3] = buf[pos++]; - qcb->csr[index].srcport_lo = ((buf[pos++]<<8)&0xff00); + qcb->csr[index].srcport_lo = ((buf[pos++]<<8) & 0xff00); qcb->csr[index].srcport_lo += buf[pos++]; - qcb->csr[index].srcport_hi = ((buf[pos++]<<8)&0xff00); + qcb->csr[index].srcport_hi = ((buf[pos++]<<8) & 0xff00); qcb->csr[index].srcport_hi += buf[pos++]; - qcb->csr[index].dstport_lo = ((buf[pos++]<<8)&0xff00); + qcb->csr[index].dstport_lo = ((buf[pos++]<<8) & 0xff00); qcb->csr[index].dstport_lo += buf[pos++]; - qcb->csr[index].dstport_hi = ((buf[pos++]<<8)&0xff00); + qcb->csr[index].dstport_hi = ((buf[pos++]<<8) & 0xff00); qcb->csr[index].dstport_hi += buf[pos++]; qcb->qos_limit_size = 254/qcb->qos_list_cnt; From 053124a34d968417934406c2fb111ae5b397e376 Mon Sep 17 00:00:00 2001 From: Burcin Akalin Date: Sun, 1 Nov 2015 01:56:49 +0300 Subject: [PATCH 072/843] staging: gdm72xx: Add space around '-' Add space around operator '-'. Problem found using checkpatch.pl CHECK: spaces preferred around that '-' (ctx:VxV) Signed-off-by: Burcin Akalin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm72xx/gdm_qos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/gdm72xx/gdm_qos.c b/drivers/staging/gdm72xx/gdm_qos.c index 220fcd298e05..27f6054cbbf9 100644 --- a/drivers/staging/gdm72xx/gdm_qos.c +++ b/drivers/staging/gdm72xx/gdm_qos.c @@ -101,7 +101,7 @@ void gdm_qos_init(void *nic_ptr) } qcb->qos_list_cnt = 0; - qcb->qos_null_idx = QOS_MAX-1; + qcb->qos_null_idx = QOS_MAX - 1; qcb->qos_limit_size = 255; spin_lock_init(&qcb->qos_lock); @@ -128,7 +128,7 @@ void gdm_qos_release_list(void *nic_ptr) } qcb->qos_list_cnt = 0; - qcb->qos_null_idx = QOS_MAX-1; + qcb->qos_null_idx = QOS_MAX - 1; for (i = 0; i < QOS_MAX; i++) { list_for_each_entry_safe(entry, n, &qcb->qos_list[i], list) { From 20437125c4dc3851d1a4ed9d01827fa8abe97c95 Mon Sep 17 00:00:00 2001 From: Burcin Akalin Date: Sun, 1 Nov 2015 01:56:50 +0300 Subject: [PATCH 073/843] staging: gdm72xx: Add space around '+' Add space around operator '+'. Problem found using checkpatch.pl CHECK: spaces preferred around that '+' (ctx:VxV) Signed-off-by: Burcin Akalin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm72xx/gdm_qos.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/gdm72xx/gdm_qos.c b/drivers/staging/gdm72xx/gdm_qos.c index 27f6054cbbf9..500476daf2b4 100644 --- a/drivers/staging/gdm72xx/gdm_qos.c +++ b/drivers/staging/gdm72xx/gdm_qos.c @@ -171,13 +171,13 @@ static int chk_ipv4_rule(struct gdm_wimax_csr_s *csr, u8 *stream, u8 *port) } if (csr->classifier_rule_en & PROTOCOLSRCPORTRANGE) { - i = ((port[0]<<8) & 0xff00)+port[1]; + i = ((port[0]<<8) & 0xff00) + port[1]; if ((i < csr->srcport_lo) || (i > csr->srcport_hi)) return 1; } if (csr->classifier_rule_en & PROTOCOLDSTPORTRANGE) { - i = ((port[2]<<8) & 0xff00)+port[3]; + i = ((port[2]<<8) & 0xff00) + port[3]; if ((i < csr->dstport_lo) || (i > csr->dstport_hi)) return 1; } @@ -342,17 +342,17 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) if (sub_cmd_evt == QOS_REPORT) { spin_lock_irqsave(&qcb->qos_lock, flags); for (i = 0; i < qcb->qos_list_cnt; i++) { - sfid = ((buf[(i*5)+6]<<24) & 0xff000000); - sfid += ((buf[(i*5)+7]<<16) & 0xff0000); - sfid += ((buf[(i*5)+8]<<8) & 0xff00); - sfid += (buf[(i*5)+9]); + sfid = ((buf[(i*5) + 6]<<24) & 0xff000000); + sfid += ((buf[(i*5) + 7]<<16) & 0xff0000); + sfid += ((buf[(i*5) + 8]<<8) & 0xff00); + sfid += (buf[(i*5) + 9]); index = get_csr(qcb, sfid, 0); if (index == -1) { spin_unlock_irqrestore(&qcb->qos_lock, flags); netdev_err(nic->netdev, "QoS ERROR: No SF\n"); return; } - qcb->csr[index].qos_buf_count = buf[(i*5)+10]; + qcb->csr[index].qos_buf_count = buf[(i*5) + 10]; } extract_qos_list(nic, &send_list); From 565678ab1ba760ffd31bcd4e7ee9ea6511296ed4 Mon Sep 17 00:00:00 2001 From: Burcin Akalin Date: Sun, 1 Nov 2015 01:56:51 +0300 Subject: [PATCH 074/843] staging: gdm72xx: Add space around '/' Add space around operator '/'. Problem found using checkpatch.pl CHECK: spaces preferred around that '/' (ctx:VxV) Signed-off-by: Burcin Akalin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm72xx/gdm_qos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/gdm72xx/gdm_qos.c b/drivers/staging/gdm72xx/gdm_qos.c index 500476daf2b4..5db16ea05dbc 100644 --- a/drivers/staging/gdm72xx/gdm_qos.c +++ b/drivers/staging/gdm72xx/gdm_qos.c @@ -415,7 +415,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) qcb->csr[index].dstport_hi = ((buf[pos++]<<8) & 0xff00); qcb->csr[index].dstport_hi += buf[pos++]; - qcb->qos_limit_size = 254/qcb->qos_list_cnt; + qcb->qos_limit_size = 254 / qcb->qos_list_cnt; spin_unlock_irqrestore(&qcb->qos_lock, flags); } else if (sub_cmd_evt == QOS_CHANGE_DEL) { netdev_dbg(nic->netdev, "QOS_CHANGE_DEL SFID = 0x%x, index=%d\n", @@ -426,7 +426,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) spin_lock_irqsave(&qcb->qos_lock, flags); qcb->csr[index].enabled = false; qcb->qos_list_cnt--; - qcb->qos_limit_size = 254/qcb->qos_list_cnt; + qcb->qos_limit_size = 254 / qcb->qos_list_cnt; list_for_each_entry_safe(entry, n, &qcb->qos_list[index], list) { From 3979b47c6e97e924dd3b826b573d38f93515c2bf Mon Sep 17 00:00:00 2001 From: Burcin Akalin Date: Sun, 1 Nov 2015 01:56:52 +0300 Subject: [PATCH 075/843] staging: gdm72xx: Add space around '>>' Add space around operator '>>'. Problem found using checkpatch.pl CHECK: spaces preferred around that '>>' (ctx:VxV) Signed-off-by: Burcin Akalin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm72xx/gdm_qos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/gdm72xx/gdm_qos.c b/drivers/staging/gdm72xx/gdm_qos.c index 5db16ea05dbc..ba5387fa66ef 100644 --- a/drivers/staging/gdm72xx/gdm_qos.c +++ b/drivers/staging/gdm72xx/gdm_qos.c @@ -193,7 +193,7 @@ static int get_qos_index(struct nic *nic, u8 *iph, u8 *tcpudph) if (!iph || !tcpudph) return -1; - ip_ver = (iph[0]>>4) & 0xf; + ip_ver = (iph[0] >> 4) & 0xf; if (ip_ver != 4) return -1; From d3fc05e22d6bba8b118512aabe6e888a30e76e3f Mon Sep 17 00:00:00 2001 From: Burcin Akalin Date: Sun, 1 Nov 2015 14:08:08 +0300 Subject: [PATCH 076/843] staging: gdm72xx:Add space around '<<' Add space around operator '<<'. Problem found using checkpatch.pl CHECK: spaces preferred around that '<<' (ctx:VxV) Signed-off-by: Burcin Akalin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm72xx/gdm_qos.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/staging/gdm72xx/gdm_qos.c b/drivers/staging/gdm72xx/gdm_qos.c index ba5387fa66ef..cad347a05d18 100644 --- a/drivers/staging/gdm72xx/gdm_qos.c +++ b/drivers/staging/gdm72xx/gdm_qos.c @@ -171,13 +171,13 @@ static int chk_ipv4_rule(struct gdm_wimax_csr_s *csr, u8 *stream, u8 *port) } if (csr->classifier_rule_en & PROTOCOLSRCPORTRANGE) { - i = ((port[0]<<8) & 0xff00) + port[1]; + i = ((port[0] << 8) & 0xff00) + port[1]; if ((i < csr->srcport_lo) || (i > csr->srcport_hi)) return 1; } if (csr->classifier_rule_en & PROTOCOLDSTPORTRANGE) { - i = ((port[2]<<8) & 0xff00) + port[3]; + i = ((port[2] << 8) & 0xff00) + port[3]; if ((i < csr->dstport_lo) || (i > csr->dstport_hi)) return 1; } @@ -342,9 +342,9 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) if (sub_cmd_evt == QOS_REPORT) { spin_lock_irqsave(&qcb->qos_lock, flags); for (i = 0; i < qcb->qos_list_cnt; i++) { - sfid = ((buf[(i*5) + 6]<<24) & 0xff000000); - sfid += ((buf[(i*5) + 7]<<16) & 0xff0000); - sfid += ((buf[(i*5) + 8]<<8) & 0xff00); + sfid = ((buf[(i*5) + 6] << 24) & 0xff000000); + sfid += ((buf[(i*5) + 7] << 16) & 0xff0000); + sfid += ((buf[(i*5) + 8] << 8) & 0xff00); sfid += (buf[(i*5) + 9]); index = get_csr(qcb, sfid, 0); if (index == -1) { @@ -363,9 +363,9 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) /* sub_cmd_evt == QOS_ADD || sub_cmd_evt == QOS_CHANG_DEL */ pos = 6; - sfid = ((buf[pos++]<<24) & 0xff000000); - sfid += ((buf[pos++]<<16) & 0xff0000); - sfid += ((buf[pos++]<<8) & 0xff00); + sfid = ((buf[pos++] << 24) & 0xff000000); + sfid += ((buf[pos++] << 16) & 0xff0000); + sfid += ((buf[pos++] << 8) & 0xff00); sfid += (buf[pos++]); index = get_csr(qcb, sfid, 1); @@ -382,7 +382,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) spin_lock_irqsave(&qcb->qos_lock, flags); qcb->csr[index].sfid = sfid; - qcb->csr[index].classifier_rule_en = ((buf[pos++]<<8) & 0xff00); + qcb->csr[index].classifier_rule_en = ((buf[pos++] << 8) & 0xff00); qcb->csr[index].classifier_rule_en += buf[pos++]; if (qcb->csr[index].classifier_rule_en == 0) qcb->qos_null_idx = index; @@ -406,13 +406,13 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) qcb->csr[index].ipdst_addr[1] = buf[pos++]; qcb->csr[index].ipdst_addr[2] = buf[pos++]; qcb->csr[index].ipdst_addr[3] = buf[pos++]; - qcb->csr[index].srcport_lo = ((buf[pos++]<<8) & 0xff00); + qcb->csr[index].srcport_lo = ((buf[pos++] << 8) & 0xff00); qcb->csr[index].srcport_lo += buf[pos++]; - qcb->csr[index].srcport_hi = ((buf[pos++]<<8) & 0xff00); + qcb->csr[index].srcport_hi = ((buf[pos++] << 8) & 0xff00); qcb->csr[index].srcport_hi += buf[pos++]; - qcb->csr[index].dstport_lo = ((buf[pos++]<<8) & 0xff00); + qcb->csr[index].dstport_lo = ((buf[pos++] << 8) & 0xff00); qcb->csr[index].dstport_lo += buf[pos++]; - qcb->csr[index].dstport_hi = ((buf[pos++]<<8) & 0xff00); + qcb->csr[index].dstport_hi = ((buf[pos++] << 8) & 0xff00); qcb->csr[index].dstport_hi += buf[pos++]; qcb->qos_limit_size = 254 / qcb->qos_list_cnt; From f3a2d1adfdcceeb225d7676d31d07c9d6441eb8e Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Thu, 29 Oct 2015 11:47:03 +0530 Subject: [PATCH 077/843] staging: rtl8188eu: core: rtw_ap : Remove unnecessary functions Drop unnecessary functions that are declared but not being used. Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_ap.c | 54 +------------------------ 1 file changed, 1 insertion(+), 53 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c index 3cdb40fea5ee..e5d29fe9d446 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -1240,11 +1240,6 @@ int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr) return 0; } -static void update_bcn_fixed_ie(struct adapter *padapter) -{ - DBG_88E("%s\n", __func__); -} - static void update_bcn_erpinfo_ie(struct adapter *padapter) { struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); @@ -1279,31 +1274,6 @@ static void update_bcn_erpinfo_ie(struct adapter *padapter) } } -static void update_bcn_htcap_ie(struct adapter *padapter) -{ - DBG_88E("%s\n", __func__); -} - -static void update_bcn_htinfo_ie(struct adapter *padapter) -{ - DBG_88E("%s\n", __func__); -} - -static void update_bcn_rsn_ie(struct adapter *padapter) -{ - DBG_88E("%s\n", __func__); -} - -static void update_bcn_wpa_ie(struct adapter *padapter) -{ - DBG_88E("%s\n", __func__); -} - -static void update_bcn_wmm_ie(struct adapter *padapter) -{ - DBG_88E("%s\n", __func__); -} - static void update_bcn_wps_ie(struct adapter *padapter) { u8 *pwps_ie = NULL, *pwps_ie_src; @@ -1354,22 +1324,12 @@ static void update_bcn_wps_ie(struct adapter *padapter) kfree(pbackup_remainder_ie); } -static void update_bcn_p2p_ie(struct adapter *padapter) -{ -} - static void update_bcn_vendor_spec_ie(struct adapter *padapter, u8 *oui) { DBG_88E("%s\n", __func__); - if (!memcmp(RTW_WPA_OUI, oui, 4)) - update_bcn_wpa_ie(padapter); - else if (!memcmp(WMM_OUI, oui, 4)) - update_bcn_wmm_ie(padapter); - else if (!memcmp(WPS_OUI, oui, 4)) + if (!memcmp(WPS_OUI, oui, 4)) update_bcn_wps_ie(padapter); - else if (!memcmp(P2P_OUI, oui, 4)) - update_bcn_p2p_ie(padapter); else DBG_88E("unknown OUI type!\n"); } @@ -1391,24 +1351,12 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx) spin_lock_bh(&pmlmepriv->bcn_update_lock); switch (ie_id) { - case 0xFF: - update_bcn_fixed_ie(padapter);/* 8: TimeStamp, 2: Beacon Interval 2:Capability */ - break; case _TIM_IE_: update_BCNTIM(padapter); break; case _ERPINFO_IE_: update_bcn_erpinfo_ie(padapter); break; - case _HT_CAPABILITY_IE_: - update_bcn_htcap_ie(padapter); - break; - case _RSN_IE_2_: - update_bcn_rsn_ie(padapter); - break; - case _HT_ADD_INFO_IE_: - update_bcn_htinfo_ie(padapter); - break; case _VENDOR_SPECIFIC_IE_: update_bcn_vendor_spec_ie(padapter, oui); break; From ce3b84ab536a6f927506b998650ffb810b153705 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Thu, 29 Oct 2015 11:48:39 +0530 Subject: [PATCH 078/843] staging: rtl8188eu: Remove unused function Remove function that is declared but not called anywhere. Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_xmit.c | 5 ----- drivers/staging/rtl8188eu/include/rtw_xmit.h | 1 - 2 files changed, 6 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c index cabb810369bd..11dbfc060b0d 100644 --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c @@ -2186,11 +2186,6 @@ void rtw_sctx_done_err(struct submit_ctx **sctx, int status) } } -void rtw_sctx_done(struct submit_ctx **sctx) -{ - rtw_sctx_done_err(sctx, RTW_SCTX_DONE_SUCCESS); -} - int rtw_ack_tx_wait(struct xmit_priv *pxmitpriv, u32 timeout_ms) { struct submit_ctx *pack_tx_ops = &pxmitpriv->ack_tx_ops; diff --git a/drivers/staging/rtl8188eu/include/rtw_xmit.h b/drivers/staging/rtl8188eu/include/rtw_xmit.h index 62f5db169523..b7c20883d355 100644 --- a/drivers/staging/rtl8188eu/include/rtw_xmit.h +++ b/drivers/staging/rtl8188eu/include/rtw_xmit.h @@ -197,7 +197,6 @@ enum { void rtw_sctx_init(struct submit_ctx *sctx, int timeout_ms); int rtw_sctx_wait(struct submit_ctx *sctx); void rtw_sctx_done_err(struct submit_ctx **sctx, int status); -void rtw_sctx_done(struct submit_ctx **sctx); struct xmit_buf { struct list_head list; From 03ea25f0c5f8929d27b2dcde26aa0b698fd12913 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Thu, 29 Oct 2015 11:52:35 +0530 Subject: [PATCH 079/843] staging: rtl8188eu: core: Remove wrapper function Remove wrapper function issue_probereq() that can be replaced by a single line of code and rename _issue_probereq() to issue_probereq(). This patch also fixes line over 80 characters checkpatch.pl warning. Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index d900546b672f..687f0c2206cf 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -609,7 +609,7 @@ static void issue_probersp(struct adapter *padapter, unsigned char *da) return; } -static int _issue_probereq(struct adapter *padapter, struct ndis_802_11_ssid *pssid, u8 *da, int wait_ack) +static int issue_probereq(struct adapter *padapter, struct ndis_802_11_ssid *pssid, u8 *da, int wait_ack) { int ret = _FAIL; struct xmit_frame *pmgntframe; @@ -702,12 +702,6 @@ exit: return ret; } -static inline void issue_probereq(struct adapter *padapter, - struct ndis_802_11_ssid *pssid, u8 *da) -{ - _issue_probereq(padapter, pssid, da, false); -} - static int issue_probereq_ex(struct adapter *padapter, struct ndis_802_11_ssid *pssid, u8 *da, int try_cnt, int wait_ms) @@ -717,7 +711,7 @@ static int issue_probereq_ex(struct adapter *padapter, u32 start = jiffies; do { - ret = _issue_probereq(padapter, pssid, da, wait_ms > 0 ? true : false); + ret = issue_probereq(padapter, pssid, da, wait_ms > 0 ? true : false); i++; @@ -2029,24 +2023,28 @@ static void site_survey(struct adapter *padapter) for (i = 0; i < RTW_SSID_SCAN_AMOUNT; i++) { if (pmlmeext->sitesurvey_res.ssid[i].SsidLength) { /* todo: to issue two probe req??? */ - issue_probereq(padapter, &(pmlmeext->sitesurvey_res.ssid[i]), NULL); + issue_probereq(padapter, + &(pmlmeext->sitesurvey_res.ssid[i]), + NULL, false); /* msleep(SURVEY_TO>>1); */ - issue_probereq(padapter, &(pmlmeext->sitesurvey_res.ssid[i]), NULL); + issue_probereq(padapter, + &(pmlmeext->sitesurvey_res.ssid[i]), + NULL, false); } } if (pmlmeext->sitesurvey_res.scan_mode == SCAN_ACTIVE) { /* todo: to issue two probe req??? */ - issue_probereq(padapter, NULL, NULL); + issue_probereq(padapter, NULL, NULL, false); /* msleep(SURVEY_TO>>1); */ - issue_probereq(padapter, NULL, NULL); + issue_probereq(padapter, NULL, NULL, false); } if (pmlmeext->sitesurvey_res.scan_mode == SCAN_ACTIVE) { /* todo: to issue two probe req??? */ - issue_probereq(padapter, NULL, NULL); + issue_probereq(padapter, NULL, NULL, false); /* msleep(SURVEY_TO>>1); */ - issue_probereq(padapter, NULL, NULL); + issue_probereq(padapter, NULL, NULL, false); } } @@ -4820,9 +4818,18 @@ void linked_status_chk(struct adapter *padapter) } else { if (rx_chk != _SUCCESS) { if (pmlmeext->retry == 0) { - issue_probereq(padapter, &pmlmeinfo->network.Ssid, pmlmeinfo->network.MacAddress); - issue_probereq(padapter, &pmlmeinfo->network.Ssid, pmlmeinfo->network.MacAddress); - issue_probereq(padapter, &pmlmeinfo->network.Ssid, pmlmeinfo->network.MacAddress); + issue_probereq(padapter, + &pmlmeinfo->network.Ssid, + pmlmeinfo->network.MacAddress, + false); + issue_probereq(padapter, + &pmlmeinfo->network.Ssid, + pmlmeinfo->network.MacAddress, + false); + issue_probereq(padapter, + &pmlmeinfo->network.Ssid, + pmlmeinfo->network.MacAddress, + false); } } From afcf9bc1bfe651a208e586ec68b35a1361af2fc9 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Thu, 29 Oct 2015 16:34:06 +0530 Subject: [PATCH 080/843] staging: rtl8188eu: core: Change function parameter to bool Change int wait_ack to bool wait_ack as it only takes true or false as its argument. Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index 687f0c2206cf..a9bff48868ef 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -609,7 +609,7 @@ static void issue_probersp(struct adapter *padapter, unsigned char *da) return; } -static int issue_probereq(struct adapter *padapter, struct ndis_802_11_ssid *pssid, u8 *da, int wait_ack) +static int issue_probereq(struct adapter *padapter, struct ndis_802_11_ssid *pssid, u8 *da, bool wait_ack) { int ret = _FAIL; struct xmit_frame *pmgntframe; From bccb763d5fa25add4b374ac720052a01ba95cbca Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Thu, 29 Oct 2015 13:33:45 +0530 Subject: [PATCH 081/843] staging: rdma: amso1100: Remove unnecessary variable Drop unnecessary variable that can be replaced by single line of code. Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/amso1100/c2_rnic.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/rdma/amso1100/c2_rnic.c b/drivers/staging/rdma/amso1100/c2_rnic.c index d3c0f77767d9..5e65c6d07ca4 100644 --- a/drivers/staging/rdma/amso1100/c2_rnic.c +++ b/drivers/staging/rdma/amso1100/c2_rnic.c @@ -81,7 +81,6 @@ static int c2_adapter_init(struct c2_dev *c2dev) { struct c2wr_init_req wr; - int err; memset(&wr, 0, sizeof(wr)); c2_wr_set_id(&wr, CCWR_INIT); @@ -94,9 +93,7 @@ static int c2_adapter_init(struct c2_dev *c2dev) wr.q2_host_msg_pool = cpu_to_be64(c2dev->aeq.host_dma); /* Post the init message */ - err = vq_send_wr(c2dev, (union c2wr *) & wr); - - return err; + return vq_send_wr(c2dev, (union c2wr *) & wr); } /* From 463f8e7223ce10d12829e6d11204b1ef131d350d Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Thu, 29 Oct 2015 13:35:06 +0530 Subject: [PATCH 082/843] staging: rdma: hfi1: Remove unnecessary variable Drop unnecessary variable that can be replaced by a single line of code. Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/qsfp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rdma/hfi1/qsfp.c b/drivers/staging/rdma/hfi1/qsfp.c index ffdb1d787a80..6326a915d7fd 100644 --- a/drivers/staging/rdma/hfi1/qsfp.c +++ b/drivers/staging/rdma/hfi1/qsfp.c @@ -475,7 +475,7 @@ int qsfp_dump(struct hfi1_pportdata *ppd, char *buf, int len) u8 *cache = &ppd->qsfp_info.cache[0]; u8 bin_buff[QSFP_DUMP_CHUNK]; char lenstr[6]; - int sofar, ret; + int sofar; int bidx = 0; u8 *atten = &cache[QSFP_ATTEN_OFFS]; u8 *vendor_oui = &cache[QSFP_VOUI_OFFS]; @@ -536,6 +536,5 @@ int qsfp_dump(struct hfi1_pportdata *ppd, char *buf, int len) bidx += QSFP_DUMP_CHUNK; } } - ret = sofar; - return ret; + return sofar; } From 99d19626b3b3c6e4f6c134359e7c690320776fd9 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Sun, 1 Nov 2015 01:45:13 +0530 Subject: [PATCH 083/843] staging: rdma: amso1100: Remove extern from function declarations Functions have the extern specifier by default, so this keyword can be removed. Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/amso1100/c2.h | 80 +++++++++++++-------------- drivers/staging/rdma/amso1100/c2_mq.h | 14 ++--- drivers/staging/rdma/amso1100/c2_vq.h | 20 +++---- 3 files changed, 57 insertions(+), 57 deletions(-) diff --git a/drivers/staging/rdma/amso1100/c2.h b/drivers/staging/rdma/amso1100/c2.h index d619d735838b..21b565a91fd6 100644 --- a/drivers/staging/rdma/amso1100/c2.h +++ b/drivers/staging/rdma/amso1100/c2.h @@ -476,72 +476,72 @@ static inline int c2_errno(void *reply) } /* Device */ -extern int c2_register_device(struct c2_dev *c2dev); -extern void c2_unregister_device(struct c2_dev *c2dev); -extern int c2_rnic_init(struct c2_dev *c2dev); -extern void c2_rnic_term(struct c2_dev *c2dev); -extern void c2_rnic_interrupt(struct c2_dev *c2dev); -extern int c2_del_addr(struct c2_dev *c2dev, __be32 inaddr, __be32 inmask); -extern int c2_add_addr(struct c2_dev *c2dev, __be32 inaddr, __be32 inmask); +int c2_register_device(struct c2_dev *c2dev); +void c2_unregister_device(struct c2_dev *c2dev); +int c2_rnic_init(struct c2_dev *c2dev); +void c2_rnic_term(struct c2_dev *c2dev); +void c2_rnic_interrupt(struct c2_dev *c2dev); +int c2_del_addr(struct c2_dev *c2dev, __be32 inaddr, __be32 inmask); +int c2_add_addr(struct c2_dev *c2dev, __be32 inaddr, __be32 inmask); /* QPs */ -extern int c2_alloc_qp(struct c2_dev *c2dev, struct c2_pd *pd, +int c2_alloc_qp(struct c2_dev *c2dev, struct c2_pd *pd, struct ib_qp_init_attr *qp_attrs, struct c2_qp *qp); -extern void c2_free_qp(struct c2_dev *c2dev, struct c2_qp *qp); -extern struct ib_qp *c2_get_qp(struct ib_device *device, int qpn); -extern int c2_qp_modify(struct c2_dev *c2dev, struct c2_qp *qp, +void c2_free_qp(struct c2_dev *c2dev, struct c2_qp *qp); +struct ib_qp *c2_get_qp(struct ib_device *device, int qpn); +int c2_qp_modify(struct c2_dev *c2dev, struct c2_qp *qp, struct ib_qp_attr *attr, int attr_mask); -extern int c2_qp_set_read_limits(struct c2_dev *c2dev, struct c2_qp *qp, +int c2_qp_set_read_limits(struct c2_dev *c2dev, struct c2_qp *qp, int ord, int ird); -extern int c2_post_send(struct ib_qp *ibqp, struct ib_send_wr *ib_wr, +int c2_post_send(struct ib_qp *ibqp, struct ib_send_wr *ib_wr, struct ib_send_wr **bad_wr); -extern int c2_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *ib_wr, +int c2_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *ib_wr, struct ib_recv_wr **bad_wr); -extern void c2_init_qp_table(struct c2_dev *c2dev); -extern void c2_cleanup_qp_table(struct c2_dev *c2dev); -extern void c2_set_qp_state(struct c2_qp *, int); -extern struct c2_qp *c2_find_qpn(struct c2_dev *c2dev, int qpn); +void c2_init_qp_table(struct c2_dev *c2dev); +void c2_cleanup_qp_table(struct c2_dev *c2dev); +void c2_set_qp_state(struct c2_qp *, int); +struct c2_qp *c2_find_qpn(struct c2_dev *c2dev, int qpn); /* PDs */ -extern int c2_pd_alloc(struct c2_dev *c2dev, int privileged, struct c2_pd *pd); -extern void c2_pd_free(struct c2_dev *c2dev, struct c2_pd *pd); -extern int c2_init_pd_table(struct c2_dev *c2dev); -extern void c2_cleanup_pd_table(struct c2_dev *c2dev); +int c2_pd_alloc(struct c2_dev *c2dev, int privileged, struct c2_pd *pd); +void c2_pd_free(struct c2_dev *c2dev, struct c2_pd *pd); +int c2_init_pd_table(struct c2_dev *c2dev); +void c2_cleanup_pd_table(struct c2_dev *c2dev); /* CQs */ -extern int c2_init_cq(struct c2_dev *c2dev, int entries, +int c2_init_cq(struct c2_dev *c2dev, int entries, struct c2_ucontext *ctx, struct c2_cq *cq); -extern void c2_free_cq(struct c2_dev *c2dev, struct c2_cq *cq); -extern void c2_cq_event(struct c2_dev *c2dev, u32 mq_index); -extern void c2_cq_clean(struct c2_dev *c2dev, struct c2_qp *qp, u32 mq_index); -extern int c2_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *entry); -extern int c2_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags); +void c2_free_cq(struct c2_dev *c2dev, struct c2_cq *cq); +void c2_cq_event(struct c2_dev *c2dev, u32 mq_index); +void c2_cq_clean(struct c2_dev *c2dev, struct c2_qp *qp, u32 mq_index); +int c2_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *entry); +int c2_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags); /* CM */ -extern int c2_llp_connect(struct iw_cm_id *cm_id, +int c2_llp_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param); -extern int c2_llp_accept(struct iw_cm_id *cm_id, +int c2_llp_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param); -extern int c2_llp_reject(struct iw_cm_id *cm_id, const void *pdata, +int c2_llp_reject(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len); -extern int c2_llp_service_create(struct iw_cm_id *cm_id, int backlog); -extern int c2_llp_service_destroy(struct iw_cm_id *cm_id); +int c2_llp_service_create(struct iw_cm_id *cm_id, int backlog); +int c2_llp_service_destroy(struct iw_cm_id *cm_id); /* MM */ -extern int c2_nsmr_register_phys_kern(struct c2_dev *c2dev, u64 *addr_list, +int c2_nsmr_register_phys_kern(struct c2_dev *c2dev, u64 *addr_list, int page_size, int pbl_depth, u32 length, u32 off, u64 *va, enum c2_acf acf, struct c2_mr *mr); -extern int c2_stag_dealloc(struct c2_dev *c2dev, u32 stag_index); +int c2_stag_dealloc(struct c2_dev *c2dev, u32 stag_index); /* AE */ -extern void c2_ae_event(struct c2_dev *c2dev, u32 mq_index); +void c2_ae_event(struct c2_dev *c2dev, u32 mq_index); /* MQSP Allocator */ -extern int c2_init_mqsp_pool(struct c2_dev *c2dev, gfp_t gfp_mask, +int c2_init_mqsp_pool(struct c2_dev *c2dev, gfp_t gfp_mask, struct sp_chunk **root); -extern void c2_free_mqsp_pool(struct c2_dev *c2dev, struct sp_chunk *root); -extern __be16 *c2_alloc_mqsp(struct c2_dev *c2dev, struct sp_chunk *head, +void c2_free_mqsp_pool(struct c2_dev *c2dev, struct sp_chunk *root); +__be16 *c2_alloc_mqsp(struct c2_dev *c2dev, struct sp_chunk *head, dma_addr_t *dma_addr, gfp_t gfp_mask); -extern void c2_free_mqsp(__be16* mqsp); +void c2_free_mqsp(__be16* mqsp); #endif diff --git a/drivers/staging/rdma/amso1100/c2_mq.h b/drivers/staging/rdma/amso1100/c2_mq.h index fc1b9a7cec4b..8e1b4d13409e 100644 --- a/drivers/staging/rdma/amso1100/c2_mq.h +++ b/drivers/staging/rdma/amso1100/c2_mq.h @@ -93,14 +93,14 @@ static __inline__ int c2_mq_full(struct c2_mq *q) return q->priv == (be16_to_cpu(*q->shared) + q->q_size - 1) % q->q_size; } -extern void c2_mq_lconsume(struct c2_mq *q, u32 wqe_count); -extern void *c2_mq_alloc(struct c2_mq *q); -extern void c2_mq_produce(struct c2_mq *q); -extern void *c2_mq_consume(struct c2_mq *q); -extern void c2_mq_free(struct c2_mq *q); -extern void c2_mq_req_init(struct c2_mq *q, u32 index, u32 q_size, u32 msg_size, +void c2_mq_lconsume(struct c2_mq *q, u32 wqe_count); +void *c2_mq_alloc(struct c2_mq *q); +void c2_mq_produce(struct c2_mq *q); +void *c2_mq_consume(struct c2_mq *q); +void c2_mq_free(struct c2_mq *q); +void c2_mq_req_init(struct c2_mq *q, u32 index, u32 q_size, u32 msg_size, u8 __iomem *pool_start, u16 __iomem *peer, u32 type); -extern void c2_mq_rep_init(struct c2_mq *q, u32 index, u32 q_size, u32 msg_size, +void c2_mq_rep_init(struct c2_mq *q, u32 index, u32 q_size, u32 msg_size, u8 *pool_start, u16 __iomem *peer, u32 type); #endif /* _C2_MQ_H_ */ diff --git a/drivers/staging/rdma/amso1100/c2_vq.h b/drivers/staging/rdma/amso1100/c2_vq.h index 33805627a607..c1f6cef60213 100644 --- a/drivers/staging/rdma/amso1100/c2_vq.h +++ b/drivers/staging/rdma/amso1100/c2_vq.h @@ -47,17 +47,17 @@ struct c2_vq_req { struct c2_qp *qp; }; -extern int vq_init(struct c2_dev *c2dev); -extern void vq_term(struct c2_dev *c2dev); +int vq_init(struct c2_dev *c2dev); +void vq_term(struct c2_dev *c2dev); -extern struct c2_vq_req *vq_req_alloc(struct c2_dev *c2dev); -extern void vq_req_free(struct c2_dev *c2dev, struct c2_vq_req *req); -extern void vq_req_get(struct c2_dev *c2dev, struct c2_vq_req *req); -extern void vq_req_put(struct c2_dev *c2dev, struct c2_vq_req *req); -extern int vq_send_wr(struct c2_dev *c2dev, union c2wr * wr); +struct c2_vq_req *vq_req_alloc(struct c2_dev *c2dev); +void vq_req_free(struct c2_dev *c2dev, struct c2_vq_req *req); +void vq_req_get(struct c2_dev *c2dev, struct c2_vq_req *req); +void vq_req_put(struct c2_dev *c2dev, struct c2_vq_req *req); +int vq_send_wr(struct c2_dev *c2dev, union c2wr * wr); -extern void *vq_repbuf_alloc(struct c2_dev *c2dev); -extern void vq_repbuf_free(struct c2_dev *c2dev, void *reply); +void *vq_repbuf_alloc(struct c2_dev *c2dev); +void vq_repbuf_free(struct c2_dev *c2dev, void *reply); -extern int vq_wait_for_reply(struct c2_dev *c2dev, struct c2_vq_req *req); +int vq_wait_for_reply(struct c2_dev *c2dev, struct c2_vq_req *req); #endif /* _C2_VQ_H_ */ From 6e5b6131806d9fd05685ac6fddc297d91ea3b0ae Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Sun, 1 Nov 2015 16:14:32 +0530 Subject: [PATCH 084/843] staging: rdma: hfi1: Remove hfi1_nomsix() wrapper function This patch removes hfi1_nomsix() wrapper function that is used to wrap pci_disable_msix() and so substituted the wrapper function by a direct call to pci_disable_msix(). Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/chip.c | 2 +- drivers/staging/rdma/hfi1/hfi.h | 1 - drivers/staging/rdma/hfi1/pcie.c | 8 -------- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index e48981994b10..a6265277cfe5 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -8785,7 +8785,7 @@ static void clean_up_interrupts(struct hfi1_devdata *dd) /* turn off interrupts */ if (dd->num_msix_entries) { /* MSI-X */ - hfi1_nomsix(dd); + pci_disable_msix(dd->pcidev); } else { /* INTx */ disable_intx(dd->pcidev); diff --git a/drivers/staging/rdma/hfi1/hfi.h b/drivers/staging/rdma/hfi1/hfi.h index 190f7a2f6773..73bd966f9e41 100644 --- a/drivers/staging/rdma/hfi1/hfi.h +++ b/drivers/staging/rdma/hfi1/hfi.h @@ -1612,7 +1612,6 @@ void hfi1_pcie_flr(struct hfi1_devdata *); int pcie_speeds(struct hfi1_devdata *); void request_msix(struct hfi1_devdata *, u32 *, struct hfi1_msix_entry *); void hfi1_enable_intx(struct pci_dev *); -void hfi1_nomsix(struct hfi1_devdata *); void restore_pci_variables(struct hfi1_devdata *dd); int do_pcie_gen3_transition(struct hfi1_devdata *dd); int parse_platform_config(struct hfi1_devdata *dd); diff --git a/drivers/staging/rdma/hfi1/pcie.c b/drivers/staging/rdma/hfi1/pcie.c index a956044459a2..f531d0f6b212 100644 --- a/drivers/staging/rdma/hfi1/pcie.c +++ b/drivers/staging/rdma/hfi1/pcie.c @@ -426,14 +426,6 @@ void request_msix(struct hfi1_devdata *dd, u32 *nent, tune_pcie_caps(dd); } -/* - * Disable MSI-X. - */ -void hfi1_nomsix(struct hfi1_devdata *dd) -{ - pci_disable_msix(dd->pcidev); -} - void hfi1_enable_intx(struct pci_dev *pdev) { /* first, turn on INTx */ From 8edf75020f60b2e1572291f93e0898351d478795 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Sun, 1 Nov 2015 16:16:40 +0530 Subject: [PATCH 085/843] staging: rdma: hfi1: sdma: Remove wrapper functions Drop wrapper functions sdma_start_err_halt_wait() and sdma_start_sw_clean_up() that can be replaced by a direct call to schedule_work() and tasklet_hi_schedule() respectively both of which are standard kernel functions. Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/sdma.c | 40 +++++++++++--------------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/drivers/staging/rdma/hfi1/sdma.c b/drivers/staging/rdma/hfi1/sdma.c index 2a1da2189900..f1855457fa32 100644 --- a/drivers/staging/rdma/hfi1/sdma.c +++ b/drivers/staging/rdma/hfi1/sdma.c @@ -236,7 +236,6 @@ static void sdma_hw_clean_up_task(unsigned long); static void sdma_put(struct sdma_state *); static void sdma_set_state(struct sdma_engine *, enum sdma_states); static void sdma_start_hw_clean_up(struct sdma_engine *); -static void sdma_start_sw_clean_up(struct sdma_engine *); static void sdma_sw_clean_up_task(unsigned long); static void sdma_sendctrl(struct sdma_engine *, unsigned); static void init_sdma_regs(struct sdma_engine *, u32, uint); @@ -470,12 +469,6 @@ static void sdma_err_halt_wait(struct work_struct *work) sdma_process_event(sde, sdma_event_e15_hw_halt_done); } -static void sdma_start_err_halt_wait(struct sdma_engine *sde) -{ - schedule_work(&sde->err_halt_worker); -} - - static void sdma_err_progress_check_schedule(struct sdma_engine *sde) { if (!is_bx(sde->dd) && HFI1_CAP_IS_KSET(SDMA_AHG)) { @@ -682,11 +675,6 @@ static void sdma_start_hw_clean_up(struct sdma_engine *sde) tasklet_hi_schedule(&sde->sdma_hw_clean_up_task); } -static void sdma_start_sw_clean_up(struct sdma_engine *sde) -{ - tasklet_hi_schedule(&sde->sdma_sw_clean_up_task); -} - static void sdma_set_state(struct sdma_engine *sde, enum sdma_states next_state) { @@ -2308,7 +2296,7 @@ static void __sdma_process_event(struct sdma_engine *sde, case sdma_event_e50_hw_cleaned: break; case sdma_event_e60_hw_halted: - sdma_start_err_halt_wait(sde); + schedule_work(&sde->err_halt_worker); break; case sdma_event_e70_go_idle: ss->go_s99_running = 0; @@ -2389,7 +2377,7 @@ static void __sdma_process_event(struct sdma_engine *sde, break; case sdma_event_e60_hw_halted: sdma_set_state(sde, sdma_state_s50_hw_halt_wait); - sdma_start_err_halt_wait(sde); + schedule_work(&sde->err_halt_worker); break; case sdma_event_e70_go_idle: break; @@ -2452,7 +2440,7 @@ static void __sdma_process_event(struct sdma_engine *sde, switch (event) { case sdma_event_e00_go_hw_down: sdma_set_state(sde, sdma_state_s00_hw_down); - sdma_start_sw_clean_up(sde); + tasklet_hi_schedule(&sde->sdma_sw_clean_up_task); break; case sdma_event_e10_go_hw_start: break; @@ -2494,13 +2482,13 @@ static void __sdma_process_event(struct sdma_engine *sde, switch (event) { case sdma_event_e00_go_hw_down: sdma_set_state(sde, sdma_state_s00_hw_down); - sdma_start_sw_clean_up(sde); + tasklet_hi_schedule(&sde->sdma_sw_clean_up_task); break; case sdma_event_e10_go_hw_start: break; case sdma_event_e15_hw_halt_done: sdma_set_state(sde, sdma_state_s30_sw_clean_up_wait); - sdma_start_sw_clean_up(sde); + tasklet_hi_schedule(&sde->sdma_sw_clean_up_task); break; case sdma_event_e25_hw_clean_up_done: break; @@ -2512,7 +2500,7 @@ static void __sdma_process_event(struct sdma_engine *sde, case sdma_event_e50_hw_cleaned: break; case sdma_event_e60_hw_halted: - sdma_start_err_halt_wait(sde); + schedule_work(&sde->err_halt_worker); break; case sdma_event_e70_go_idle: ss->go_s99_running = 0; @@ -2535,13 +2523,13 @@ static void __sdma_process_event(struct sdma_engine *sde, switch (event) { case sdma_event_e00_go_hw_down: sdma_set_state(sde, sdma_state_s00_hw_down); - sdma_start_sw_clean_up(sde); + tasklet_hi_schedule(&sde->sdma_sw_clean_up_task); break; case sdma_event_e10_go_hw_start: break; case sdma_event_e15_hw_halt_done: sdma_set_state(sde, sdma_state_s30_sw_clean_up_wait); - sdma_start_sw_clean_up(sde); + tasklet_hi_schedule(&sde->sdma_sw_clean_up_task); break; case sdma_event_e25_hw_clean_up_done: break; @@ -2553,7 +2541,7 @@ static void __sdma_process_event(struct sdma_engine *sde, case sdma_event_e50_hw_cleaned: break; case sdma_event_e60_hw_halted: - sdma_start_err_halt_wait(sde); + schedule_work(&sde->err_halt_worker); break; case sdma_event_e70_go_idle: ss->go_s99_running = 0; @@ -2575,7 +2563,7 @@ static void __sdma_process_event(struct sdma_engine *sde, switch (event) { case sdma_event_e00_go_hw_down: sdma_set_state(sde, sdma_state_s00_hw_down); - sdma_start_sw_clean_up(sde); + tasklet_hi_schedule(&sde->sdma_sw_clean_up_task); break; case sdma_event_e10_go_hw_start: break; @@ -2599,7 +2587,7 @@ static void __sdma_process_event(struct sdma_engine *sde, break; case sdma_event_e81_hw_frozen: sdma_set_state(sde, sdma_state_s82_freeze_sw_clean); - sdma_start_sw_clean_up(sde); + tasklet_hi_schedule(&sde->sdma_sw_clean_up_task); break; case sdma_event_e82_hw_unfreeze: break; @@ -2614,7 +2602,7 @@ static void __sdma_process_event(struct sdma_engine *sde, switch (event) { case sdma_event_e00_go_hw_down: sdma_set_state(sde, sdma_state_s00_hw_down); - sdma_start_sw_clean_up(sde); + tasklet_hi_schedule(&sde->sdma_sw_clean_up_task); break; case sdma_event_e10_go_hw_start: break; @@ -2658,7 +2646,7 @@ static void __sdma_process_event(struct sdma_engine *sde, switch (event) { case sdma_event_e00_go_hw_down: sdma_set_state(sde, sdma_state_s00_hw_down); - sdma_start_sw_clean_up(sde); + tasklet_hi_schedule(&sde->sdma_sw_clean_up_task); break; case sdma_event_e10_go_hw_start: break; @@ -2681,7 +2669,7 @@ static void __sdma_process_event(struct sdma_engine *sde, * progress check */ sdma_set_state(sde, sdma_state_s50_hw_halt_wait); - sdma_start_err_halt_wait(sde); + schedule_work(&sde->err_halt_worker); break; case sdma_event_e70_go_idle: sdma_set_state(sde, sdma_state_s60_idle_halt_wait); From 66c0933b30ae27ded1a48944381c9d05feff1979 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Sun, 1 Nov 2015 16:18:18 +0530 Subject: [PATCH 086/843] staging: rdma: hfi1: chip: Remove wrapper function Drop wrapper function remap_receive_available_interrupt() that wraps a call to remap_intr() with the only difference being the addition of macro IS_RCVAVAIL_START to the second argument of remap_intr(). Both the function names give the same information so the wrapper function can be dropped. Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/chip.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index a6265277cfe5..4e22477c9739 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -8840,12 +8840,6 @@ static void remap_sdma_interrupts(struct hfi1_devdata *dd, msix_intr); } -static void remap_receive_available_interrupt(struct hfi1_devdata *dd, - int rx, int msix_intr) -{ - remap_intr(dd, IS_RCVAVAIL_START + rx, msix_intr); -} - static int request_intx_irq(struct hfi1_devdata *dd) { int ret; @@ -8983,7 +8977,7 @@ static int request_msix_irqs(struct hfi1_devdata *dd) snprintf(me->name, sizeof(me->name), DRIVER_NAME"_%d kctxt%d", dd->unit, idx); err_info = "receive context"; - remap_receive_available_interrupt(dd, idx, i); + remap_intr(dd, IS_RCVAVAIL_START + idx, i); } else { /* not in our expected range - complain, then ignore it */ From 2592872f3b0b79b2247d6a40331a3761299041ac Mon Sep 17 00:00:00 2001 From: Burcin Akalin Date: Thu, 29 Oct 2015 18:54:06 +0300 Subject: [PATCH 087/843] staging: vt6656: Do not use multiple blank lines. Remove multiple blank lines. Problem found using checkpatch.pl "CHECK: Please don't use multiple blank lines" Signed-off-by: Burcin Akalin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/key.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/vt6656/key.c b/drivers/staging/vt6656/key.c index 181745d8e250..1898fef1519c 100644 --- a/drivers/staging/vt6656/key.c +++ b/drivers/staging/vt6656/key.c @@ -163,7 +163,6 @@ int vnt_set_keys(struct ieee80211_hw *hw, struct ieee80211_sta *sta, key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; } - if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) { vnt_set_keymode(hw, mac_addr, key, VNT_KEY_PAIRWISE, key_dec_mode, true); From 165483c6337d25c00d9eb18271bc99f75f1dd8b6 Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Thu, 29 Oct 2015 13:42:38 -0700 Subject: [PATCH 088/843] Staging: rtl8723au: Remove unused EFUSE_Write1Byte function Function is defined but not used, so remove it. Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_efuse.c | 42 ---------------------- 1 file changed, 42 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_efuse.c b/drivers/staging/rtl8723au/core/rtw_efuse.c index 906b5782d165..5e8a1ba8a8b9 100644 --- a/drivers/staging/rtl8723au/core/rtw_efuse.c +++ b/drivers/staging/rtl8723au/core/rtw_efuse.c @@ -273,48 +273,6 @@ u8 EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address) return 0xFF; } -/* Copy from WMAC fot EFUSE write 1 byte. */ -void EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value) -{ - u8 Bytetemp = {0x00}; - u8 temp = {0x00}; - u32 k = 0; - u16 contentLen = 0; - - EFUSE_GetEfuseDefinition23a(Adapter, EFUSE_WIFI, - TYPE_EFUSE_REAL_CONTENT_LEN, - (void *)&contentLen); - - if (Address < contentLen) { /* E-fuse 512Byte */ - rtl8723au_write8(Adapter, EFUSE_CTRL, Value); - - /* Write E-fuse Register address bit0~7 */ - temp = Address & 0xFF; - rtl8723au_write8(Adapter, EFUSE_CTRL+1, temp); - Bytetemp = rtl8723au_read8(Adapter, EFUSE_CTRL+2); - - /* Write E-fuse Register address bit8~9 */ - temp = ((Address >> 8) & 0x03) | (Bytetemp & 0xFC); - rtl8723au_write8(Adapter, EFUSE_CTRL+2, temp); - - /* Write 0x30[31]= 1 */ - Bytetemp = rtl8723au_read8(Adapter, EFUSE_CTRL+3); - temp = Bytetemp | 0x80; - rtl8723au_write8(Adapter, EFUSE_CTRL+3, temp); - - /* Wait Write-ready (0x30[31]= 0) */ - Bytetemp = rtl8723au_read8(Adapter, EFUSE_CTRL+3); - while (Bytetemp & 0x80) { - Bytetemp = rtl8723au_read8(Adapter, EFUSE_CTRL+3); - k++; - if (k == 100) { - k = 0; - break; - } - } - } -} - /* Read one byte from real Efuse. */ int efuse_OneByteRead23a(struct rtw_adapter *pAdapter, u16 addr, u8 *data) { From 84295526a5797f7dfd75bba3d9438074f46ad7aa Mon Sep 17 00:00:00 2001 From: Ksenija Stanojevic Date: Thu, 29 Oct 2015 13:43:41 -0700 Subject: [PATCH 089/843] Staging: rtl8723au: Declare function static Declare function Efuse_ReadAllMap as static since it's defined and used only in this file. Signed-off-by: Ksenija Stanojevic Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_efuse.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723au/core/rtw_efuse.c b/drivers/staging/rtl8723au/core/rtw_efuse.c index 5e8a1ba8a8b9..f174b4d1a018 100644 --- a/drivers/staging/rtl8723au/core/rtw_efuse.c +++ b/drivers/staging/rtl8723au/core/rtw_efuse.c @@ -459,7 +459,8 @@ int rtw_BT_efuse_map_read23a(struct rtw_adapter *padapter, } /* Read All Efuse content */ -void Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse) +static void Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, + u8 *Efuse) { u16 mapLen = 0; From d8340ed0446cd2195db92980beb4ff575e35e0a1 Mon Sep 17 00:00:00 2001 From: Burcin Akalin Date: Fri, 30 Oct 2015 03:29:08 +0300 Subject: [PATCH 090/843] staging: nvec:Misspelled the word Word error correction.Problem found using checkpatch.pl CHECK: 'Implemenation' may be misspelled - perhaps 'Implementation'? Signed-off-by: Burcin Akalin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/nvec/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/nvec/README b/drivers/staging/nvec/README index 9a320b7fdbe6..0e2d5c4c875f 100644 --- a/drivers/staging/nvec/README +++ b/drivers/staging/nvec/README @@ -1,4 +1,4 @@ -NVEC: An NVidia compliant Embedded Controller Protocol Implemenation +NVEC: An NVidia compliant Embedded Controller Protocol Implementation This is an implementation of the NVEC protocol used to communicate with an embedded controller (EC) via I2C bus. The EC is an I2C master while the host From a9548c223e08d5d022cb6e5daf64c3bb1ca41aa5 Mon Sep 17 00:00:00 2001 From: Burcin Akalin Date: Fri, 30 Oct 2015 03:04:03 +0300 Subject: [PATCH 091/843] staging: nvec: Add space around '>>' Add space around operator '>>'. Problem found using checkpatch.pl CHECK: spaces preferred around that '>>' (ctx:VxV) Signed-off-by: Burcin Akalin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/nvec/nvec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index 802c9597d421..ba030ab22e9b 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c @@ -740,7 +740,7 @@ static void tegra_init_i2c_slave(struct nvec_chip *nvec) writel(I2C_SL_NEWSL, nvec->base + I2C_SL_CNFG); writel(0x1E, nvec->base + I2C_SL_DELAY_COUNT); - writel(nvec->i2c_addr>>1, nvec->base + I2C_SL_ADDR1); + writel(nvec->i2c_addr >> 1, nvec->base + I2C_SL_ADDR1); writel(0, nvec->base + I2C_SL_ADDR2); enable_irq(nvec->irq); From b4129f2f53311804ee394fa80539710ab09a8401 Mon Sep 17 00:00:00 2001 From: Burcin Akalin Date: Fri, 30 Oct 2015 02:49:01 +0300 Subject: [PATCH 092/843] staging: nvec: Add space around '<<' Add space around operator '<<'. Problem found using checkpatch.pl CHECK: spaces preferred around that '<<' (ctx:VxV) Signed-off-by: Burcin Akalin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/nvec/nvec.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index ba030ab22e9b..4ae44a5168f9 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c @@ -40,18 +40,18 @@ #include "nvec.h" #define I2C_CNFG 0x00 -#define I2C_CNFG_PACKET_MODE_EN (1<<10) -#define I2C_CNFG_NEW_MASTER_SFM (1<<11) +#define I2C_CNFG_PACKET_MODE_EN (1 << 10) +#define I2C_CNFG_NEW_MASTER_SFM (1 << 11) #define I2C_CNFG_DEBOUNCE_CNT_SHIFT 12 #define I2C_SL_CNFG 0x20 -#define I2C_SL_NEWSL (1<<2) -#define I2C_SL_NACK (1<<1) -#define I2C_SL_RESP (1<<0) -#define I2C_SL_IRQ (1<<3) -#define END_TRANS (1<<4) -#define RCVD (1<<2) -#define RNW (1<<1) +#define I2C_SL_NEWSL (1 << 2) +#define I2C_SL_NACK (1 << 1) +#define I2C_SL_RESP (1 << 0) +#define I2C_SL_IRQ (1 << 3) +#define END_TRANS (1 << 4) +#define RCVD (1 << 2) +#define RNW (1 << 1) #define I2C_SL_RCVD 0x24 #define I2C_SL_STATUS 0x28 From ca3fde19d47ef6edbee4c6ca7e824de0382abe67 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Fri, 30 Oct 2015 02:29:03 +0530 Subject: [PATCH 093/843] staging: gdm724x: Remove wrapper function Remove wrapper function that can be replaced by a single line of code. Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm724x/gdm_lte.c | 2 +- drivers/staging/gdm724x/netlink_k.c | 5 ----- drivers/staging/gdm724x/netlink_k.h | 1 - 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/staging/gdm724x/gdm_lte.c b/drivers/staging/gdm724x/gdm_lte.c index 79de678807cc..17d148f6e02c 100644 --- a/drivers/staging/gdm724x/gdm_lte.c +++ b/drivers/staging/gdm724x/gdm_lte.c @@ -555,7 +555,7 @@ int gdm_lte_event_init(void) void gdm_lte_event_exit(void) { if (lte_event.sock && --lte_event.ref_cnt == 0) { - netlink_exit(lte_event.sock); + sock_release(lte_event.sock->sk_socket); lte_event.sock = NULL; } } diff --git a/drivers/staging/gdm724x/netlink_k.c b/drivers/staging/gdm724x/netlink_k.c index 92254fdaae1e..9d8347769e88 100644 --- a/drivers/staging/gdm724x/netlink_k.c +++ b/drivers/staging/gdm724x/netlink_k.c @@ -107,11 +107,6 @@ struct sock *netlink_init(int unit, return sock; } -void netlink_exit(struct sock *sock) -{ - sock_release(sock->sk_socket); -} - int netlink_send(struct sock *sock, int group, u16 type, void *msg, int len) { static u32 seq; diff --git a/drivers/staging/gdm724x/netlink_k.h b/drivers/staging/gdm724x/netlink_k.h index 589486d76714..7cf979b3f826 100644 --- a/drivers/staging/gdm724x/netlink_k.h +++ b/drivers/staging/gdm724x/netlink_k.h @@ -19,7 +19,6 @@ struct sock *netlink_init(int unit, void (*cb)(struct net_device *dev, u16 type, void *msg, int len)); -void netlink_exit(struct sock *sock); int netlink_send(struct sock *sock, int group, u16 type, void *msg, int len); #endif /* _NETLINK_K_H_ */ From b0035ef7552e222e7b0d07644a3234350d8bba8e Mon Sep 17 00:00:00 2001 From: Burcin Akalin Date: Fri, 30 Oct 2015 04:01:01 +0300 Subject: [PATCH 094/843] staging: octeon: Add space around '+' Add space around operator '+'. Problem found using checkpatch.pl CHECK: spaces preferred around that '+' (ctx:VxV) Signed-off-by: Burcin Akalin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/octeon/ethernet-defines.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/octeon/ethernet-defines.h b/drivers/staging/octeon/ethernet-defines.h index 13e4cee1f86d..07bd2b87f6a0 100644 --- a/drivers/staging/octeon/ethernet-defines.h +++ b/drivers/staging/octeon/ethernet-defines.h @@ -40,6 +40,6 @@ #define FAU_TOTAL_TX_TO_CLEAN (CVMX_FAU_REG_END - sizeof(u32)) #define FAU_NUM_PACKET_BUFFERS_TO_FREE (FAU_TOTAL_TX_TO_CLEAN - sizeof(u32)) -#define TOTAL_NUMBER_OF_PORTS (CVMX_PIP_NUM_INPUT_PORTS+1) +#define TOTAL_NUMBER_OF_PORTS (CVMX_PIP_NUM_INPUT_PORTS + 1) #endif /* __ETHERNET_DEFINES_H__ */ From cdfeaae5b3034d630528d044f7bc72e209321517 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Fri, 30 Oct 2015 19:33:02 +0530 Subject: [PATCH 095/843] Staging: sm750fb: Remove unused modedb.h file The header file modedb.h is only included in sm750.c but the things defined by modedb.h are not used anywhere in sm750.c. Thus, drop the include in sm750.c and modedb.h can be dropped completely. Signed-off-by: Shraddha Barke Acked-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/sm750fb/modedb.h | 233 ------------------------------- drivers/staging/sm750fb/sm750.c | 2 - 2 files changed, 235 deletions(-) delete mode 100644 drivers/staging/sm750fb/modedb.h diff --git a/drivers/staging/sm750fb/modedb.h b/drivers/staging/sm750fb/modedb.h deleted file mode 100644 index 83cb2e2ae51a..000000000000 --- a/drivers/staging/sm750fb/modedb.h +++ /dev/null @@ -1,233 +0,0 @@ - -static const struct fb_videomode modedb2[] = { - { - /* 640x400 @ 70 Hz, 31.5 kHz hsync */ - NULL, 70, 640, 400, 39721, 40, 24, 39, 9, 96, 2, - 0, FB_VMODE_NONINTERLACED - }, { - /* 640x480 @ 60 Hz, 31.5 kHz hsync */ - NULL, 60, 640, 480, 39721, 40, 24, 32, 11, 96, 2, - 0, FB_VMODE_NONINTERLACED - }, { - /* 800x600 @ 56 Hz, 35.15 kHz hsync */ - NULL, 56, 800, 600, 27777, 128, 24, 22, 1, 72, 2, - 0, FB_VMODE_NONINTERLACED - }, { - /* 1024x768 @ 87 Hz interlaced, 35.5 kHz hsync */ - NULL, 87, 1024, 768, 22271, 56, 24, 33, 8, 160, 8, - 0, FB_VMODE_INTERLACED - }, { - /* 640x400 @ 85 Hz, 37.86 kHz hsync */ - NULL, 85, 640, 400, 31746, 96, 32, 41, 1, 64, 3, - FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED - }, { - /* 640x480 @ 72 Hz, 36.5 kHz hsync */ - NULL, 72, 640, 480, 31746, 144, 40, 30, 8, 40, 3, - 0, FB_VMODE_NONINTERLACED - }, { - /* 640x480 @ 75 Hz, 37.50 kHz hsync */ - NULL, 75, 640, 480, 31746, 120, 16, 16, 1, 64, 3, - 0, FB_VMODE_NONINTERLACED - }, { - /* 800x600 @ 60 Hz, 37.8 kHz hsync */ - NULL, 60, 800, 600, 25000, 88, 40, 23, 1, 128, 4, - FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_NONINTERLACED - }, { - /* 640x480 @ 85 Hz, 43.27 kHz hsync */ - NULL, 85, 640, 480, 27777, 80, 56, 25, 1, 56, 3, - 0, FB_VMODE_NONINTERLACED - }, { - /* 1152x864 @ 89 Hz interlaced, 44 kHz hsync */ - NULL, 69, 1152, 864, 15384, 96, 16, 110, 1, 216, 10, - 0, FB_VMODE_INTERLACED - }, { - /* 800x600 @ 72 Hz, 48.0 kHz hsync */ - NULL, 72, 800, 600, 20000, 64, 56, 23, 37, 120, 6, - FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_NONINTERLACED - }, { - /* 1024x768 @ 60 Hz, 48.4 kHz hsync */ - NULL, 60, 1024, 768, 15384, 168, 8, 29, 3, 144, 6, - 0, FB_VMODE_NONINTERLACED - }, { - /* 640x480 @ 100 Hz, 53.01 kHz hsync */ - NULL, 100, 640, 480, 21834, 96, 32, 36, 8, 96, 6, - 0, FB_VMODE_NONINTERLACED - }, { - /* 1152x864 @ 60 Hz, 53.5 kHz hsync */ - NULL, 60, 1152, 864, 11123, 208, 64, 16, 4, 256, 8, - 0, FB_VMODE_NONINTERLACED - }, { - /* 800x600 @ 85 Hz, 55.84 kHz hsync */ - NULL, 85, 800, 600, 16460, 160, 64, 36, 16, 64, 5, - 0, FB_VMODE_NONINTERLACED - }, { - /* 1024x768 @ 70 Hz, 56.5 kHz hsync */ - NULL, 70, 1024, 768, 13333, 144, 24, 29, 3, 136, 6, - 0, FB_VMODE_NONINTERLACED - }, { - /* 1280x960-60 VESA */ - NULL, 60, 1280, 960, 9259, 312, 96, 36, 1, 112, 3, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA - }, { - /* 1280x1024-60 VESA */ - NULL, 60, 1280, 1024, 9259, 248, 48, 38, 1, 112, 3, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA - }, { - /* 1280x1024 @ 87 Hz interlaced, 51 kHz hsync */ - NULL, 87, 1280, 1024, 12500, 56, 16, 128, 1, 216, 12, - 0, FB_VMODE_INTERLACED - }, { - /* 800x600 @ 100 Hz, 64.02 kHz hsync */ - NULL, 100, 800, 600, 14357, 160, 64, 30, 4, 64, 6, - 0, FB_VMODE_NONINTERLACED - }, { - /* 1024x768 @ 76 Hz, 62.5 kHz hsync */ - NULL, 76, 1024, 768, 11764, 208, 8, 36, 16, 120, 3, - 0, FB_VMODE_NONINTERLACED - }, { - /* 1152x864 @ 70 Hz, 62.4 kHz hsync */ - NULL, 70, 1152, 864, 10869, 106, 56, 20, 1, 160, 10, - 0, FB_VMODE_NONINTERLACED - }, { - /* 1280x1024 @ 61 Hz, 64.2 kHz hsync */ - NULL, 61, 1280, 1024, 9090, 200, 48, 26, 1, 184, 3, - 0, FB_VMODE_NONINTERLACED - }, { - /* 1400x1050 @ 60Hz, 63.9 kHz hsync */ - NULL, 68, 1400, 1050, 9259, 136, 40, 13, 1, 112, 3, - 0, FB_VMODE_NONINTERLACED - }, { - /* 1400x1050 @ 75,107 Hz, 82,392 kHz +hsync +vsync*/ - NULL, 75, 1400, 1050, 9271, 120, 56, 13, 0, 112, 3, - FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_NONINTERLACED - }, { - /* 1400x1050 @ 60 Hz, ? kHz +hsync +vsync*/ - NULL, 60, 1400, 1050, 9259, 128, 40, 12, 0, 112, 3, - FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_NONINTERLACED - }, { - /* 1024x768 @ 85 Hz, 70.24 kHz hsync */ - NULL, 85, 1024, 768, 10111, 192, 32, 34, 14, 160, 6, - 0, FB_VMODE_NONINTERLACED - }, { - /* 1152x864 @ 78 Hz, 70.8 kHz hsync */ - NULL, 78, 1152, 864, 9090, 228, 88, 32, 0, 84, 12, - 0, FB_VMODE_NONINTERLACED - }, { - /* 1280x1024 @ 70 Hz, 74.59 kHz hsync */ - NULL, 70, 1280, 1024, 7905, 224, 32, 28, 8, 160, 8, - 0, FB_VMODE_NONINTERLACED - }, { - /* 1600x1200 @ 60Hz, 75.00 kHz hsync */ - NULL, 60, 1600, 1200, 6172, 304, 64, 46, 1, 192, 3, - FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_NONINTERLACED - }, { - /* 1152x864 @ 84 Hz, 76.0 kHz hsync */ - NULL, 84, 1152, 864, 7407, 184, 312, 32, 0, 128, 12, - 0, FB_VMODE_NONINTERLACED - }, { - /* 1280x1024 @ 74 Hz, 78.85 kHz hsync */ - NULL, 74, 1280, 1024, 7407, 256, 32, 34, 3, 144, 3, - 0, FB_VMODE_NONINTERLACED - }, { - /* 1024x768 @ 100Hz, 80.21 kHz hsync */ - NULL, 100, 1024, 768, 8658, 192, 32, 21, 3, 192, 10, - 0, FB_VMODE_NONINTERLACED - }, { - /* 1280x1024 @ 76 Hz, 81.13 kHz hsync */ - NULL, 76, 1280, 1024, 7407, 248, 32, 34, 3, 104, 3, - 0, FB_VMODE_NONINTERLACED - }, { - /* 1600x1200 @ 70 Hz, 87.50 kHz hsync */ - NULL, 70, 1600, 1200, 5291, 304, 64, 46, 1, 192, 3, - 0, FB_VMODE_NONINTERLACED - }, { - /* 1152x864 @ 100 Hz, 89.62 kHz hsync */ - NULL, 100, 1152, 864, 7264, 224, 32, 17, 2, 128, 19, - 0, FB_VMODE_NONINTERLACED - }, { - /* 1280x1024 @ 85 Hz, 91.15 kHz hsync */ - NULL, 85, 1280, 1024, 6349, 224, 64, 44, 1, 160, 3, - FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_NONINTERLACED - }, { - /* 1600x1200 @ 75 Hz, 93.75 kHz hsync */ - NULL, 75, 1600, 1200, 4938, 304, 64, 46, 1, 192, 3, - FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_NONINTERLACED - }, { - /* 1600x1200 @ 85 Hz, 105.77 kHz hsync */ - NULL, 85, 1600, 1200, 4545, 272, 16, 37, 4, 192, 3, - FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_NONINTERLACED - }, { - /* 1280x1024 @ 100 Hz, 107.16 kHz hsync */ - NULL, 100, 1280, 1024, 5502, 256, 32, 26, 7, 128, 15, - 0, FB_VMODE_NONINTERLACED - }, { - /* 1800x1440 @ 64Hz, 96.15 kHz hsync */ - NULL, 64, 1800, 1440, 4347, 304, 96, 46, 1, 192, 3, - FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_NONINTERLACED - }, { - /* 1800x1440 @ 70Hz, 104.52 kHz hsync */ - NULL, 70, 1800, 1440, 4000, 304, 96, 46, 1, 192, 3, - FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_NONINTERLACED - }, { - /* 512x384 @ 78 Hz, 31.50 kHz hsync */ - NULL, 78, 512, 384, 49603, 48, 16, 16, 1, 64, 3, - 0, FB_VMODE_NONINTERLACED - }, { - /* 512x384 @ 85 Hz, 34.38 kHz hsync */ - NULL, 85, 512, 384, 45454, 48, 16, 16, 1, 64, 3, - 0, FB_VMODE_NONINTERLACED - }, { - /* 320x200 @ 70 Hz, 31.5 kHz hsync, 8:5 aspect ratio */ - NULL, 70, 320, 200, 79440, 16, 16, 20, 4, 48, 1, - 0, FB_VMODE_DOUBLE - }, { - /* 320x240 @ 60 Hz, 31.5 kHz hsync, 4:3 aspect ratio */ - NULL, 60, 320, 240, 79440, 16, 16, 16, 5, 48, 1, - 0, FB_VMODE_DOUBLE - }, { - /* 320x240 @ 72 Hz, 36.5 kHz hsync */ - NULL, 72, 320, 240, 63492, 16, 16, 16, 4, 48, 2, - 0, FB_VMODE_DOUBLE - }, { - /* 400x300 @ 56 Hz, 35.2 kHz hsync, 4:3 aspect ratio */ - NULL, 56, 400, 300, 55555, 64, 16, 10, 1, 32, 1, - 0, FB_VMODE_DOUBLE - }, { - /* 400x300 @ 60 Hz, 37.8 kHz hsync */ - NULL, 60, 400, 300, 50000, 48, 16, 11, 1, 64, 2, - 0, FB_VMODE_DOUBLE - }, { - /* 400x300 @ 72 Hz, 48.0 kHz hsync */ - NULL, 72, 400, 300, 40000, 32, 24, 11, 19, 64, 3, - 0, FB_VMODE_DOUBLE - }, { - /* 480x300 @ 56 Hz, 35.2 kHz hsync, 8:5 aspect ratio */ - NULL, 56, 480, 300, 46176, 80, 16, 10, 1, 40, 1, - 0, FB_VMODE_DOUBLE - }, { - /* 480x300 @ 60 Hz, 37.8 kHz hsync */ - NULL, 60, 480, 300, 41858, 56, 16, 11, 1, 80, 2, - 0, FB_VMODE_DOUBLE - }, { - /* 480x300 @ 63 Hz, 39.6 kHz hsync */ - NULL, 63, 480, 300, 40000, 56, 16, 11, 1, 80, 2, - 0, FB_VMODE_DOUBLE - }, { - /* 480x300 @ 72 Hz, 48.0 kHz hsync */ - NULL, 72, 480, 300, 33386, 40, 24, 11, 19, 80, 3, - 0, FB_VMODE_DOUBLE - }, -}; -static const int nmodedb2 = sizeof(modedb2); diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 860e1c288ad5..c78421b5b0e7 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -21,8 +21,6 @@ #include "sm750_accel.h" #include "sm750_cursor.h" -#include "modedb.h" - /* * #ifdef __BIG_ENDIAN * ssize_t lynxfb_ops_write(struct fb_info *info, const char __user *buf, From b4f286a953f0d9582fc5ec5d823afc6035470461 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Fri, 30 Oct 2015 19:33:03 +0530 Subject: [PATCH 096/843] Staging: dgnc: Remove unused #include header file Since the things defined by digi.h are not used in dgnc_utils.c, remove the header from this file. Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_utils.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/dgnc/dgnc_utils.c b/drivers/staging/dgnc/dgnc_utils.c index f76de82908d3..95272f4765fc 100644 --- a/drivers/staging/dgnc/dgnc_utils.c +++ b/drivers/staging/dgnc/dgnc_utils.c @@ -1,7 +1,6 @@ #include #include #include "dgnc_utils.h" -#include "digi.h" /* * dgnc_ms_sleep() From 4e2cdf9324e93eef2e06f640d001979368f1e2b7 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Sat, 31 Oct 2015 15:51:04 +0530 Subject: [PATCH 097/843] staging: wlan-ng: Remove wrapper function Remove wrapper function that can be replaced by a single line of code. Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/hfa384x_usb.c | 4 ++-- drivers/staging/wlan-ng/prism2mgmt.h | 1 - drivers/staging/wlan-ng/prism2sta.c | 21 --------------------- 3 files changed, 2 insertions(+), 24 deletions(-) diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c index 444ebed7313a..e3c9860fb2cb 100644 --- a/drivers/staging/wlan-ng/hfa384x_usb.c +++ b/drivers/staging/wlan-ng/hfa384x_usb.c @@ -3504,7 +3504,7 @@ static void hfa384x_usbin_rx(wlandevice_t *wlandev, struct sk_buff *skb) rxmeta->signal = usbin->rxfrm.desc.signal - hw->dbmadjust; rxmeta->noise = usbin->rxfrm.desc.silence - hw->dbmadjust; - prism2sta_ev_rx(wlandev, skb); + p80211netdev_rx(wlandev, skb); break; @@ -3628,7 +3628,7 @@ static void hfa384x_int_rxmonitor(wlandevice_t *wlandev, } /* pass it back up */ - prism2sta_ev_rx(wlandev, skb); + p80211netdev_rx(wlandev, skb); } /*---------------------------------------------------------------- diff --git a/drivers/staging/wlan-ng/prism2mgmt.h b/drivers/staging/wlan-ng/prism2mgmt.h index 16f123959104..7a9f424607b7 100644 --- a/drivers/staging/wlan-ng/prism2mgmt.h +++ b/drivers/staging/wlan-ng/prism2mgmt.h @@ -68,7 +68,6 @@ u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate); void prism2sta_ev_info(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf); void prism2sta_ev_txexc(wlandevice_t *wlandev, u16 status); void prism2sta_ev_tx(wlandevice_t *wlandev, u16 status); -void prism2sta_ev_rx(wlandevice_t *wlandev, struct sk_buff *skb); void prism2sta_ev_alloc(wlandevice_t *wlandev); int prism2mgmt_mibset_mibget(wlandevice_t *wlandev, void *msgp); diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c index c57f48a1d8df..131223afd918 100644 --- a/drivers/staging/wlan-ng/prism2sta.c +++ b/drivers/staging/wlan-ng/prism2sta.c @@ -1836,27 +1836,6 @@ void prism2sta_ev_tx(wlandevice_t *wlandev, u16 status) wlandev->netdev->stats.tx_packets++; } -/* - * prism2sta_ev_rx - * - * Handles the Rx event. - * - * Arguments: - * wlandev wlan device structure - * - * Returns: - * nothing - * - * Side effects: - * - * Call context: - * interrupt - */ -void prism2sta_ev_rx(wlandevice_t *wlandev, struct sk_buff *skb) -{ - p80211netdev_rx(wlandev, skb); -} - /* * prism2sta_ev_alloc * From 6ba714bb5f78d8d5647e8b8afbb739223c5a4620 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Sat, 31 Oct 2015 15:47:38 +0530 Subject: [PATCH 098/843] staging: wlan-ng: hfa384x_usb: Remove wrapper function Remove wrapper function that can be replaced by a single line of code. As a result of the change, there is an unused variable which has also been removed in this patch. Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/hfa384x_usb.c | 30 +-------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c index e3c9860fb2cb..7551ac25d89d 100644 --- a/drivers/staging/wlan-ng/hfa384x_usb.c +++ b/drivers/staging/wlan-ng/hfa384x_usb.c @@ -177,9 +177,6 @@ static void hfa384x_usbin_rx(wlandevice_t *wlandev, struct sk_buff *skb); static void hfa384x_usbin_info(wlandevice_t *wlandev, hfa384x_usbin_t *usbin); -static void -hfa384x_usbout_tx(wlandevice_t *wlandev, hfa384x_usbout_t *usbout); - static void hfa384x_usbin_ctlx(hfa384x_t *hw, hfa384x_usbin_t *usbin, int urb_status); @@ -3674,7 +3671,6 @@ static void hfa384x_usbin_info(wlandevice_t *wlandev, hfa384x_usbin_t *usbin) static void hfa384x_usbout_callback(struct urb *urb) { wlandevice_t *wlandev = urb->context; - hfa384x_usbout_t *usbout = urb->transfer_buffer; #ifdef DEBUG_USB dbprint_urb(urb); @@ -3683,7 +3679,7 @@ static void hfa384x_usbout_callback(struct urb *urb) if (wlandev && wlandev->netdev) { switch (urb->status) { case 0: - hfa384x_usbout_tx(wlandev, usbout); + prism2sta_ev_alloc(wlandev); break; case -EPIPE: @@ -4037,30 +4033,6 @@ static int hfa384x_usbctlx_submit(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx) return 0; } -/*---------------------------------------------------------------- -* hfa384x_usbout_tx -* -* At this point we have finished a send of a frame. Mark the URB -* as available and call ev_alloc to notify higher layers we're -* ready for more. -* -* Arguments: -* wlandev wlan device -* usbout ptr to the usb transfer buffer -* -* Returns: -* nothing -* -* Side effects: -* -* Call context: -* interrupt -----------------------------------------------------------------*/ -static void hfa384x_usbout_tx(wlandevice_t *wlandev, hfa384x_usbout_t *usbout) -{ - prism2sta_ev_alloc(wlandev); -} - /*---------------------------------------------------------------- * hfa384x_isgood_pdrcore * From d4f8455b1267f40c090fc6fbf06335554d280be1 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Sat, 31 Oct 2015 15:49:29 +0530 Subject: [PATCH 099/843] staging: wlan-ng: prism2mib: Remove unnecessary variable Drop unnecessary variable that can be replaced by a single line of code. Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/prism2mib.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/wlan-ng/prism2mib.c b/drivers/staging/wlan-ng/prism2mib.c index b4a15ef3a405..cdda07d1c268 100644 --- a/drivers/staging/wlan-ng/prism2mib.c +++ b/drivers/staging/wlan-ng/prism2mib.c @@ -660,7 +660,6 @@ static int prism2mib_fragmentationthreshold(struct mibrec *mib, struct p80211msg_dot11req_mibset *msg, void *data) { - int result; u32 *uint32 = (u32 *) data; if (!isget) @@ -672,9 +671,7 @@ static int prism2mib_fragmentationthreshold(struct mibrec *mib, return 0; } - result = prism2mib_uint32(mib, isget, wlandev, hw, msg, data); - - return result; + return prism2mib_uint32(mib, isget, wlandev, hw, msg, data); } /*---------------------------------------------------------------- From 6fbbf260b00d4d79e87cd5b383906875237d4aa8 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Sat, 31 Oct 2015 21:53:03 +0530 Subject: [PATCH 100/843] Staging: wlan-ng: Remove unused function declaration Function p80211wext_event_associated has been declared but not used. Thus remove the declaration. Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/p80211netdev.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/wlan-ng/p80211netdev.h b/drivers/staging/wlan-ng/p80211netdev.h index c547e1cb4c0d..810ee68aa18e 100644 --- a/drivers/staging/wlan-ng/p80211netdev.h +++ b/drivers/staging/wlan-ng/p80211netdev.h @@ -141,7 +141,6 @@ typedef struct p80211_frmrx_t { struct iw_statistics *p80211wext_get_wireless_stats(netdevice_t *dev); /* wireless extensions' ioctls */ extern struct iw_handler_def p80211wext_handler_def; -int p80211wext_event_associated(struct wlandevice *wlandev, int assoc); /* WEP stuff */ #define NUM_WEPKEYS 4 From 925b65782c218cbc76bb975fb80ccf2072c735ee Mon Sep 17 00:00:00 2001 From: Amarjargal Gundjalam Date: Sat, 31 Oct 2015 01:56:37 -0700 Subject: [PATCH 101/843] staging: media: bcm2048: match alignments with open parenthesis This patch fixes the checkpatch issue: CHECK: Alignment should match open parenthesis Signed-off-by: Amarjargal Gundjalam Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/bcm2048/radio-bcm2048.c | 304 +++++++++--------- 1 file changed, 146 insertions(+), 158 deletions(-) diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c b/drivers/staging/media/bcm2048/radio-bcm2048.c index b10d6016b993..3b012d37de49 100644 --- a/drivers/staging/media/bcm2048/radio-bcm2048.c +++ b/drivers/staging/media/bcm2048/radio-bcm2048.c @@ -348,7 +348,7 @@ static struct region_info region_configs[] = { * I2C Interface read / write */ static int bcm2048_send_command(struct bcm2048_device *bdev, unsigned int reg, - unsigned int value) + unsigned int value) { struct i2c_client *client = bdev->client; u8 data[2]; @@ -370,7 +370,7 @@ static int bcm2048_send_command(struct bcm2048_device *bdev, unsigned int reg, } static int bcm2048_recv_command(struct bcm2048_device *bdev, unsigned int reg, - u8 *value) + u8 *value) { struct i2c_client *client = bdev->client; @@ -385,7 +385,7 @@ static int bcm2048_recv_command(struct bcm2048_device *bdev, unsigned int reg, } static int bcm2048_recv_duples(struct bcm2048_device *bdev, unsigned int reg, - u8 *value, u8 duples) + u8 *value, u8 duples) { struct i2c_client *client = bdev->client; struct i2c_adapter *adap = client->adapter; @@ -436,7 +436,7 @@ static int bcm2048_set_power_state(struct bcm2048_device *bdev, u8 power) */ if (power) err = bcm2048_send_command(bdev, BCM2048_I2C_FM_RDS_SYSTEM, - bdev->cache_fm_rds_system); + bdev->cache_fm_rds_system); msleep(BCM2048_DEFAULT_POWERING_DELAY); if (!power) @@ -475,17 +475,17 @@ static int bcm2048_set_rds_no_lock(struct bcm2048_device *bdev, u8 rds_on) bdev->rds_state = BCM2048_RDS_ON; flags = BCM2048_RDS_FLAG_FIFO_WLINE; err = bcm2048_send_command(bdev, BCM2048_I2C_FM_RDS_MASK1, - flags); + flags); } else { flags = 0; bdev->rds_state = 0; err = bcm2048_send_command(bdev, BCM2048_I2C_FM_RDS_MASK1, - flags); + flags); memset(&bdev->rds_info, 0, sizeof(bdev->rds_info)); } err = bcm2048_send_command(bdev, BCM2048_I2C_FM_RDS_SYSTEM, - bdev->cache_fm_rds_system); + bdev->cache_fm_rds_system); return err; } @@ -545,14 +545,14 @@ static int bcm2048_set_fm_automatic_stereo_mono(struct bcm2048_device *bdev, bdev->cache_fm_ctrl |= BCM2048_STEREO_MONO_AUTO_SELECT; err = bcm2048_send_command(bdev, BCM2048_I2C_FM_CTRL, - bdev->cache_fm_ctrl); + bdev->cache_fm_ctrl); mutex_unlock(&bdev->mutex); return err; } static int bcm2048_set_fm_hi_lo_injection(struct bcm2048_device *bdev, - u8 hi_lo) + u8 hi_lo) { int err; @@ -564,7 +564,7 @@ static int bcm2048_set_fm_hi_lo_injection(struct bcm2048_device *bdev, bdev->cache_fm_ctrl |= BCM2048_HI_LO_INJECTION; err = bcm2048_send_command(bdev, BCM2048_I2C_FM_CTRL, - bdev->cache_fm_ctrl); + bdev->cache_fm_ctrl); mutex_unlock(&bdev->mutex); return err; @@ -592,7 +592,7 @@ static int bcm2048_set_fm_frequency(struct bcm2048_device *bdev, u32 frequency) int err; if (frequency < bdev->region_info.bottom_frequency || - frequency > bdev->region_info.top_frequency) + frequency > bdev->region_info.top_frequency) return -EDOM; frequency -= BCM2048_FREQUENCY_BASE; @@ -601,7 +601,7 @@ static int bcm2048_set_fm_frequency(struct bcm2048_device *bdev, u32 frequency) err = bcm2048_send_command(bdev, BCM2048_I2C_FM_FREQ0, lsb(frequency)); err |= bcm2048_send_command(bdev, BCM2048_I2C_FM_FREQ1, - msb(frequency)); + msb(frequency)); if (!err) bdev->frequency = frequency; @@ -632,12 +632,12 @@ static int bcm2048_get_fm_frequency(struct bcm2048_device *bdev) } static int bcm2048_set_fm_af_frequency(struct bcm2048_device *bdev, - u32 frequency) + u32 frequency) { int err; if (frequency < bdev->region_info.bottom_frequency || - frequency > bdev->region_info.top_frequency) + frequency > bdev->region_info.top_frequency) return -EDOM; frequency -= BCM2048_FREQUENCY_BASE; @@ -645,9 +645,9 @@ static int bcm2048_set_fm_af_frequency(struct bcm2048_device *bdev, mutex_lock(&bdev->mutex); err = bcm2048_send_command(bdev, BCM2048_I2C_FM_AF_FREQ0, - lsb(frequency)); + lsb(frequency)); err |= bcm2048_send_command(bdev, BCM2048_I2C_FM_AF_FREQ1, - msb(frequency)); + msb(frequency)); if (!err) bdev->frequency = frequency; @@ -692,7 +692,7 @@ static int bcm2048_set_fm_deemphasis(struct bcm2048_device *bdev, int d) bdev->cache_fm_audio_ctrl0 |= deemphasis; err = bcm2048_send_command(bdev, BCM2048_I2C_FM_AUDIO_CTRL0, - bdev->cache_fm_audio_ctrl0); + bdev->cache_fm_audio_ctrl0); if (!err) bdev->region_info.deemphasis = d; @@ -740,7 +740,7 @@ static int bcm2048_set_region(struct bcm2048_device *bdev, u8 region) bdev->cache_fm_ctrl &= ~BCM2048_BAND_SELECT; err = bcm2048_send_command(bdev, BCM2048_I2C_FM_CTRL, - bdev->cache_fm_ctrl); + bdev->cache_fm_ctrl); if (err) { mutex_unlock(&bdev->mutex); goto done; @@ -748,7 +748,7 @@ static int bcm2048_set_region(struct bcm2048_device *bdev, u8 region) mutex_unlock(&bdev->mutex); if (bdev->frequency < region_configs[region].bottom_frequency || - bdev->frequency > region_configs[region].top_frequency) + bdev->frequency > region_configs[region].top_frequency) new_frequency = region_configs[region].bottom_frequency; if (new_frequency > 0) { @@ -759,7 +759,7 @@ static int bcm2048_set_region(struct bcm2048_device *bdev, u8 region) } err = bcm2048_set_fm_deemphasis(bdev, - region_configs[region].deemphasis); + region_configs[region].deemphasis); done: return err; @@ -786,10 +786,10 @@ static int bcm2048_set_mute(struct bcm2048_device *bdev, u16 mute) if (mute) bdev->cache_fm_audio_ctrl0 |= (BCM2048_RF_MUTE | - BCM2048_MANUAL_MUTE); + BCM2048_MANUAL_MUTE); err = bcm2048_send_command(bdev, BCM2048_I2C_FM_AUDIO_CTRL0, - bdev->cache_fm_audio_ctrl0); + bdev->cache_fm_audio_ctrl0); if (!err) bdev->mute_state = mute; @@ -807,7 +807,7 @@ static int bcm2048_get_mute(struct bcm2048_device *bdev) if (bdev->power_state) { err = bcm2048_recv_command(bdev, BCM2048_I2C_FM_AUDIO_CTRL0, - &value); + &value); if (!err) err = value & (BCM2048_RF_MUTE | BCM2048_MANUAL_MUTE); } else { @@ -826,11 +826,11 @@ static int bcm2048_set_audio_route(struct bcm2048_device *bdev, u8 route) route &= (BCM2048_AUDIO_ROUTE_DAC | BCM2048_AUDIO_ROUTE_I2S); bdev->cache_fm_audio_ctrl0 &= ~(BCM2048_AUDIO_ROUTE_DAC | - BCM2048_AUDIO_ROUTE_I2S); + BCM2048_AUDIO_ROUTE_I2S); bdev->cache_fm_audio_ctrl0 |= route; err = bcm2048_send_command(bdev, BCM2048_I2C_FM_AUDIO_CTRL0, - bdev->cache_fm_audio_ctrl0); + bdev->cache_fm_audio_ctrl0); mutex_unlock(&bdev->mutex); return err; @@ -849,7 +849,7 @@ static int bcm2048_get_audio_route(struct bcm2048_device *bdev) if (!err) return value & (BCM2048_AUDIO_ROUTE_DAC | - BCM2048_AUDIO_ROUTE_I2S); + BCM2048_AUDIO_ROUTE_I2S); return err; } @@ -865,7 +865,7 @@ static int bcm2048_set_dac_output(struct bcm2048_device *bdev, u8 channels) bdev->cache_fm_audio_ctrl0 |= channels; err = bcm2048_send_command(bdev, BCM2048_I2C_FM_AUDIO_CTRL0, - bdev->cache_fm_audio_ctrl0); + bdev->cache_fm_audio_ctrl0); mutex_unlock(&bdev->mutex); return err; @@ -884,13 +884,13 @@ static int bcm2048_get_dac_output(struct bcm2048_device *bdev) if (!err) return value & (BCM2048_DAC_OUTPUT_LEFT | - BCM2048_DAC_OUTPUT_RIGHT); + BCM2048_DAC_OUTPUT_RIGHT); return err; } static int bcm2048_set_fm_search_rssi_threshold(struct bcm2048_device *bdev, - u8 threshold) + u8 threshold) { int err; @@ -901,7 +901,7 @@ static int bcm2048_set_fm_search_rssi_threshold(struct bcm2048_device *bdev, bdev->cache_fm_search_ctrl0 |= threshold; err = bcm2048_send_command(bdev, BCM2048_I2C_FM_SEARCH_CTRL0, - bdev->cache_fm_search_ctrl0); + bdev->cache_fm_search_ctrl0); mutex_unlock(&bdev->mutex); return err; @@ -937,7 +937,7 @@ static int bcm2048_set_fm_search_mode_direction(struct bcm2048_device *bdev, bdev->cache_fm_search_ctrl0 |= BCM2048_SEARCH_DIRECTION; err = bcm2048_send_command(bdev, BCM2048_I2C_FM_SEARCH_CTRL0, - bdev->cache_fm_search_ctrl0); + bdev->cache_fm_search_ctrl0); mutex_unlock(&bdev->mutex); return err; @@ -961,7 +961,7 @@ static int bcm2048_get_fm_search_mode_direction(struct bcm2048_device *bdev) } static int bcm2048_set_fm_search_tune_mode(struct bcm2048_device *bdev, - u8 mode) + u8 mode) { int err, timeout, restart_rds = 0; u8 value, flags; @@ -1024,7 +1024,7 @@ static int bcm2048_get_fm_search_tune_mode(struct bcm2048_device *bdev) mutex_lock(&bdev->mutex); err = bcm2048_recv_command(bdev, BCM2048_I2C_FM_SEARCH_TUNE_MODE, - &value); + &value); mutex_unlock(&bdev->mutex); @@ -1040,10 +1040,10 @@ static int bcm2048_set_rds_b_block_mask(struct bcm2048_device *bdev, u16 mask) mutex_lock(&bdev->mutex); - err = bcm2048_send_command(bdev, - BCM2048_I2C_RDS_BLKB_MASK0, lsb(mask)); - err |= bcm2048_send_command(bdev, - BCM2048_I2C_RDS_BLKB_MASK1, msb(mask)); + err = bcm2048_send_command(bdev, BCM2048_I2C_RDS_BLKB_MASK0, + lsb(mask)); + err |= bcm2048_send_command(bdev, BCM2048_I2C_RDS_BLKB_MASK1, + msb(mask)); mutex_unlock(&bdev->mutex); return err; @@ -1056,10 +1056,8 @@ static int bcm2048_get_rds_b_block_mask(struct bcm2048_device *bdev) mutex_lock(&bdev->mutex); - err = bcm2048_recv_command(bdev, - BCM2048_I2C_RDS_BLKB_MASK0, &lsb); - err |= bcm2048_recv_command(bdev, - BCM2048_I2C_RDS_BLKB_MASK1, &msb); + err = bcm2048_recv_command(bdev, BCM2048_I2C_RDS_BLKB_MASK0, &lsb); + err |= bcm2048_recv_command(bdev, BCM2048_I2C_RDS_BLKB_MASK1, &msb); mutex_unlock(&bdev->mutex); @@ -1070,16 +1068,16 @@ static int bcm2048_get_rds_b_block_mask(struct bcm2048_device *bdev) } static int bcm2048_set_rds_b_block_match(struct bcm2048_device *bdev, - u16 match) + u16 match) { int err; mutex_lock(&bdev->mutex); - err = bcm2048_send_command(bdev, - BCM2048_I2C_RDS_BLKB_MATCH0, lsb(match)); - err |= bcm2048_send_command(bdev, - BCM2048_I2C_RDS_BLKB_MATCH1, msb(match)); + err = bcm2048_send_command(bdev, BCM2048_I2C_RDS_BLKB_MATCH0, + lsb(match)); + err |= bcm2048_send_command(bdev, BCM2048_I2C_RDS_BLKB_MATCH1, + msb(match)); mutex_unlock(&bdev->mutex); return err; @@ -1092,10 +1090,8 @@ static int bcm2048_get_rds_b_block_match(struct bcm2048_device *bdev) mutex_lock(&bdev->mutex); - err = bcm2048_recv_command(bdev, - BCM2048_I2C_RDS_BLKB_MATCH0, &lsb); - err |= bcm2048_recv_command(bdev, - BCM2048_I2C_RDS_BLKB_MATCH1, &msb); + err = bcm2048_recv_command(bdev, BCM2048_I2C_RDS_BLKB_MATCH0, &lsb); + err |= bcm2048_recv_command(bdev, BCM2048_I2C_RDS_BLKB_MATCH1, &msb); mutex_unlock(&bdev->mutex); @@ -1111,10 +1107,8 @@ static int bcm2048_set_rds_pi_mask(struct bcm2048_device *bdev, u16 mask) mutex_lock(&bdev->mutex); - err = bcm2048_send_command(bdev, - BCM2048_I2C_RDS_PI_MASK0, lsb(mask)); - err |= bcm2048_send_command(bdev, - BCM2048_I2C_RDS_PI_MASK1, msb(mask)); + err = bcm2048_send_command(bdev, BCM2048_I2C_RDS_PI_MASK0, lsb(mask)); + err |= bcm2048_send_command(bdev, BCM2048_I2C_RDS_PI_MASK1, msb(mask)); mutex_unlock(&bdev->mutex); return err; @@ -1127,10 +1121,8 @@ static int bcm2048_get_rds_pi_mask(struct bcm2048_device *bdev) mutex_lock(&bdev->mutex); - err = bcm2048_recv_command(bdev, - BCM2048_I2C_RDS_PI_MASK0, &lsb); - err |= bcm2048_recv_command(bdev, - BCM2048_I2C_RDS_PI_MASK1, &msb); + err = bcm2048_recv_command(bdev, BCM2048_I2C_RDS_PI_MASK0, &lsb); + err |= bcm2048_recv_command(bdev, BCM2048_I2C_RDS_PI_MASK1, &msb); mutex_unlock(&bdev->mutex); @@ -1146,10 +1138,10 @@ static int bcm2048_set_rds_pi_match(struct bcm2048_device *bdev, u16 match) mutex_lock(&bdev->mutex); - err = bcm2048_send_command(bdev, - BCM2048_I2C_RDS_PI_MATCH0, lsb(match)); - err |= bcm2048_send_command(bdev, - BCM2048_I2C_RDS_PI_MATCH1, msb(match)); + err = bcm2048_send_command(bdev, BCM2048_I2C_RDS_PI_MATCH0, + lsb(match)); + err |= bcm2048_send_command(bdev, BCM2048_I2C_RDS_PI_MATCH1, + msb(match)); mutex_unlock(&bdev->mutex); return err; @@ -1162,10 +1154,8 @@ static int bcm2048_get_rds_pi_match(struct bcm2048_device *bdev) mutex_lock(&bdev->mutex); - err = bcm2048_recv_command(bdev, - BCM2048_I2C_RDS_PI_MATCH0, &lsb); - err |= bcm2048_recv_command(bdev, - BCM2048_I2C_RDS_PI_MATCH1, &msb); + err = bcm2048_recv_command(bdev, BCM2048_I2C_RDS_PI_MATCH0, &lsb); + err |= bcm2048_recv_command(bdev, BCM2048_I2C_RDS_PI_MATCH1, &msb); mutex_unlock(&bdev->mutex); @@ -1181,10 +1171,8 @@ static int bcm2048_set_fm_rds_mask(struct bcm2048_device *bdev, u16 mask) mutex_lock(&bdev->mutex); - err = bcm2048_send_command(bdev, - BCM2048_I2C_FM_RDS_MASK0, lsb(mask)); - err |= bcm2048_send_command(bdev, - BCM2048_I2C_FM_RDS_MASK1, msb(mask)); + err = bcm2048_send_command(bdev, BCM2048_I2C_FM_RDS_MASK0, lsb(mask)); + err |= bcm2048_send_command(bdev, BCM2048_I2C_FM_RDS_MASK1, msb(mask)); mutex_unlock(&bdev->mutex); return err; @@ -1245,13 +1233,13 @@ static int bcm2048_set_fm_best_tune_mode(struct bcm2048_device *bdev, u8 mode) /* Perform read as the manual indicates */ err = bcm2048_recv_command(bdev, BCM2048_I2C_FM_BEST_TUNE_MODE, - &value); + &value); value &= ~BCM2048_BEST_TUNE_MODE; if (mode) value |= BCM2048_BEST_TUNE_MODE; err |= bcm2048_send_command(bdev, BCM2048_I2C_FM_BEST_TUNE_MODE, - value); + value); mutex_unlock(&bdev->mutex); return err; @@ -1265,7 +1253,7 @@ static int bcm2048_get_fm_best_tune_mode(struct bcm2048_device *bdev) mutex_lock(&bdev->mutex); err = bcm2048_recv_command(bdev, BCM2048_I2C_FM_BEST_TUNE_MODE, - &value); + &value); mutex_unlock(&bdev->mutex); @@ -1352,7 +1340,7 @@ static int bcm2048_checkrev(struct bcm2048_device *bdev) if (!err) { dev_info(&bdev->client->dev, "BCM2048 Version 0x%x\n", - version); + version); return version; } @@ -1478,7 +1466,7 @@ static int bcm2048_rds_block_crc(struct bcm2048_device *bdev, int i) } static void bcm2048_parse_rds_rt_block(struct bcm2048_device *bdev, int i, - int index, int crc) + int index, int crc) { /* Good data will overwrite poor data */ if (crc) { @@ -1505,7 +1493,7 @@ static int bcm2048_parse_rt_match_b(struct bcm2048_device *bdev, int i) return -EIO; if ((bdev->rds_info.radio_text[i] & BCM2048_RDS_BLOCK_MASK) == - BCM2048_RDS_BLOCK_B) { + BCM2048_RDS_BLOCK_B) { rt_id = bdev->rds_info.radio_text[i+1] & BCM2048_RDS_BLOCK_MASK; @@ -1516,7 +1504,7 @@ static int bcm2048_parse_rt_match_b(struct bcm2048_device *bdev, int i) if (rt_group_b != bdev->rds_info.rds_rt_group_b) { memset(bdev->rds_info.rds_rt, 0, - sizeof(bdev->rds_info.rds_rt)); + sizeof(bdev->rds_info.rds_rt)); bdev->rds_info.rds_rt_group_b = rt_group_b; } @@ -1524,7 +1512,7 @@ static int bcm2048_parse_rt_match_b(struct bcm2048_device *bdev, int i) /* A to B or (vice versa), means: clear screen */ if (rt_ab != bdev->rds_info.rds_rt_ab) { memset(bdev->rds_info.rds_rt, 0, - sizeof(bdev->rds_info.rds_rt)); + sizeof(bdev->rds_info.rds_rt)); bdev->rds_info.rds_rt_ab = rt_ab; } @@ -1544,7 +1532,7 @@ static int bcm2048_parse_rt_match_b(struct bcm2048_device *bdev, int i) } static int bcm2048_parse_rt_match_c(struct bcm2048_device *bdev, int i, - int index) + int index) { int crc; @@ -1567,7 +1555,7 @@ static int bcm2048_parse_rt_match_c(struct bcm2048_device *bdev, int i, } static void bcm2048_parse_rt_match_d(struct bcm2048_device *bdev, int i, - int index) + int index) { int crc; @@ -1579,7 +1567,7 @@ static void bcm2048_parse_rt_match_d(struct bcm2048_device *bdev, int i, BUG_ON((index+4) >= BCM2048_MAX_RDS_RT); if ((bdev->rds_info.radio_text[i] & BCM2048_RDS_BLOCK_MASK) == - BCM2048_RDS_BLOCK_D) + BCM2048_RDS_BLOCK_D) bcm2048_parse_rds_rt_block(bdev, i, index+2, crc); } @@ -1607,22 +1595,22 @@ static void bcm2048_parse_rds_rt(struct bcm2048_device *bdev) } /* Skip erroneous blocks due to messed up A block altogether */ - if ((bdev->rds_info.radio_text[i] & BCM2048_RDS_BLOCK_MASK) - == BCM2048_RDS_BLOCK_A) { + if ((bdev->rds_info.radio_text[i] & BCM2048_RDS_BLOCK_MASK) == + BCM2048_RDS_BLOCK_A) { crc = bcm2048_rds_block_crc(bdev, i); if (crc == BCM2048_RDS_CRC_UNRECOVARABLE) continue; /* Syncronize to a good RDS PI */ - if (((bdev->rds_info.radio_text[i+1] << 8) + - bdev->rds_info.radio_text[i+2]) == - bdev->rds_info.rds_pi) - match_b = 1; + if (((bdev->rds_info.radio_text[i + 1] << 8) + + bdev->rds_info.radio_text[i + 2]) == + bdev->rds_info.rds_pi) + match_b = 1; } } } static void bcm2048_parse_rds_ps_block(struct bcm2048_device *bdev, int i, - int index, int crc) + int index, int crc) { /* Good data will overwrite poor data */ if (crc) { @@ -1640,7 +1628,7 @@ static void bcm2048_parse_rds_ps_block(struct bcm2048_device *bdev, int i, } static int bcm2048_parse_ps_match_c(struct bcm2048_device *bdev, int i, - int index) + int index) { int crc; @@ -1650,14 +1638,14 @@ static int bcm2048_parse_ps_match_c(struct bcm2048_device *bdev, int i, return 0; if ((bdev->rds_info.radio_text[i] & BCM2048_RDS_BLOCK_MASK) == - BCM2048_RDS_BLOCK_C) + BCM2048_RDS_BLOCK_C) return 1; return 0; } static void bcm2048_parse_ps_match_d(struct bcm2048_device *bdev, int i, - int index) + int index) { int crc; @@ -1667,7 +1655,7 @@ static void bcm2048_parse_ps_match_d(struct bcm2048_device *bdev, int i, return; if ((bdev->rds_info.radio_text[i] & BCM2048_RDS_BLOCK_MASK) == - BCM2048_RDS_BLOCK_D) + BCM2048_RDS_BLOCK_D) bcm2048_parse_rds_ps_block(bdev, i, index, crc); } @@ -1682,7 +1670,7 @@ static int bcm2048_parse_ps_match_b(struct bcm2048_device *bdev, int i) /* Block B Radio PS match */ if ((bdev->rds_info.radio_text[i] & BCM2048_RDS_BLOCK_MASK) == - BCM2048_RDS_BLOCK_B) { + BCM2048_RDS_BLOCK_B) { ps_id = bdev->rds_info.radio_text[i+1] & BCM2048_RDS_BLOCK_MASK; ps_group = bdev->rds_info.radio_text[i+1] & @@ -1743,16 +1731,16 @@ static void bcm2048_parse_rds_ps(struct bcm2048_device *bdev) } /* Skip erroneous blocks due to messed up A block altogether */ - if ((bdev->rds_info.radio_text[i] & BCM2048_RDS_BLOCK_MASK) - == BCM2048_RDS_BLOCK_A) { + if ((bdev->rds_info.radio_text[i] & BCM2048_RDS_BLOCK_MASK) == + BCM2048_RDS_BLOCK_A) { crc = bcm2048_rds_block_crc(bdev, i); if (crc == BCM2048_RDS_CRC_UNRECOVARABLE) continue; /* Syncronize to a good RDS PI */ - if (((bdev->rds_info.radio_text[i+1] << 8) + - bdev->rds_info.radio_text[i+2]) == - bdev->rds_info.rds_pi) - match_b = 1; + if (((bdev->rds_info.radio_text[i + 1] << 8) + + bdev->rds_info.radio_text[i + 2]) == + bdev->rds_info.rds_pi) + match_b = 1; } } } @@ -1764,7 +1752,7 @@ static void bcm2048_rds_fifo_receive(struct bcm2048_device *bdev) mutex_lock(&bdev->mutex); err = bcm2048_recv_duples(bdev, BCM2048_I2C_RDS_DATA, - bdev->rds_info.radio_text, bdev->fifo_size); + bdev->rds_info.radio_text, bdev->fifo_size); if (err != 2) { dev_err(&bdev->client->dev, "RDS Read problem\n"); mutex_unlock(&bdev->mutex); @@ -1802,7 +1790,7 @@ static int bcm2048_get_rds_data(struct bcm2048_device *bdev, char *data) for (i = 0; i < bdev->rds_info.text_len; i++) { p += sprintf(data_buffer+p, "%x ", - bdev->rds_info.radio_text[i]); + bdev->rds_info.radio_text[i]); } memcpy(data, data_buffer, p); @@ -1829,7 +1817,7 @@ static int bcm2048_init(struct bcm2048_device *bdev) goto exit; err = bcm2048_set_dac_output(bdev, BCM2048_DAC_OUTPUT_LEFT | - BCM2048_DAC_OUTPUT_RIGHT); + BCM2048_DAC_OUTPUT_RIGHT); exit: return err; @@ -1935,7 +1923,7 @@ static void bcm2048_work(struct work_struct *work) if (bdev->rds_state) { flags = BCM2048_RDS_FLAG_FIFO_WLINE; bcm2048_send_command(bdev, BCM2048_I2C_FM_RDS_MASK1, - flags); + flags); } bdev->rds_data_available = 1; bdev->rd_index = 0; /* new data, new start */ @@ -2084,70 +2072,70 @@ DEFINE_SYSFS_PROPERTY(region, unsigned, int, "%u", 0) static struct device_attribute attrs[] = { __ATTR(power_state, S_IRUGO | S_IWUSR, bcm2048_power_state_read, - bcm2048_power_state_write), + bcm2048_power_state_write), __ATTR(mute, S_IRUGO | S_IWUSR, bcm2048_mute_read, - bcm2048_mute_write), + bcm2048_mute_write), __ATTR(audio_route, S_IRUGO | S_IWUSR, bcm2048_audio_route_read, - bcm2048_audio_route_write), + bcm2048_audio_route_write), __ATTR(dac_output, S_IRUGO | S_IWUSR, bcm2048_dac_output_read, - bcm2048_dac_output_write), + bcm2048_dac_output_write), __ATTR(fm_hi_lo_injection, S_IRUGO | S_IWUSR, - bcm2048_fm_hi_lo_injection_read, - bcm2048_fm_hi_lo_injection_write), + bcm2048_fm_hi_lo_injection_read, + bcm2048_fm_hi_lo_injection_write), __ATTR(fm_frequency, S_IRUGO | S_IWUSR, bcm2048_fm_frequency_read, - bcm2048_fm_frequency_write), + bcm2048_fm_frequency_write), __ATTR(fm_af_frequency, S_IRUGO | S_IWUSR, - bcm2048_fm_af_frequency_read, - bcm2048_fm_af_frequency_write), + bcm2048_fm_af_frequency_read, + bcm2048_fm_af_frequency_write), __ATTR(fm_deemphasis, S_IRUGO | S_IWUSR, bcm2048_fm_deemphasis_read, - bcm2048_fm_deemphasis_write), + bcm2048_fm_deemphasis_write), __ATTR(fm_rds_mask, S_IRUGO | S_IWUSR, bcm2048_fm_rds_mask_read, - bcm2048_fm_rds_mask_write), + bcm2048_fm_rds_mask_write), __ATTR(fm_best_tune_mode, S_IRUGO | S_IWUSR, - bcm2048_fm_best_tune_mode_read, - bcm2048_fm_best_tune_mode_write), + bcm2048_fm_best_tune_mode_read, + bcm2048_fm_best_tune_mode_write), __ATTR(fm_search_rssi_threshold, S_IRUGO | S_IWUSR, - bcm2048_fm_search_rssi_threshold_read, - bcm2048_fm_search_rssi_threshold_write), + bcm2048_fm_search_rssi_threshold_read, + bcm2048_fm_search_rssi_threshold_write), __ATTR(fm_search_mode_direction, S_IRUGO | S_IWUSR, - bcm2048_fm_search_mode_direction_read, - bcm2048_fm_search_mode_direction_write), + bcm2048_fm_search_mode_direction_read, + bcm2048_fm_search_mode_direction_write), __ATTR(fm_search_tune_mode, S_IRUGO | S_IWUSR, - bcm2048_fm_search_tune_mode_read, - bcm2048_fm_search_tune_mode_write), + bcm2048_fm_search_tune_mode_read, + bcm2048_fm_search_tune_mode_write), __ATTR(rds, S_IRUGO | S_IWUSR, bcm2048_rds_read, - bcm2048_rds_write), + bcm2048_rds_write), __ATTR(rds_b_block_mask, S_IRUGO | S_IWUSR, - bcm2048_rds_b_block_mask_read, - bcm2048_rds_b_block_mask_write), + bcm2048_rds_b_block_mask_read, + bcm2048_rds_b_block_mask_write), __ATTR(rds_b_block_match, S_IRUGO | S_IWUSR, - bcm2048_rds_b_block_match_read, - bcm2048_rds_b_block_match_write), + bcm2048_rds_b_block_match_read, + bcm2048_rds_b_block_match_write), __ATTR(rds_pi_mask, S_IRUGO | S_IWUSR, bcm2048_rds_pi_mask_read, - bcm2048_rds_pi_mask_write), + bcm2048_rds_pi_mask_write), __ATTR(rds_pi_match, S_IRUGO | S_IWUSR, bcm2048_rds_pi_match_read, - bcm2048_rds_pi_match_write), + bcm2048_rds_pi_match_write), __ATTR(rds_wline, S_IRUGO | S_IWUSR, bcm2048_rds_wline_read, - bcm2048_rds_wline_write), + bcm2048_rds_wline_write), __ATTR(rds_pi, S_IRUGO, bcm2048_rds_pi_read, NULL), __ATTR(rds_rt, S_IRUGO, bcm2048_rds_rt_read, NULL), __ATTR(rds_ps, S_IRUGO, bcm2048_rds_ps_read, NULL), __ATTR(fm_rds_flags, S_IRUGO, bcm2048_fm_rds_flags_read, NULL), __ATTR(region_bottom_frequency, S_IRUGO, - bcm2048_region_bottom_frequency_read, NULL), + bcm2048_region_bottom_frequency_read, NULL), __ATTR(region_top_frequency, S_IRUGO, - bcm2048_region_top_frequency_read, NULL), + bcm2048_region_top_frequency_read, NULL), __ATTR(fm_carrier_error, S_IRUGO, - bcm2048_fm_carrier_error_read, NULL), + bcm2048_fm_carrier_error_read, NULL), __ATTR(fm_rssi, S_IRUGO, - bcm2048_fm_rssi_read, NULL), + bcm2048_fm_rssi_read, NULL), __ATTR(region, S_IRUGO | S_IWUSR, bcm2048_region_read, - bcm2048_region_write), + bcm2048_region_write), __ATTR(rds_data, S_IRUGO, bcm2048_rds_data_read, NULL), }; static int bcm2048_sysfs_unregister_properties(struct bcm2048_device *bdev, - int size) + int size) { int i; @@ -2165,7 +2153,7 @@ static int bcm2048_sysfs_register_properties(struct bcm2048_device *bdev) for (i = 0; i < ARRAY_SIZE(attrs); i++) { if (device_create_file(&bdev->client->dev, &attrs[i]) != 0) { dev_err(&bdev->client->dev, - "could not register sysfs entry\n"); + "could not register sysfs entry\n"); err = -EBUSY; bcm2048_sysfs_unregister_properties(bdev, i); break; @@ -2197,7 +2185,7 @@ static int bcm2048_fops_release(struct file *file) } static unsigned int bcm2048_fops_poll(struct file *file, - struct poll_table_struct *pts) + struct poll_table_struct *pts) { struct bcm2048_device *bdev = video_drvdata(file); int retval = 0; @@ -2211,7 +2199,7 @@ static unsigned int bcm2048_fops_poll(struct file *file, } static ssize_t bcm2048_fops_read(struct file *file, char __user *buf, - size_t count, loff_t *ppos) + size_t count, loff_t *ppos) { struct bcm2048_device *bdev = video_drvdata(file); int i; @@ -2229,7 +2217,7 @@ static ssize_t bcm2048_fops_read(struct file *file, char __user *buf, } /* interruptible_sleep_on(&bdev->read_queue); */ if (wait_event_interruptible(bdev->read_queue, - bdev->rds_data_available) < 0) { + bdev->rds_data_available) < 0) { retval = -EINTR; goto done; } @@ -2249,7 +2237,7 @@ static ssize_t bcm2048_fops_read(struct file *file, char __user *buf, tmpbuf[i+1] = bdev->rds_info.radio_text[bdev->rd_index+i+1]; tmpbuf[i+2] = (bdev->rds_info.radio_text[bdev->rd_index + i] & 0xf0) >> 4; if ((bdev->rds_info.radio_text[bdev->rd_index+i] & - BCM2048_RDS_CRC_MASK) == BCM2048_RDS_CRC_UNRECOVARABLE) + BCM2048_RDS_CRC_MASK) == BCM2048_RDS_CRC_UNRECOVARABLE) tmpbuf[i+2] |= 0x80; if (copy_to_user(buf+i, tmpbuf, 3)) { retval = -EFAULT; @@ -2319,7 +2307,7 @@ static struct v4l2_queryctrl bcm2048_v4l2_queryctrl[] = { }; static int bcm2048_vidioc_querycap(struct file *file, void *priv, - struct v4l2_capability *capability) + struct v4l2_capability *capability) { struct bcm2048_device *bdev = video_get_drvdata(video_devdata(file)); @@ -2337,7 +2325,7 @@ static int bcm2048_vidioc_querycap(struct file *file, void *priv, } static int bcm2048_vidioc_g_input(struct file *filp, void *priv, - unsigned int *i) + unsigned int *i) { *i = 0; @@ -2345,7 +2333,7 @@ static int bcm2048_vidioc_g_input(struct file *filp, void *priv, } static int bcm2048_vidioc_s_input(struct file *filp, void *priv, - unsigned int i) + unsigned int i) { if (i) return -EINVAL; @@ -2354,7 +2342,7 @@ static int bcm2048_vidioc_s_input(struct file *filp, void *priv, } static int bcm2048_vidioc_queryctrl(struct file *file, void *priv, - struct v4l2_queryctrl *qc) + struct v4l2_queryctrl *qc) { int i; @@ -2369,7 +2357,7 @@ static int bcm2048_vidioc_queryctrl(struct file *file, void *priv, } static int bcm2048_vidioc_g_ctrl(struct file *file, void *priv, - struct v4l2_control *ctrl) + struct v4l2_control *ctrl) { struct bcm2048_device *bdev = video_get_drvdata(video_devdata(file)); int err = 0; @@ -2389,7 +2377,7 @@ static int bcm2048_vidioc_g_ctrl(struct file *file, void *priv, } static int bcm2048_vidioc_s_ctrl(struct file *file, void *priv, - struct v4l2_control *ctrl) + struct v4l2_control *ctrl) { struct bcm2048_device *bdev = video_get_drvdata(video_devdata(file)); int err = 0; @@ -2417,7 +2405,7 @@ static int bcm2048_vidioc_s_ctrl(struct file *file, void *priv, } static int bcm2048_vidioc_g_audio(struct file *file, void *priv, - struct v4l2_audio *audio) + struct v4l2_audio *audio) { if (audio->index > 1) return -EINVAL; @@ -2429,7 +2417,7 @@ static int bcm2048_vidioc_g_audio(struct file *file, void *priv, } static int bcm2048_vidioc_s_audio(struct file *file, void *priv, - const struct v4l2_audio *audio) + const struct v4l2_audio *audio) { if (audio->index != 0) return -EINVAL; @@ -2438,7 +2426,7 @@ static int bcm2048_vidioc_s_audio(struct file *file, void *priv, } static int bcm2048_vidioc_g_tuner(struct file *file, void *priv, - struct v4l2_tuner *tuner) + struct v4l2_tuner *tuner) { struct bcm2048_device *bdev = video_get_drvdata(video_devdata(file)); s8 f_error; @@ -2493,7 +2481,7 @@ static int bcm2048_vidioc_g_tuner(struct file *file, void *priv, } static int bcm2048_vidioc_s_tuner(struct file *file, void *priv, - const struct v4l2_tuner *tuner) + const struct v4l2_tuner *tuner) { struct bcm2048_device *bdev = video_get_drvdata(video_devdata(file)); @@ -2507,7 +2495,7 @@ static int bcm2048_vidioc_s_tuner(struct file *file, void *priv, } static int bcm2048_vidioc_g_frequency(struct file *file, void *priv, - struct v4l2_frequency *freq) + struct v4l2_frequency *freq) { struct bcm2048_device *bdev = video_get_drvdata(video_devdata(file)); int err = 0; @@ -2528,7 +2516,7 @@ static int bcm2048_vidioc_g_frequency(struct file *file, void *priv, } static int bcm2048_vidioc_s_frequency(struct file *file, void *priv, - const struct v4l2_frequency *freq) + const struct v4l2_frequency *freq) { struct bcm2048_device *bdev = video_get_drvdata(video_devdata(file)); int err; @@ -2546,7 +2534,7 @@ static int bcm2048_vidioc_s_frequency(struct file *file, void *priv, } static int bcm2048_vidioc_s_hw_freq_seek(struct file *file, void *priv, - const struct v4l2_hw_freq_seek *seek) + const struct v4l2_hw_freq_seek *seek) { struct bcm2048_device *bdev = video_get_drvdata(video_devdata(file)); int err; @@ -2559,7 +2547,7 @@ static int bcm2048_vidioc_s_hw_freq_seek(struct file *file, void *priv, err = bcm2048_set_fm_search_mode_direction(bdev, seek->seek_upward); err |= bcm2048_set_fm_search_tune_mode(bdev, - BCM2048_FM_AUTO_SEARCH_MODE); + BCM2048_FM_AUTO_SEARCH_MODE); return err; } @@ -2594,7 +2582,7 @@ static struct video_device bcm2048_viddev_template = { * I2C driver interface */ static int bcm2048_i2c_driver_probe(struct i2c_client *client, - const struct i2c_device_id *id) + const struct i2c_device_id *id) { struct bcm2048_device *bdev; int err; @@ -2613,8 +2601,8 @@ static int bcm2048_i2c_driver_probe(struct i2c_client *client, if (client->irq) { err = request_irq(client->irq, - bcm2048_handler, IRQF_TRIGGER_FALLING, - client->name, bdev); + bcm2048_handler, IRQF_TRIGGER_FALLING, + client->name, bdev); if (err < 0) { dev_err(&client->dev, "Could not request IRQ\n"); goto free_bdev; From 3ac086fb99fe689fb2183bdd5503912749b22e71 Mon Sep 17 00:00:00 2001 From: Amarjargal Gundjalam Date: Sat, 31 Oct 2015 01:56:38 -0700 Subject: [PATCH 102/843] staging: media: bcm2048: add space around operators This patch fixes the checkpatch issue: CHECK: spaces preferred around that ' ' Signed-off-by: Amarjargal Gundjalam Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/bcm2048/radio-bcm2048.c | 73 ++++++++++--------- 1 file changed, 39 insertions(+), 34 deletions(-) diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c b/drivers/staging/media/bcm2048/radio-bcm2048.c index 3b012d37de49..9bb5ad9ec593 100644 --- a/drivers/staging/media/bcm2048/radio-bcm2048.c +++ b/drivers/staging/media/bcm2048/radio-bcm2048.c @@ -1350,7 +1350,7 @@ static int bcm2048_checkrev(struct bcm2048_device *bdev) static int bcm2048_get_rds_rt(struct bcm2048_device *bdev, char *data) { int err = 0, i, j = 0, ce = 0, cr = 0; - char data_buffer[BCM2048_MAX_RDS_RT+1]; + char data_buffer[BCM2048_MAX_RDS_RT + 1]; mutex_lock(&bdev->mutex); @@ -1400,7 +1400,7 @@ unlock: static int bcm2048_get_rds_ps(struct bcm2048_device *bdev, char *data) { int err = 0, i, j = 0; - char data_buffer[BCM2048_MAX_RDS_PS+1]; + char data_buffer[BCM2048_MAX_RDS_PS + 1]; mutex_lock(&bdev->mutex); @@ -1440,8 +1440,8 @@ static void bcm2048_parse_rds_pi(struct bcm2048_device *bdev) /* Block A match, only data without crc errors taken */ if (bdev->rds_info.radio_text[i] == BCM2048_RDS_BLOCK_A) { - pi = (bdev->rds_info.radio_text[i+1] << 8) + - bdev->rds_info.radio_text[i+2]; + pi = (bdev->rds_info.radio_text[i + 1] << 8) + + bdev->rds_info.radio_text[i + 2]; if (!bdev->rds_info.rds_pi) { bdev->rds_info.rds_pi = pi; @@ -1472,14 +1472,15 @@ static void bcm2048_parse_rds_rt_block(struct bcm2048_device *bdev, int i, if (crc) { if (!bdev->rds_info.rds_rt[index]) bdev->rds_info.rds_rt[index] = - bdev->rds_info.radio_text[i+1]; - if (!bdev->rds_info.rds_rt[index+1]) - bdev->rds_info.rds_rt[index+1] = - bdev->rds_info.radio_text[i+2]; + bdev->rds_info.radio_text[i + 1]; + if (!bdev->rds_info.rds_rt[index + 1]) + bdev->rds_info.rds_rt[index + 1] = + bdev->rds_info.radio_text[i + 2]; } else { - bdev->rds_info.rds_rt[index] = bdev->rds_info.radio_text[i+1]; - bdev->rds_info.rds_rt[index+1] = - bdev->rds_info.radio_text[i+2]; + bdev->rds_info.rds_rt[index] = + bdev->rds_info.radio_text[i + 1]; + bdev->rds_info.rds_rt[index + 1] = + bdev->rds_info.radio_text[i + 2]; } } @@ -1495,11 +1496,11 @@ static int bcm2048_parse_rt_match_b(struct bcm2048_device *bdev, int i) if ((bdev->rds_info.radio_text[i] & BCM2048_RDS_BLOCK_MASK) == BCM2048_RDS_BLOCK_B) { - rt_id = bdev->rds_info.radio_text[i+1] & + rt_id = bdev->rds_info.radio_text[i + 1] & BCM2048_RDS_BLOCK_MASK; - rt_group_b = bdev->rds_info.radio_text[i+1] & + rt_group_b = bdev->rds_info.radio_text[i + 1] & BCM2048_RDS_GROUP_AB_MASK; - rt_ab = bdev->rds_info.radio_text[i+2] & + rt_ab = bdev->rds_info.radio_text[i + 2] & BCM2048_RDS_RT_AB_MASK; if (rt_group_b != bdev->rds_info.rds_rt_group_b) { @@ -1516,7 +1517,7 @@ static int bcm2048_parse_rt_match_b(struct bcm2048_device *bdev, int i) bdev->rds_info.rds_rt_ab = rt_ab; } - index = bdev->rds_info.radio_text[i+2] & + index = bdev->rds_info.radio_text[i + 2] & BCM2048_RDS_RT_INDEX; if (bdev->rds_info.rds_rt_group_b) @@ -1568,7 +1569,7 @@ static void bcm2048_parse_rt_match_d(struct bcm2048_device *bdev, int i, if ((bdev->rds_info.radio_text[i] & BCM2048_RDS_BLOCK_MASK) == BCM2048_RDS_BLOCK_D) - bcm2048_parse_rds_rt_block(bdev, i, index+2, crc); + bcm2048_parse_rds_rt_block(bdev, i, index + 2, crc); } static void bcm2048_parse_rds_rt(struct bcm2048_device *bdev) @@ -1616,14 +1617,15 @@ static void bcm2048_parse_rds_ps_block(struct bcm2048_device *bdev, int i, if (crc) { if (!bdev->rds_info.rds_ps[index]) bdev->rds_info.rds_ps[index] = - bdev->rds_info.radio_text[i+1]; - if (!bdev->rds_info.rds_ps[index+1]) - bdev->rds_info.rds_ps[index+1] = - bdev->rds_info.radio_text[i+2]; + bdev->rds_info.radio_text[i + 1]; + if (!bdev->rds_info.rds_ps[index + 1]) + bdev->rds_info.rds_ps[index + 1] = + bdev->rds_info.radio_text[i + 2]; } else { - bdev->rds_info.rds_ps[index] = bdev->rds_info.radio_text[i+1]; - bdev->rds_info.rds_ps[index+1] = - bdev->rds_info.radio_text[i+2]; + bdev->rds_info.rds_ps[index] = + bdev->rds_info.radio_text[i + 1]; + bdev->rds_info.rds_ps[index + 1] = + bdev->rds_info.radio_text[i + 2]; } } @@ -1671,9 +1673,9 @@ static int bcm2048_parse_ps_match_b(struct bcm2048_device *bdev, int i) /* Block B Radio PS match */ if ((bdev->rds_info.radio_text[i] & BCM2048_RDS_BLOCK_MASK) == BCM2048_RDS_BLOCK_B) { - ps_id = bdev->rds_info.radio_text[i+1] & + ps_id = bdev->rds_info.radio_text[i + 1] & BCM2048_RDS_BLOCK_MASK; - ps_group = bdev->rds_info.radio_text[i+1] & + ps_group = bdev->rds_info.radio_text[i + 1] & BCM2048_RDS_GROUP_AB_MASK; /* @@ -1697,7 +1699,7 @@ static int bcm2048_parse_ps_match_b(struct bcm2048_device *bdev, int i) } if (ps_id == BCM2048_RDS_PS) { - index = bdev->rds_info.radio_text[i+2] & + index = bdev->rds_info.radio_text[i + 2] & BCM2048_RDS_PS_INDEX; index <<= 1; return index; @@ -1789,7 +1791,7 @@ static int bcm2048_get_rds_data(struct bcm2048_device *bdev, char *data) } for (i = 0; i < bdev->rds_info.text_len; i++) { - p += sprintf(data_buffer+p, "%x ", + p += sprintf(data_buffer + p, "%x ", bdev->rds_info.radio_text[i]); } @@ -2062,7 +2064,7 @@ property_str_read(rds_rt, (BCM2048_MAX_RDS_RT + 1)) property_str_read(rds_ps, (BCM2048_MAX_RDS_PS + 1)) property_read(fm_rds_flags, unsigned int, "%u") -property_str_read(rds_data, BCM2048_MAX_RDS_RADIO_TEXT*5) +property_str_read(rds_data, BCM2048_MAX_RDS_RADIO_TEXT * 5) property_read(region_bottom_frequency, unsigned int, "%u") property_read(region_top_frequency, unsigned int, "%u") @@ -2233,13 +2235,16 @@ static ssize_t bcm2048_fops_read(struct file *file, char __user *buf, while (i < count) { unsigned char tmpbuf[3]; - tmpbuf[i] = bdev->rds_info.radio_text[bdev->rd_index+i+2]; - tmpbuf[i+1] = bdev->rds_info.radio_text[bdev->rd_index+i+1]; - tmpbuf[i+2] = (bdev->rds_info.radio_text[bdev->rd_index + i] & 0xf0) >> 4; - if ((bdev->rds_info.radio_text[bdev->rd_index+i] & + tmpbuf[i] = bdev->rds_info.radio_text[bdev->rd_index + i + 2]; + tmpbuf[i + 1] = + bdev->rds_info.radio_text[bdev->rd_index + i + 1]; + tmpbuf[i + 2] = + (bdev->rds_info.radio_text[bdev->rd_index + i] & + 0xf0) >> 4; + if ((bdev->rds_info.radio_text[bdev->rd_index + i] & BCM2048_RDS_CRC_MASK) == BCM2048_RDS_CRC_UNRECOVARABLE) - tmpbuf[i+2] |= 0x80; - if (copy_to_user(buf+i, tmpbuf, 3)) { + tmpbuf[i + 2] |= 0x80; + if (copy_to_user(buf + i, tmpbuf, 3)) { retval = -EFAULT; break; } From 70fe32268366ebbcf7ce1adca2242ecdab89923e Mon Sep 17 00:00:00 2001 From: Amarjargal Gundjalam Date: Sat, 31 Oct 2015 01:56:39 -0700 Subject: [PATCH 103/843] staging: media: bcm2048: remove unnecessary blank lines This patch fixes the checkpatch issues: CHECK: Please don't use multiple blank lines CHECK: Blank lines aren't necessary after an open brace '{' Signed-off-by: Amarjargal Gundjalam Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/bcm2048/radio-bcm2048.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c b/drivers/staging/media/bcm2048/radio-bcm2048.c index 9bb5ad9ec593..9a69d17c3eab 100644 --- a/drivers/staging/media/bcm2048/radio-bcm2048.c +++ b/drivers/staging/media/bcm2048/radio-bcm2048.c @@ -179,7 +179,6 @@ #define BCM2048_DEFAULT_TIMEOUT 1500 #define BCM2048_AUTO_SEARCH_TIMEOUT 3000 - #define BCM2048_FREQDEV_UNIT 10000 #define BCM2048_FREQV4L2_MULTI 625 #define dev_to_v4l2(f) ((f * BCM2048_FREQDEV_UNIT) / BCM2048_FREQV4L2_MULTI) @@ -1436,10 +1435,8 @@ static void bcm2048_parse_rds_pi(struct bcm2048_device *bdev) u16 pi; for (i = 0; i < bdev->fifo_size; i += BCM2048_RDS_FIFO_DUPLE_SIZE) { - /* Block A match, only data without crc errors taken */ if (bdev->rds_info.radio_text[i] == BCM2048_RDS_BLOCK_A) { - pi = (bdev->rds_info.radio_text[i + 1] << 8) + bdev->rds_info.radio_text[i + 2]; @@ -1495,7 +1492,6 @@ static int bcm2048_parse_rt_match_b(struct bcm2048_device *bdev, int i) if ((bdev->rds_info.radio_text[i] & BCM2048_RDS_BLOCK_MASK) == BCM2048_RDS_BLOCK_B) { - rt_id = bdev->rds_info.radio_text[i + 1] & BCM2048_RDS_BLOCK_MASK; rt_group_b = bdev->rds_info.radio_text[i + 1] & @@ -1577,7 +1573,6 @@ static void bcm2048_parse_rds_rt(struct bcm2048_device *bdev) int i, index = 0, crc, match_b = 0, match_c = 0, match_d = 0; for (i = 0; i < bdev->fifo_size; i += BCM2048_RDS_FIFO_DUPLE_SIZE) { - if (match_b) { match_b = 0; index = bcm2048_parse_rt_match_b(bdev, i); @@ -1714,7 +1709,6 @@ static void bcm2048_parse_rds_ps(struct bcm2048_device *bdev) int i, index = 0, crc, match_b = 0, match_c = 0, match_d = 0; for (i = 0; i < bdev->fifo_size; i += BCM2048_RDS_FIFO_DUPLE_SIZE) { - if (match_b) { match_b = 0; index = bcm2048_parse_ps_match_b(bdev, i); @@ -1911,7 +1905,6 @@ static void bcm2048_work(struct work_struct *work) if (flag_lsb & (BCM2048_FM_FLAG_SEARCH_TUNE_FINISHED | BCM2048_FM_FLAG_SEARCH_TUNE_FAIL)) { - if (flag_lsb & BCM2048_FM_FLAG_SEARCH_TUNE_FAIL) bdev->scan_state = BCM2048_SCAN_FAIL; else @@ -2165,7 +2158,6 @@ static int bcm2048_sysfs_register_properties(struct bcm2048_device *bdev) return err; } - static int bcm2048_fops_open(struct file *file) { struct bcm2048_device *bdev = video_drvdata(file); From cf2f34089f3e15959b12671c93cd7909e3b8cef0 Mon Sep 17 00:00:00 2001 From: Amarjargal Gundjalam Date: Sat, 31 Oct 2015 01:56:40 -0700 Subject: [PATCH 104/843] staging: media: bcm2048: remove unnecessary space after a cast This patch fixes the checkpatch issue: CHECK: No space is necessary after a cast Signed-off-by: Amarjargal Gundjalam Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/bcm2048/radio-bcm2048.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c b/drivers/staging/media/bcm2048/radio-bcm2048.c index 9a69d17c3eab..82f4df40f166 100644 --- a/drivers/staging/media/bcm2048/radio-bcm2048.c +++ b/drivers/staging/media/bcm2048/radio-bcm2048.c @@ -184,8 +184,8 @@ #define dev_to_v4l2(f) ((f * BCM2048_FREQDEV_UNIT) / BCM2048_FREQV4L2_MULTI) #define v4l2_to_dev(f) ((f * BCM2048_FREQV4L2_MULTI) / BCM2048_FREQDEV_UNIT) -#define msb(x) ((u8)((u16) x >> 8)) -#define lsb(x) ((u8)((u16) x & 0x00FF)) +#define msb(x) ((u8)((u16)x >> 8)) +#define lsb(x) ((u8)((u16)x & 0x00FF)) #define compose_u16(msb, lsb) (((u16)msb << 8) | lsb) #define BCM2048_DEFAULT_POWERING_DELAY 20 From 3066bc0587186dc8d14d72f04fc8aeeb7801787e Mon Sep 17 00:00:00 2001 From: Amarjargal Gundjalam Date: Sat, 31 Oct 2015 01:56:41 -0700 Subject: [PATCH 105/843] staging: media: bcm2048: fix mispelling This patch fixes the checkpatch issue: CHECK: 'Syncronize' may be misspelled - perhaps 'Synchronize'? Signed-off-by: Amarjargal Gundjalam Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/bcm2048/radio-bcm2048.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c b/drivers/staging/media/bcm2048/radio-bcm2048.c index 82f4df40f166..19fcb1cb8231 100644 --- a/drivers/staging/media/bcm2048/radio-bcm2048.c +++ b/drivers/staging/media/bcm2048/radio-bcm2048.c @@ -1596,7 +1596,7 @@ static void bcm2048_parse_rds_rt(struct bcm2048_device *bdev) crc = bcm2048_rds_block_crc(bdev, i); if (crc == BCM2048_RDS_CRC_UNRECOVARABLE) continue; - /* Syncronize to a good RDS PI */ + /* Synchronize to a good RDS PI */ if (((bdev->rds_info.radio_text[i + 1] << 8) + bdev->rds_info.radio_text[i + 2]) == bdev->rds_info.rds_pi) @@ -1732,7 +1732,7 @@ static void bcm2048_parse_rds_ps(struct bcm2048_device *bdev) crc = bcm2048_rds_block_crc(bdev, i); if (crc == BCM2048_RDS_CRC_UNRECOVARABLE) continue; - /* Syncronize to a good RDS PI */ + /* Synchronize to a good RDS PI */ if (((bdev->rds_info.radio_text[i + 1] << 8) + bdev->rds_info.radio_text[i + 2]) == bdev->rds_info.rds_pi) From d48df5b37e8492adddd9d62000094f0f965a391a Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Sat, 31 Oct 2015 20:19:40 +0530 Subject: [PATCH 106/843] staging: rtl8712: rtl871x_mlme: Remove wrapper function Remove wrapper function free_network_nolock() that can be replaced by a single line of code. This patch renames _free_network_nolock() function to free_network_nolock(). Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_mlme.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c index a4a002b55128..04f727fc95ea 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.c +++ b/drivers/staging/rtl8712/rtl871x_mlme.c @@ -123,7 +123,7 @@ static void _free_network(struct mlme_priv *pmlmepriv, spin_unlock_irqrestore(&free_queue->lock, irqL); } -static void _free_network_nolock(struct mlme_priv *pmlmepriv, +static void free_network_nolock(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwork) { struct __queue *free_queue = &pmlmepriv->free_bss_pool; @@ -234,12 +234,6 @@ static struct wlan_network *alloc_network(struct mlme_priv *pmlmepriv) return _r8712_alloc_network(pmlmepriv); } -static void free_network_nolock(struct mlme_priv *pmlmepriv, - struct wlan_network *pnetwork) -{ - _free_network_nolock(pmlmepriv, pnetwork); -} - void r8712_free_network_queue(struct _adapter *dev) { _free_network_queue(dev); From 10172144cc812f0f126587a919c328873e1594f2 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Sat, 31 Oct 2015 20:22:03 +0530 Subject: [PATCH 107/843] staging: rtl8192e: Remove unnecessary variable This patch removes unnecessary variable by using a single line of code instead. Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 0b407feb5407..5e3bbe5c3ca4 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -90,13 +90,12 @@ void rtl92e_set_bb_reg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask, u32 rtl92e_get_bb_reg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask) { - u32 Ret = 0, OriginalValue, BitShift; + u32 OriginalValue, BitShift; OriginalValue = rtl92e_readl(dev, dwRegAddr); BitShift = _rtl92e_calculate_bit_shift(dwBitMask); - Ret = (OriginalValue & dwBitMask) >> BitShift; - return Ret; + return (OriginalValue & dwBitMask) >> BitShift; } static u32 _rtl92e_phy_rf_read(struct net_device *dev, From 8d831d451fd0654c8d20a91c4edec1ee57a93945 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Sun, 1 Nov 2015 11:34:40 +0530 Subject: [PATCH 108/843] Staging: fwserial: Remove unused fwtty_bind_console from header fwtty_bind_console is defined in header file but not used. Thus remove the definition. Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fwserial/fwserial.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/staging/fwserial/fwserial.h b/drivers/staging/fwserial/fwserial.h index 787aa4f3a41b..8d791ae79cd6 100644 --- a/drivers/staging/fwserial/fwserial.h +++ b/drivers/staging/fwserial/fwserial.h @@ -344,14 +344,6 @@ extern struct tty_driver *fwtty_driver; struct fwtty_port *fwtty_port_get(unsigned index); void fwtty_port_put(struct fwtty_port *port); -static inline void fwtty_bind_console(struct fwtty_port *port, - struct fwconsole_ops *fwcon_ops, - void *data) -{ - port->con_data = data; - port->fwcon_ops = fwcon_ops; -} - /* * Returns the max send async payload size in bytes based on the unit device * link speed. Self-limiting asynchronous bandwidth (via reducing the payload) From 375fb53ec1be6df6cfd0ac4932f14f0b7f57a761 Mon Sep 17 00:00:00 2001 From: Ioana Ciornei Date: Sun, 1 Nov 2015 16:38:20 +0200 Subject: [PATCH 109/843] staging: android: replace explicit NULL comparison This patch replaces explicit NULL comparison with ! operator in order to simplify the code Signed-off-by: Ioana Ciornei Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ion/compat_ion.c | 6 +++--- drivers/staging/android/sync.c | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/android/ion/compat_ion.c b/drivers/staging/android/ion/compat_ion.c index a402fdaf54ca..9a978d21785e 100644 --- a/drivers/staging/android/ion/compat_ion.c +++ b/drivers/staging/android/ion/compat_ion.c @@ -137,7 +137,7 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); - if (data == NULL) + if (!data) return -EFAULT; err = compat_get_ion_allocation_data(data32, data); @@ -156,7 +156,7 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); - if (data == NULL) + if (!data) return -EFAULT; err = compat_get_ion_handle_data(data32, data); @@ -173,7 +173,7 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); - if (data == NULL) + if (!data) return -EFAULT; err = compat_get_ion_custom_data(data32, data); diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index f83e00c78051..5413f28afe8e 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -43,7 +43,7 @@ struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops, return NULL; obj = kzalloc(size, GFP_KERNEL); - if (obj == NULL) + if (!obj) return NULL; kref_init(&obj->kref); @@ -130,7 +130,7 @@ struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size) return NULL; pt = kzalloc(size, GFP_KERNEL); - if (pt == NULL) + if (!pt) return NULL; spin_lock_irqsave(&obj->child_list_lock, flags); @@ -155,7 +155,7 @@ static struct sync_fence *sync_fence_alloc(int size, const char *name) struct sync_fence *fence; fence = kzalloc(size, GFP_KERNEL); - if (fence == NULL) + if (!fence) return NULL; fence->file = anon_inode_getfile("sync_fence", &sync_fence_fops, @@ -193,7 +193,7 @@ struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt) struct sync_fence *fence; fence = sync_fence_alloc(offsetof(struct sync_fence, cbs[1]), name); - if (fence == NULL) + if (!fence) return NULL; fence->num_fences = 1; @@ -215,7 +215,7 @@ struct sync_fence *sync_fence_fdget(int fd) { struct file *file = fget(fd); - if (file == NULL) + if (!file) return NULL; if (file->f_op != &sync_fence_fops) @@ -262,7 +262,7 @@ struct sync_fence *sync_fence_merge(const char *name, unsigned long size = offsetof(struct sync_fence, cbs[num_fences]); fence = sync_fence_alloc(size, name); - if (fence == NULL) + if (!fence) return NULL; atomic_set(&fence->status, num_fences); @@ -583,14 +583,14 @@ static long sync_fence_ioctl_merge(struct sync_fence *fence, unsigned long arg) } fence2 = sync_fence_fdget(data.fd2); - if (fence2 == NULL) { + if (!fence2) { err = -ENOENT; goto err_put_fd; } data.name[sizeof(data.name) - 1] = '\0'; fence3 = sync_fence_merge(data.name, fence, fence2); - if (fence3 == NULL) { + if (!fence3) { err = -ENOMEM; goto err_put_fence2; } @@ -666,7 +666,7 @@ static long sync_fence_ioctl_fence_info(struct sync_fence *fence, size = 4096; data = kzalloc(size, GFP_KERNEL); - if (data == NULL) + if (!data) return -ENOMEM; strlcpy(data->name, fence->name, sizeof(data->name)); From 36f16ff25c0290aa700dc0944f41dc14ff050432 Mon Sep 17 00:00:00 2001 From: Ioana Ciornei Date: Sun, 1 Nov 2015 16:38:21 +0200 Subject: [PATCH 110/843] staging: android: replace uint32_t with u32 This patch makes use of the preferred kernel types such as u16, u32. Signed-off-by: Ioana Ciornei Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/lowmemorykiller.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index e679d8432810..de65db7d938f 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -43,7 +43,7 @@ #include #include -static uint32_t lowmem_debug_level = 1; +static u32 lowmem_debug_level = 1; static short lowmem_adj[6] = { 0, 1, From f8b053e3da56cdfa798ce5d7014860798b04b7bc Mon Sep 17 00:00:00 2001 From: Ioana Ciornei Date: Sun, 1 Nov 2015 16:38:22 +0200 Subject: [PATCH 111/843] staging: android: properly align function arguments Fix alingment issues by properly indenting function arguments in accordance with the kernel coding style. Signed-off-by: Ioana Ciornei Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/lowmemorykiller.c | 4 ++-- drivers/staging/android/sync.c | 4 ++-- drivers/staging/android/timed_gpio.c | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index de65db7d938f..8b5a4a82d8b8 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -105,8 +105,8 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) } lowmem_print(3, "lowmem_scan %lu, %x, ofree %d %d, ma %hd\n", - sc->nr_to_scan, sc->gfp_mask, other_free, - other_file, min_score_adj); + sc->nr_to_scan, sc->gfp_mask, other_free, + other_file, min_score_adj); if (min_score_adj == OOM_SCORE_ADJ_MAX + 1) { lowmem_print(5, "lowmem_scan %lu, %x, return 0\n", diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index 5413f28afe8e..e0c1acb2ba69 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -313,7 +313,7 @@ struct sync_fence *sync_fence_merge(const char *name, EXPORT_SYMBOL(sync_fence_merge); int sync_fence_wake_up_wq(wait_queue_t *curr, unsigned mode, - int wake_flags, void *key) + int wake_flags, void *key) { struct sync_fence_waiter *wait; @@ -353,7 +353,7 @@ int sync_fence_wait_async(struct sync_fence *fence, EXPORT_SYMBOL(sync_fence_wait_async); int sync_fence_cancel_async(struct sync_fence *fence, - struct sync_fence_waiter *waiter) + struct sync_fence_waiter *waiter) { unsigned long flags; int ret = 0; diff --git a/drivers/staging/android/timed_gpio.c b/drivers/staging/android/timed_gpio.c index ce11726f1a6c..5246f42c1227 100644 --- a/drivers/staging/android/timed_gpio.c +++ b/drivers/staging/android/timed_gpio.c @@ -76,8 +76,8 @@ static void gpio_enable(struct timed_output_dev *dev, int value) value = data->max_timeout; hrtimer_start(&data->timer, - ktime_set(value / 1000, (value % 1000) * 1000000), - HRTIMER_MODE_REL); + ktime_set(value / 1000, (value % 1000) * 1000000), + HRTIMER_MODE_REL); } spin_unlock_irqrestore(&data->lock, flags); @@ -94,8 +94,8 @@ static int timed_gpio_probe(struct platform_device *pdev) return -EBUSY; gpio_data = devm_kzalloc(&pdev->dev, - sizeof(struct timed_gpio_data) * pdata->num_gpios, - GFP_KERNEL); + sizeof(*gpio_data) * pdata->num_gpios, + GFP_KERNEL); if (!gpio_data) return -ENOMEM; @@ -104,7 +104,7 @@ static int timed_gpio_probe(struct platform_device *pdev) gpio_dat = &gpio_data[i]; hrtimer_init(&gpio_dat->timer, CLOCK_MONOTONIC, - HRTIMER_MODE_REL); + HRTIMER_MODE_REL); gpio_dat->timer.function = gpio_timer_func; spin_lock_init(&gpio_dat->lock); From 49112c7fc2329a668d886f4410d9666328d8b2ef Mon Sep 17 00:00:00 2001 From: Ioana Ciornei Date: Sun, 1 Nov 2015 16:38:23 +0200 Subject: [PATCH 112/843] staging: android: remove multiple blank lines This patch removes multiple blank lines in order to follow the linux kernel coding style. Signed-off-by: Ioana Ciornei Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/timed_gpio.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/android/timed_gpio.c b/drivers/staging/android/timed_gpio.c index 5246f42c1227..bcd9924d4631 100644 --- a/drivers/staging/android/timed_gpio.c +++ b/drivers/staging/android/timed_gpio.c @@ -25,7 +25,6 @@ #include "timed_output.h" #include "timed_gpio.h" - struct timed_gpio_data { struct timed_output_dev dev; struct hrtimer timer; From 5ec2136892cc01c802d10bb24c442951056e3af8 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Fri, 30 Oct 2015 12:18:56 +0530 Subject: [PATCH 113/843] staging: wilc1000: Remove inclusion of version.h version.h header inclusion is not necessary as detected by versioncheck. Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 2a5b36fd8b48..034cfed653b0 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -23,7 +23,6 @@ #include #include -#include #include #ifdef WILC_SDIO From b60005a8ce169771fc7e7763c920cfe7f48eef93 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:24 +0900 Subject: [PATCH 114/843] staging: wilc1000: rename enuHostIFstate of struct host_if_drv This patch renames enuHostIFstate of struct host_if_drv to hif_state to avoid CamelCase naming convention. And, some comments modification that has been included name 'enuHostIFstate'. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 62 ++++++++++++----------- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index dbbe72c7e255..4e01dbd492ed 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -820,13 +820,15 @@ static s32 Handle_Scan(struct host_if_drv *hif_drv, u8 *pu8HdnNtwrksWidVal = NULL; PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); - PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state\n", hif_drv->enuHostIFstate); + PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state\n", hif_drv->hif_state); hif_drv->usr_scan_req.pfUserScanResult = pstrHostIFscanAttr->result; hif_drv->usr_scan_req.u32UserScanPvoid = pstrHostIFscanAttr->arg; - if ((hif_drv->enuHostIFstate >= HOST_IF_SCANNING) && (hif_drv->enuHostIFstate < HOST_IF_CONNECTED)) { - PRINT_D(GENERIC_DBG, "Don't scan we are already in [%d] state\n", hif_drv->enuHostIFstate); + if ((hif_drv->hif_state >= HOST_IF_SCANNING) && + (hif_drv->hif_state < HOST_IF_CONNECTED)) { + PRINT_D(GENERIC_DBG, "Don't scan already in [%d] state\n", + hif_drv->hif_state); PRINT_ER("Already scan\n"); result = -EBUSY; goto ERRORHANDLER; @@ -904,9 +906,9 @@ static s32 Handle_Scan(struct host_if_drv *hif_drv, strWIDList[u32WidsCount].val = (s8 *)&pstrHostIFscanAttr->src; u32WidsCount++; - if (hif_drv->enuHostIFstate == HOST_IF_CONNECTED) + if (hif_drv->hif_state == HOST_IF_CONNECTED) scan_while_connected = true; - else if (hif_drv->enuHostIFstate == HOST_IF_IDLE) + else if (hif_drv->hif_state == HOST_IF_IDLE) scan_while_connected = false; result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, @@ -1214,7 +1216,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv, goto ERRORHANDLER; } else { PRINT_D(GENERIC_DBG, "set HOST_IF_WAITING_CONN_RESP\n"); - hif_drv->enuHostIFstate = HOST_IF_WAITING_CONN_RESP; + hif_drv->hif_state = HOST_IF_WAITING_CONN_RESP; } ERRORHANDLER: @@ -1244,7 +1246,7 @@ ERRORHANDLER: MAC_DISCONNECTED, NULL, pstrHostIFconnectAttr->arg); - hif_drv->enuHostIFstate = HOST_IF_IDLE; + hif_drv->hif_state = HOST_IF_IDLE; kfree(strConnectInfo.pu8ReqIEs); strConnectInfo.pu8ReqIEs = NULL; @@ -1325,7 +1327,7 @@ static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv) return result; } - hif_drv->enuHostIFstate = HOST_IF_IDLE; + hif_drv->hif_state = HOST_IF_IDLE; scan_while_connected = false; @@ -1491,11 +1493,11 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, PRINT_ER("Driver handler is NULL\n"); return -ENODEV; } - PRINT_D(GENERIC_DBG, "Current State = %d,Received state = %d\n", hif_drv->enuHostIFstate, - pstrRcvdGnrlAsyncInfo->buffer[7]); + PRINT_D(GENERIC_DBG, "Current State = %d,Received state = %d\n", + hif_drv->hif_state, pstrRcvdGnrlAsyncInfo->buffer[7]); - if ((hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || - (hif_drv->enuHostIFstate == HOST_IF_CONNECTED) || + if ((hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) || + (hif_drv->hif_state == HOST_IF_CONNECTED) || hif_drv->usr_scan_req.pfUserScanResult) { if (!pstrRcvdGnrlAsyncInfo->buffer || !hif_drv->usr_conn_req.pfUserConnectResult) { @@ -1518,7 +1520,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, u8MacStatusReasonCode = pstrRcvdGnrlAsyncInfo->buffer[8]; u8MacStatusAdditionalInfo = pstrRcvdGnrlAsyncInfo->buffer[9]; PRINT_INFO(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Info = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); - if (hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { + if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) { u32 u32RcvdAssocRespInfoLen; tstrConnectRespInfo *pstrConnectRespInfo = NULL; @@ -1604,7 +1606,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, host_int_set_power_mgmt(hif_drv, 0, 0); PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n"); - hif_drv->enuHostIFstate = HOST_IF_CONNECTED; + hif_drv->hif_state = HOST_IF_CONNECTED; PRINT_D(GENERIC_DBG, "Obtaining an IP, Disable Scan\n"); g_obtainingIP = true; @@ -1612,7 +1614,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, jiffies + msecs_to_jiffies(10000)); } else { PRINT_D(HOSTINF_DBG, "MAC status : %d and Connect Status : %d\n", u8MacStatus, strConnectInfo.u16ConnectStatus); - hif_drv->enuHostIFstate = HOST_IF_IDLE; + hif_drv->hif_state = HOST_IF_IDLE; scan_while_connected = false; } @@ -1627,7 +1629,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, hif_drv->usr_conn_req.ConnReqIEsLen = 0; kfree(hif_drv->usr_conn_req.pu8ConnReqIEs); } else if ((u8MacStatus == MAC_DISCONNECTED) && - (hif_drv->enuHostIFstate == HOST_IF_CONNECTED)) { + (hif_drv->hif_state == HOST_IF_CONNECTED)) { PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW\n"); memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); @@ -1673,7 +1675,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, info_element = NULL; } - hif_drv->enuHostIFstate = HOST_IF_IDLE; + hif_drv->hif_state = HOST_IF_IDLE; scan_while_connected = false; } else if ((u8MacStatus == MAC_DISCONNECTED) && @@ -1837,10 +1839,10 @@ static int Handle_Key(struct host_if_drv *hif_drv, goto _WPARxGtk_end_case_; } - if (hif_drv->enuHostIFstate == HOST_IF_CONNECTED) + if (hif_drv->hif_state == HOST_IF_CONNECTED) memcpy(pu8keybuf, hif_drv->au8AssociatedBSSID, ETH_ALEN); else - PRINT_ER("Couldn't handle WPARxGtk while enuHostIFstate is not HOST_IF_CONNECTED\n"); + PRINT_ER("Couldn't handle WPARxGtk while state is not HOST_IF_CONNECTED\n"); memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->attr.wpa.seq, 8); memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->attr.wpa.index, 1); @@ -2005,7 +2007,7 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv) } if (hif_drv->usr_conn_req.pfUserConnectResult) { - if (hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { + if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) { PRINT_D(HOSTINF_DBG, "Upper layer requested termination of connection\n"); del_timer(&hif_drv->hConnectTimer); } @@ -2018,7 +2020,7 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv) scan_while_connected = false; - hif_drv->enuHostIFstate = HOST_IF_IDLE; + hif_drv->hif_state = HOST_IF_IDLE; eth_zero_addr(hif_drv->au8AssociatedBSSID); @@ -2046,7 +2048,8 @@ void resolve_disconnect_aberration(struct host_if_drv *hif_drv) { if (!hif_drv) return; - if ((hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || (hif_drv->enuHostIFstate == HOST_IF_CONNECTING)) { + if ((hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) || + (hif_drv->hif_state == HOST_IF_CONNECTING)) { PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n"); host_int_disconnect(hif_drv, 1); } @@ -2492,7 +2495,7 @@ static int Handle_RemainOnChan(struct host_if_drv *hif_drv, result = -EBUSY; goto ERRORHANDLER; } - if (hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { + if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) { PRINT_INFO(GENERIC_DBG, "Required to remain on chan while connecting return\n"); result = -EBUSY; goto ERRORHANDLER; @@ -3497,10 +3500,11 @@ s32 host_int_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid, msg.body.con_info.ies = kmalloc(IEsLen, GFP_KERNEL); memcpy(msg.body.con_info.ies, pu8IEs, IEsLen); } - if (hif_drv->enuHostIFstate < HOST_IF_CONNECTING) - hif_drv->enuHostIFstate = HOST_IF_CONNECTING; + if (hif_drv->hif_state < HOST_IF_CONNECTING) + hif_drv->hif_state = HOST_IF_CONNECTING; else - PRINT_D(GENERIC_DBG, "Don't set state to 'connecting' as state is %d\n", hif_drv->enuHostIFstate); + PRINT_D(GENERIC_DBG, "Don't set state to 'connecting' : %d\n", + hif_drv->hif_state); result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) { @@ -4046,7 +4050,7 @@ static void GetPeriodicRSSI(unsigned long arg) return; } - if (hif_drv->enuHostIFstate == HOST_IF_CONNECTED) { + if (hif_drv->hif_state == HOST_IF_CONNECTED) { s32 result = 0; struct host_if_msg msg; @@ -4142,7 +4146,7 @@ s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) sema_init(&hif_drv->gtOsCfgValuesSem, 1); down(&hif_drv->gtOsCfgValuesSem); - hif_drv->enuHostIFstate = HOST_IF_IDLE; + hif_drv->hif_state = HOST_IF_IDLE; hif_drv->strCfgValues.site_survey_enabled = SITE_SURVEY_OFF; hif_drv->strCfgValues.scan_source = DEFAULT_SCAN; hif_drv->strCfgValues.active_scan_time = ACTIVE_SCAN_TIME; @@ -4211,7 +4215,7 @@ s32 host_int_deinit(struct host_if_drv *hif_drv) hif_drv->usr_scan_req.pfUserScanResult = NULL; } - hif_drv->enuHostIFstate = HOST_IF_IDLE; + hif_drv->hif_state = HOST_IF_IDLE; scan_while_connected = false; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index b854db5ac932..dcdb9c61b82c 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -299,7 +299,7 @@ struct host_if_drv { u64 u64P2p_MgmtTimeout; u8 u8P2PConnect; - enum host_if_state enuHostIFstate; + enum host_if_state hif_state; u8 au8AssociatedBSSID[ETH_ALEN]; struct cfg_param_val strCfgValues; From 2a4eded9a827038dfdf322450f64ba4352a2b5ce Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:25 +0900 Subject: [PATCH 115/843] staging: wilc1000: rename au8AssociatedBSSID of struct host_if_drv This patch renames au8AssociatedBSSID of struct host_if_drv to assoc_bssid to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 8 ++++---- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 4e01dbd492ed..7216d83bc3e1 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1581,7 +1581,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, if ((u8MacStatus == MAC_CONNECTED) && (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { - memcpy(hif_drv->au8AssociatedBSSID, + memcpy(hif_drv->assoc_bssid, hif_drv->usr_conn_req.pu8bssid, ETH_ALEN); } } @@ -1657,7 +1657,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, PRINT_ER("Connect result callback function is NULL\n"); } - eth_zero_addr(hif_drv->au8AssociatedBSSID); + eth_zero_addr(hif_drv->assoc_bssid); hif_drv->usr_conn_req.ssidLen = 0; kfree(hif_drv->usr_conn_req.pu8ssid); @@ -1840,7 +1840,7 @@ static int Handle_Key(struct host_if_drv *hif_drv, } if (hif_drv->hif_state == HOST_IF_CONNECTED) - memcpy(pu8keybuf, hif_drv->au8AssociatedBSSID, ETH_ALEN); + memcpy(pu8keybuf, hif_drv->assoc_bssid, ETH_ALEN); else PRINT_ER("Couldn't handle WPARxGtk while state is not HOST_IF_CONNECTED\n"); @@ -2022,7 +2022,7 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv) hif_drv->hif_state = HOST_IF_IDLE; - eth_zero_addr(hif_drv->au8AssociatedBSSID); + eth_zero_addr(hif_drv->assoc_bssid); hif_drv->usr_conn_req.ssidLen = 0; kfree(hif_drv->usr_conn_req.pu8ssid); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index dcdb9c61b82c..fcfdd2151c9f 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -301,7 +301,7 @@ struct host_if_drv { enum host_if_state hif_state; - u8 au8AssociatedBSSID[ETH_ALEN]; + u8 assoc_bssid[ETH_ALEN]; struct cfg_param_val strCfgValues; /* semaphores */ struct semaphore gtOsCfgValuesSem; From ace303f045939f7848acb3cb2f64509ab9d05a49 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:26 +0900 Subject: [PATCH 116/843] staging: wilc1000: rename strCfgValues of struct host_if_drv This patch renames strCfgValues of struct host_if_drv to cfg_values to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 91 ++++++++++++----------- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 47 insertions(+), 46 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 7216d83bc3e1..135d4b31d3e0 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -535,7 +535,7 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.bss_type; strWIDList[u8WidCnt].type = WID_CHAR; strWIDList[u8WidCnt].size = sizeof(char); - hif_drv->strCfgValues.bss_type = (u8)strHostIFCfgParamAttr->cfg_attr_info.bss_type; + hif_drv->cfg_values.bss_type = (u8)strHostIFCfgParamAttr->cfg_attr_info.bss_type; } else { PRINT_ER("check value 6 over\n"); result = -EINVAL; @@ -549,7 +549,7 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.auth_type; strWIDList[u8WidCnt].type = WID_CHAR; strWIDList[u8WidCnt].size = sizeof(char); - hif_drv->strCfgValues.auth_type = (u8)strHostIFCfgParamAttr->cfg_attr_info.auth_type; + hif_drv->cfg_values.auth_type = (u8)strHostIFCfgParamAttr->cfg_attr_info.auth_type; } else { PRINT_ER("Impossible value \n"); result = -EINVAL; @@ -563,7 +563,7 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.auth_timeout; strWIDList[u8WidCnt].type = WID_SHORT; strWIDList[u8WidCnt].size = sizeof(u16); - hif_drv->strCfgValues.auth_timeout = strHostIFCfgParamAttr->cfg_attr_info.auth_timeout; + hif_drv->cfg_values.auth_timeout = strHostIFCfgParamAttr->cfg_attr_info.auth_timeout; } else { PRINT_ER("Range(1 ~ 65535) over\n"); result = -EINVAL; @@ -577,7 +577,7 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.power_mgmt_mode; strWIDList[u8WidCnt].type = WID_CHAR; strWIDList[u8WidCnt].size = sizeof(char); - hif_drv->strCfgValues.power_mgmt_mode = (u8)strHostIFCfgParamAttr->cfg_attr_info.power_mgmt_mode; + hif_drv->cfg_values.power_mgmt_mode = (u8)strHostIFCfgParamAttr->cfg_attr_info.power_mgmt_mode; } else { PRINT_ER("Invalide power mode\n"); result = -EINVAL; @@ -591,7 +591,7 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit; strWIDList[u8WidCnt].type = WID_SHORT; strWIDList[u8WidCnt].size = sizeof(u16); - hif_drv->strCfgValues.short_retry_limit = strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit; + hif_drv->cfg_values.short_retry_limit = strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit; } else { PRINT_ER("Range(1~256) over\n"); result = -EINVAL; @@ -606,7 +606,7 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, strWIDList[u8WidCnt].type = WID_SHORT; strWIDList[u8WidCnt].size = sizeof(u16); - hif_drv->strCfgValues.long_retry_limit = strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit; + hif_drv->cfg_values.long_retry_limit = strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit; } else { PRINT_ER("Range(1~256) over\n"); result = -EINVAL; @@ -620,7 +620,7 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.frag_threshold; strWIDList[u8WidCnt].type = WID_SHORT; strWIDList[u8WidCnt].size = sizeof(u16); - hif_drv->strCfgValues.frag_threshold = strHostIFCfgParamAttr->cfg_attr_info.frag_threshold; + hif_drv->cfg_values.frag_threshold = strHostIFCfgParamAttr->cfg_attr_info.frag_threshold; } else { PRINT_ER("Threshold Range fail\n"); result = -EINVAL; @@ -634,7 +634,7 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.rts_threshold; strWIDList[u8WidCnt].type = WID_SHORT; strWIDList[u8WidCnt].size = sizeof(u16); - hif_drv->strCfgValues.rts_threshold = strHostIFCfgParamAttr->cfg_attr_info.rts_threshold; + hif_drv->cfg_values.rts_threshold = strHostIFCfgParamAttr->cfg_attr_info.rts_threshold; } else { PRINT_ER("Threshold Range fail\n"); result = -EINVAL; @@ -648,7 +648,7 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.preamble_type; strWIDList[u8WidCnt].type = WID_CHAR; strWIDList[u8WidCnt].size = sizeof(char); - hif_drv->strCfgValues.preamble_type = strHostIFCfgParamAttr->cfg_attr_info.preamble_type; + hif_drv->cfg_values.preamble_type = strHostIFCfgParamAttr->cfg_attr_info.preamble_type; } else { PRINT_ER("Preamle Range(0~2) over\n"); result = -EINVAL; @@ -662,7 +662,7 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.short_slot_allowed; strWIDList[u8WidCnt].type = WID_CHAR; strWIDList[u8WidCnt].size = sizeof(char); - hif_drv->strCfgValues.short_slot_allowed = (u8)strHostIFCfgParamAttr->cfg_attr_info.short_slot_allowed; + hif_drv->cfg_values.short_slot_allowed = (u8)strHostIFCfgParamAttr->cfg_attr_info.short_slot_allowed; } else { PRINT_ER("Short slot(2) over\n"); result = -EINVAL; @@ -676,7 +676,7 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.txop_prot_disabled; strWIDList[u8WidCnt].type = WID_CHAR; strWIDList[u8WidCnt].size = sizeof(char); - hif_drv->strCfgValues.txop_prot_disabled = (u8)strHostIFCfgParamAttr->cfg_attr_info.txop_prot_disabled; + hif_drv->cfg_values.txop_prot_disabled = (u8)strHostIFCfgParamAttr->cfg_attr_info.txop_prot_disabled; } else { PRINT_ER("TXOP prot disable\n"); result = -EINVAL; @@ -690,7 +690,7 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.beacon_interval; strWIDList[u8WidCnt].type = WID_SHORT; strWIDList[u8WidCnt].size = sizeof(u16); - hif_drv->strCfgValues.beacon_interval = strHostIFCfgParamAttr->cfg_attr_info.beacon_interval; + hif_drv->cfg_values.beacon_interval = strHostIFCfgParamAttr->cfg_attr_info.beacon_interval; } else { PRINT_ER("Beacon interval(1~65535) fail\n"); result = -EINVAL; @@ -704,7 +704,7 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.dtim_period; strWIDList[u8WidCnt].type = WID_CHAR; strWIDList[u8WidCnt].size = sizeof(char); - hif_drv->strCfgValues.dtim_period = strHostIFCfgParamAttr->cfg_attr_info.dtim_period; + hif_drv->cfg_values.dtim_period = strHostIFCfgParamAttr->cfg_attr_info.dtim_period; } else { PRINT_ER("DTIM range(1~255) fail\n"); result = -EINVAL; @@ -718,7 +718,7 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.site_survey_enabled; strWIDList[u8WidCnt].type = WID_CHAR; strWIDList[u8WidCnt].size = sizeof(char); - hif_drv->strCfgValues.site_survey_enabled = (u8)strHostIFCfgParamAttr->cfg_attr_info.site_survey_enabled; + hif_drv->cfg_values.site_survey_enabled = (u8)strHostIFCfgParamAttr->cfg_attr_info.site_survey_enabled; } else { PRINT_ER("Site survey disable\n"); result = -EINVAL; @@ -732,7 +732,7 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time; strWIDList[u8WidCnt].type = WID_SHORT; strWIDList[u8WidCnt].size = sizeof(u16); - hif_drv->strCfgValues.site_survey_scan_time = strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time; + hif_drv->cfg_values.site_survey_scan_time = strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time; } else { PRINT_ER("Site survey scan time(1~65535) over\n"); result = -EINVAL; @@ -746,7 +746,7 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.active_scan_time; strWIDList[u8WidCnt].type = WID_SHORT; strWIDList[u8WidCnt].size = sizeof(u16); - hif_drv->strCfgValues.active_scan_time = strHostIFCfgParamAttr->cfg_attr_info.active_scan_time; + hif_drv->cfg_values.active_scan_time = strHostIFCfgParamAttr->cfg_attr_info.active_scan_time; } else { PRINT_ER("Active scan time(1~65535) over\n"); result = -EINVAL; @@ -760,7 +760,7 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time; strWIDList[u8WidCnt].type = WID_SHORT; strWIDList[u8WidCnt].size = sizeof(u16); - hif_drv->strCfgValues.passive_scan_time = strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time; + hif_drv->cfg_values.passive_scan_time = strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time; } else { PRINT_ER("Passive scan time(1~65535) over\n"); result = -EINVAL; @@ -781,7 +781,7 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, strWIDList[u8WidCnt].val = (s8 *)&curr_tx_rate; strWIDList[u8WidCnt].type = WID_SHORT; strWIDList[u8WidCnt].size = sizeof(u16); - hif_drv->strCfgValues.curr_tx_rate = (u8)curr_tx_rate; + hif_drv->cfg_values.curr_tx_rate = (u8)curr_tx_rate; } else { PRINT_ER("out of TX rate\n"); result = -EINVAL; @@ -3961,75 +3961,75 @@ s32 hif_get_cfg(struct host_if_drv *hif_drv, u16 u16WID, u16 *pu16WID_Value) PRINT_D(HOSTINF_DBG, "Getting configuration parameters\n"); switch (u16WID) { case WID_BSS_TYPE: - *pu16WID_Value = (u16)hif_drv->strCfgValues.bss_type; + *pu16WID_Value = (u16)hif_drv->cfg_values.bss_type; break; case WID_AUTH_TYPE: - *pu16WID_Value = (u16)hif_drv->strCfgValues.auth_type; + *pu16WID_Value = (u16)hif_drv->cfg_values.auth_type; break; case WID_AUTH_TIMEOUT: - *pu16WID_Value = hif_drv->strCfgValues.auth_timeout; + *pu16WID_Value = hif_drv->cfg_values.auth_timeout; break; case WID_POWER_MANAGEMENT: - *pu16WID_Value = (u16)hif_drv->strCfgValues.power_mgmt_mode; + *pu16WID_Value = (u16)hif_drv->cfg_values.power_mgmt_mode; break; case WID_SHORT_RETRY_LIMIT: - *pu16WID_Value = hif_drv->strCfgValues.short_retry_limit; + *pu16WID_Value = hif_drv->cfg_values.short_retry_limit; break; case WID_LONG_RETRY_LIMIT: - *pu16WID_Value = hif_drv->strCfgValues.long_retry_limit; + *pu16WID_Value = hif_drv->cfg_values.long_retry_limit; break; case WID_FRAG_THRESHOLD: - *pu16WID_Value = hif_drv->strCfgValues.frag_threshold; + *pu16WID_Value = hif_drv->cfg_values.frag_threshold; break; case WID_RTS_THRESHOLD: - *pu16WID_Value = hif_drv->strCfgValues.rts_threshold; + *pu16WID_Value = hif_drv->cfg_values.rts_threshold; break; case WID_PREAMBLE: - *pu16WID_Value = (u16)hif_drv->strCfgValues.preamble_type; + *pu16WID_Value = (u16)hif_drv->cfg_values.preamble_type; break; case WID_SHORT_SLOT_ALLOWED: - *pu16WID_Value = (u16) hif_drv->strCfgValues.short_slot_allowed; + *pu16WID_Value = (u16)hif_drv->cfg_values.short_slot_allowed; break; case WID_11N_TXOP_PROT_DISABLE: - *pu16WID_Value = (u16)hif_drv->strCfgValues.txop_prot_disabled; + *pu16WID_Value = (u16)hif_drv->cfg_values.txop_prot_disabled; break; case WID_BEACON_INTERVAL: - *pu16WID_Value = hif_drv->strCfgValues.beacon_interval; + *pu16WID_Value = hif_drv->cfg_values.beacon_interval; break; case WID_DTIM_PERIOD: - *pu16WID_Value = (u16)hif_drv->strCfgValues.dtim_period; + *pu16WID_Value = (u16)hif_drv->cfg_values.dtim_period; break; case WID_SITE_SURVEY: - *pu16WID_Value = (u16)hif_drv->strCfgValues.site_survey_enabled; + *pu16WID_Value = (u16)hif_drv->cfg_values.site_survey_enabled; break; case WID_SITE_SURVEY_SCAN_TIME: - *pu16WID_Value = hif_drv->strCfgValues.site_survey_scan_time; + *pu16WID_Value = hif_drv->cfg_values.site_survey_scan_time; break; case WID_ACTIVE_SCAN_TIME: - *pu16WID_Value = hif_drv->strCfgValues.active_scan_time; + *pu16WID_Value = hif_drv->cfg_values.active_scan_time; break; case WID_PASSIVE_SCAN_TIME: - *pu16WID_Value = hif_drv->strCfgValues.passive_scan_time; + *pu16WID_Value = hif_drv->cfg_values.passive_scan_time; break; case WID_CURRENT_TX_RATE: - *pu16WID_Value = hif_drv->strCfgValues.curr_tx_rate; + *pu16WID_Value = hif_drv->cfg_values.curr_tx_rate; break; default: @@ -4147,19 +4147,20 @@ s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) down(&hif_drv->gtOsCfgValuesSem); hif_drv->hif_state = HOST_IF_IDLE; - hif_drv->strCfgValues.site_survey_enabled = SITE_SURVEY_OFF; - hif_drv->strCfgValues.scan_source = DEFAULT_SCAN; - hif_drv->strCfgValues.active_scan_time = ACTIVE_SCAN_TIME; - hif_drv->strCfgValues.passive_scan_time = PASSIVE_SCAN_TIME; - hif_drv->strCfgValues.curr_tx_rate = AUTORATE; + hif_drv->cfg_values.site_survey_enabled = SITE_SURVEY_OFF; + hif_drv->cfg_values.scan_source = DEFAULT_SCAN; + hif_drv->cfg_values.active_scan_time = ACTIVE_SCAN_TIME; + hif_drv->cfg_values.passive_scan_time = PASSIVE_SCAN_TIME; + hif_drv->cfg_values.curr_tx_rate = AUTORATE; hif_drv->u64P2p_MgmtTimeout = 0; PRINT_INFO(HOSTINF_DBG, "Initialization values, Site survey value: %d\n Scan source: %d\n Active scan time: %d\n Passive scan time: %d\nCurrent tx Rate = %d\n", - - hif_drv->strCfgValues.site_survey_enabled, hif_drv->strCfgValues.scan_source, - hif_drv->strCfgValues.active_scan_time, hif_drv->strCfgValues.passive_scan_time, - hif_drv->strCfgValues.curr_tx_rate); + hif_drv->cfg_values.site_survey_enabled, + hif_drv->cfg_values.scan_source, + hif_drv->cfg_values.active_scan_time, + hif_drv->cfg_values.passive_scan_time, + hif_drv->cfg_values.curr_tx_rate); up(&hif_drv->gtOsCfgValuesSem); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index fcfdd2151c9f..90e2946b7c72 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -302,7 +302,7 @@ struct host_if_drv { enum host_if_state hif_state; u8 assoc_bssid[ETH_ALEN]; - struct cfg_param_val strCfgValues; + struct cfg_param_val cfg_values; /* semaphores */ struct semaphore gtOsCfgValuesSem; struct semaphore hSemTestKeyBlock; From 33110ad7d60506d215a57c13be5ed5607c5b155b Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:27 +0900 Subject: [PATCH 117/843] staging: wilc1000: rename gtOsCfgValuesSem of struct host_if_drv This patch renames gtOsCfgValuesSem of struct host_if_drv to sem_cfg_values to avoid CamelCase naming convention. And, remove the relation comment. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 18 +++++++++--------- drivers/staging/wilc1000/host_interface.h | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 135d4b31d3e0..c6a08d2bfe31 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -525,7 +525,7 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, struct wid strWIDList[32]; u8 u8WidCnt = 0; - down(&hif_drv->gtOsCfgValuesSem); + down(&hif_drv->sem_cfg_values); PRINT_D(HOSTINF_DBG, "Setting CFG params\n"); @@ -797,7 +797,7 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, PRINT_ER("Error in setting CFG params\n"); ERRORHANDLER: - up(&hif_drv->gtOsCfgValuesSem); + up(&hif_drv->sem_cfg_values); return result; } @@ -3952,7 +3952,7 @@ s32 hif_get_cfg(struct host_if_drv *hif_drv, u16 u16WID, u16 *pu16WID_Value) { s32 result = 0; - down(&hif_drv->gtOsCfgValuesSem); + down(&hif_drv->sem_cfg_values); if (!hif_drv) { PRINT_ER("hif_drv NULL\n"); @@ -4036,7 +4036,7 @@ s32 hif_get_cfg(struct host_if_drv *hif_drv, u16 u16WID, u16 *pu16WID_Value) break; } - up(&hif_drv->gtOsCfgValuesSem); + up(&hif_drv->sem_cfg_values); return result; } @@ -4143,8 +4143,8 @@ s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) setup_timer(&hif_drv->hRemainOnChannel, ListenTimerCB, 0); - sema_init(&hif_drv->gtOsCfgValuesSem, 1); - down(&hif_drv->gtOsCfgValuesSem); + sema_init(&hif_drv->sem_cfg_values, 1); + down(&hif_drv->sem_cfg_values); hif_drv->hif_state = HOST_IF_IDLE; hif_drv->cfg_values.site_survey_enabled = SITE_SURVEY_OFF; @@ -4162,14 +4162,14 @@ s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) hif_drv->cfg_values.passive_scan_time, hif_drv->cfg_values.curr_tx_rate); - up(&hif_drv->gtOsCfgValuesSem); + up(&hif_drv->sem_cfg_values); clients_count++; return result; _fail_timer_2: - up(&hif_drv->gtOsCfgValuesSem); + up(&hif_drv->sem_cfg_values); del_timer_sync(&hif_drv->hConnectTimer); del_timer_sync(&hif_drv->hScanTimer); kthread_stop(hif_thread_handler); @@ -4238,7 +4238,7 @@ s32 host_int_deinit(struct host_if_drv *hif_drv) wilc_mq_destroy(&hif_msg_q); } - down(&hif_drv->gtOsCfgValuesSem); + down(&hif_drv->sem_cfg_values); ret = remove_handler_in_list(hif_drv); if (ret) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 90e2946b7c72..7b9930ebaa42 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -303,8 +303,8 @@ struct host_if_drv { u8 assoc_bssid[ETH_ALEN]; struct cfg_param_val cfg_values; -/* semaphores */ - struct semaphore gtOsCfgValuesSem; + + struct semaphore sem_cfg_values; struct semaphore hSemTestKeyBlock; struct semaphore hSemTestDisconnectBlock; From 9ea47133ecf0fa9622aa815835f791031566d229 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:28 +0900 Subject: [PATCH 118/843] staging: wilc1000: rename hSemTestKeyBlock of struct host_if_drv This patch renames hSemTestKeyBlock of struct host_if_drv to sem_test_key_block to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 24 +++++++++++------------ drivers/staging/wilc1000/host_interface.h | 3 +-- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index c6a08d2bfe31..99bf633b73dc 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1792,7 +1792,7 @@ static int Handle_Key(struct host_if_drv *hif_drv, result = send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); } - up(&hif_drv->hSemTestKeyBlock); + up(&hif_drv->sem_test_key_block); break; case WPARxGtk: @@ -1826,7 +1826,7 @@ static int Handle_Key(struct host_if_drv *hif_drv, get_id_from_handler(hif_drv)); kfree(pu8keybuf); - up(&hif_drv->hSemTestKeyBlock); + up(&hif_drv->sem_test_key_block); } if (pstrHostIFkeyAttr->action & ADDKEY) { @@ -1859,7 +1859,7 @@ static int Handle_Key(struct host_if_drv *hif_drv, get_id_from_handler(hif_drv)); kfree(pu8keybuf); - up(&hif_drv->hSemTestKeyBlock); + up(&hif_drv->sem_test_key_block); } _WPARxGtk_end_case_: kfree(pstrHostIFkeyAttr->attr.wpa.key); @@ -1897,7 +1897,7 @@ _WPARxGtk_end_case_: result = send_config_pkt(SET_CFG, strWIDList, 2, get_id_from_handler(hif_drv)); kfree(pu8keybuf); - up(&hif_drv->hSemTestKeyBlock); + up(&hif_drv->sem_test_key_block); } if (pstrHostIFkeyAttr->action & ADDKEY) { pu8keybuf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL); @@ -1920,7 +1920,7 @@ _WPARxGtk_end_case_: result = send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); kfree(pu8keybuf); - up(&hif_drv->hSemTestKeyBlock); + up(&hif_drv->sem_test_key_block); } _WPAPtk_end_case_: @@ -3076,7 +3076,7 @@ int host_int_remove_wep_key(struct host_if_drv *hif_drv, u8 index) result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) PRINT_ER("Error in sending message queue : Request to remove WEP key\n"); - down(&hif_drv->hSemTestKeyBlock); + down(&hif_drv->sem_test_key_block); return result; } @@ -3103,7 +3103,7 @@ int host_int_set_wep_default_key(struct host_if_drv *hif_drv, u8 index) result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) PRINT_ER("Error in sending message queue : Default key index\n"); - down(&hif_drv->hSemTestKeyBlock); + down(&hif_drv->sem_test_key_block); return result; } @@ -3137,7 +3137,7 @@ int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv, result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) PRINT_ER("Error in sending message queue :WEP Key\n"); - down(&hif_drv->hSemTestKeyBlock); + down(&hif_drv->sem_test_key_block); return result; } @@ -3181,7 +3181,7 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, if (result) PRINT_ER("Error in sending message queue :WEP Key\n"); - down(&hif_drv->hSemTestKeyBlock); + down(&hif_drv->sem_test_key_block); return result; } @@ -3246,7 +3246,7 @@ s32 host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *pu8Ptk, if (result) PRINT_ER("Error in sending message queue: PTK Key\n"); - down(&hif_drv->hSemTestKeyBlock); + down(&hif_drv->sem_test_key_block); return result; } @@ -3308,7 +3308,7 @@ s32 host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *pu8RxGtk, if (result) PRINT_ER("Error in sending message queue: RX GTK\n"); - down(&hif_drv->hSemTestKeyBlock); + down(&hif_drv->sem_test_key_block); return result; } @@ -4107,7 +4107,7 @@ s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) sema_init(&hif_sema_deinit, 1); } - sema_init(&hif_drv->hSemTestKeyBlock, 0); + sema_init(&hif_drv->sem_test_key_block, 0); sema_init(&hif_drv->hSemTestDisconnectBlock, 0); sema_init(&hif_drv->hSemGetRSSI, 0); sema_init(&hif_drv->hSemGetLINKSPEED, 0); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 7b9930ebaa42..a8fd290f8eb3 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -305,8 +305,7 @@ struct host_if_drv { struct cfg_param_val cfg_values; struct semaphore sem_cfg_values; - struct semaphore hSemTestKeyBlock; - + struct semaphore sem_test_key_block; struct semaphore hSemTestDisconnectBlock; struct semaphore hSemGetRSSI; struct semaphore hSemGetLINKSPEED; From e55e49670b673d7ab9f7fb51d3530347f327fd40 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:29 +0900 Subject: [PATCH 119/843] staging: wilc1000: rename hSemTestDisconnectBlock of struct host_if_drv This patch renames hSemTestDisconnectBlock of struct host_if_drv to sem_test_disconn_block to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 6 +++--- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 99bf633b73dc..4daef636ecbc 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2041,7 +2041,7 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv) } } - up(&hif_drv->hSemTestDisconnectBlock); + up(&hif_drv->sem_test_disconn_block); } void resolve_disconnect_aberration(struct host_if_drv *hif_drv) @@ -3563,7 +3563,7 @@ s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode) if (result) PRINT_ER("Failed to send message queue: disconnect\n"); - down(&hif_drv->hSemTestDisconnectBlock); + down(&hif_drv->sem_test_disconn_block); return result; } @@ -4108,7 +4108,7 @@ s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) } sema_init(&hif_drv->sem_test_key_block, 0); - sema_init(&hif_drv->hSemTestDisconnectBlock, 0); + sema_init(&hif_drv->sem_test_disconn_block, 0); sema_init(&hif_drv->hSemGetRSSI, 0); sema_init(&hif_drv->hSemGetLINKSPEED, 0); sema_init(&hif_drv->hSemGetCHNL, 0); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index a8fd290f8eb3..0c7a77389613 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -306,7 +306,7 @@ struct host_if_drv { struct semaphore sem_cfg_values; struct semaphore sem_test_key_block; - struct semaphore hSemTestDisconnectBlock; + struct semaphore sem_test_disconn_block; struct semaphore hSemGetRSSI; struct semaphore hSemGetLINKSPEED; struct semaphore hSemGetCHNL; From 7e111f9ea92386c7ec90efe7b62363da272beb1c Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:30 +0900 Subject: [PATCH 120/843] staging: wilc1000: rename hSemGetRSSI of struct host_if_drv This patch renames hSemGetRSSI of struct host_if_drv to sem_get_rssi to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 6 +++--- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 4daef636ecbc..b40ce3bc46d3 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2099,7 +2099,7 @@ static void Handle_GetRssi(struct host_if_drv *hif_drv) result = -EFAULT; } - up(&hif_drv->hSemGetRSSI); + up(&hif_drv->sem_get_rssi); } static void Handle_GetLinkspeed(struct host_if_drv *hif_drv) @@ -3815,7 +3815,7 @@ s32 host_int_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi) return -EFAULT; } - down(&hif_drv->hSemGetRSSI); + down(&hif_drv->sem_get_rssi); if (!ps8Rssi) { PRINT_ER("RSS pointer value is null"); @@ -4109,7 +4109,7 @@ s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) sema_init(&hif_drv->sem_test_key_block, 0); sema_init(&hif_drv->sem_test_disconn_block, 0); - sema_init(&hif_drv->hSemGetRSSI, 0); + sema_init(&hif_drv->sem_get_rssi, 0); sema_init(&hif_drv->hSemGetLINKSPEED, 0); sema_init(&hif_drv->hSemGetCHNL, 0); sema_init(&hif_drv->hSemInactiveTime, 0); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 0c7a77389613..dada9c57af4f 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -307,7 +307,7 @@ struct host_if_drv { struct semaphore sem_cfg_values; struct semaphore sem_test_key_block; struct semaphore sem_test_disconn_block; - struct semaphore hSemGetRSSI; + struct semaphore sem_get_rssi; struct semaphore hSemGetLINKSPEED; struct semaphore hSemGetCHNL; struct semaphore hSemInactiveTime; From bc34da66057062636fb6c6d339ed8f0856c6d6c0 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:31 +0900 Subject: [PATCH 121/843] staging: wilc1000: rename hSemGetLINKSPEED of struct host_if_drv This patch renames hSemGetLINKSPEED of struct host_if_drv to sem_get_link_speed to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 6 +++--- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index b40ce3bc46d3..7b654c5022b5 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2123,7 +2123,7 @@ static void Handle_GetLinkspeed(struct host_if_drv *hif_drv) result = -EFAULT; } - up(&hif_drv->hSemGetLINKSPEED); + up(&hif_drv->sem_get_link_speed); } s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics) @@ -3842,7 +3842,7 @@ s32 host_int_get_link_speed(struct host_if_drv *hif_drv, s8 *ps8lnkspd) return -EFAULT; } - down(&hif_drv->hSemGetLINKSPEED); + down(&hif_drv->sem_get_link_speed); if (!ps8lnkspd) { PRINT_ER("LINKSPEED pointer value is null"); @@ -4110,7 +4110,7 @@ s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) sema_init(&hif_drv->sem_test_key_block, 0); sema_init(&hif_drv->sem_test_disconn_block, 0); sema_init(&hif_drv->sem_get_rssi, 0); - sema_init(&hif_drv->hSemGetLINKSPEED, 0); + sema_init(&hif_drv->sem_get_link_speed, 0); sema_init(&hif_drv->hSemGetCHNL, 0); sema_init(&hif_drv->hSemInactiveTime, 0); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index dada9c57af4f..a603e84ded59 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -308,7 +308,7 @@ struct host_if_drv { struct semaphore sem_test_key_block; struct semaphore sem_test_disconn_block; struct semaphore sem_get_rssi; - struct semaphore hSemGetLINKSPEED; + struct semaphore sem_get_link_speed; struct semaphore hSemGetCHNL; struct semaphore hSemInactiveTime; /* timer handlers */ From 4ea90008f60744b3d466f3c13c972e42a64c6aa2 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:32 +0900 Subject: [PATCH 122/843] staging: wilc1000: rename hSemGetCHNL of struct host_if_drv This patch renames hSemGetCHNL of struct host_if_drv to sem_get_chnl to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 6 +++--- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 7b654c5022b5..b59551a728dd 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2075,7 +2075,7 @@ static s32 Handle_GetChnl(struct host_if_drv *hif_drv) result = -EFAULT; } - up(&hif_drv->hSemGetCHNL); + up(&hif_drv->sem_get_chnl); return result; } @@ -3737,7 +3737,7 @@ s32 host_int_get_host_chnl_num(struct host_if_drv *hif_drv, u8 *pu8ChNo) result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) PRINT_ER("wilc mq send fail\n"); - down(&hif_drv->hSemGetCHNL); + down(&hif_drv->sem_get_chnl); *pu8ChNo = ch_no; @@ -4111,7 +4111,7 @@ s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) sema_init(&hif_drv->sem_test_disconn_block, 0); sema_init(&hif_drv->sem_get_rssi, 0); sema_init(&hif_drv->sem_get_link_speed, 0); - sema_init(&hif_drv->hSemGetCHNL, 0); + sema_init(&hif_drv->sem_get_chnl, 0); sema_init(&hif_drv->hSemInactiveTime, 0); PRINT_D(HOSTINF_DBG, "INIT: CLIENT COUNT %d\n", clients_count); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index a603e84ded59..8d12099d584f 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -309,7 +309,7 @@ struct host_if_drv { struct semaphore sem_test_disconn_block; struct semaphore sem_get_rssi; struct semaphore sem_get_link_speed; - struct semaphore hSemGetCHNL; + struct semaphore sem_get_chnl; struct semaphore hSemInactiveTime; /* timer handlers */ struct timer_list hScanTimer; From 569a3c670c1a4249db991afda0989d8efb73f91d Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:33 +0900 Subject: [PATCH 123/843] staging: wilc1000: rename hSemInactiveTime of struct host_if_drv This patch renames hSemInactiveTime of struct host_if_drv to sem_inactive_time to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 6 +++--- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index b59551a728dd..f95d662cbdbb 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2211,7 +2211,7 @@ static s32 Handle_Get_InActiveTime(struct host_if_drv *hif_drv, PRINT_D(CFG80211_DBG, "Getting inactive time : %d\n", inactive_time); - up(&hif_drv->hSemInactiveTime); + up(&hif_drv->sem_inactive_time); return result; } @@ -3765,7 +3765,7 @@ s32 host_int_get_inactive_time(struct host_if_drv *hif_drv, if (result) PRINT_ER("Failed to send get host channel param's message queue "); - down(&hif_drv->hSemInactiveTime); + down(&hif_drv->sem_inactive_time); *pu32InactiveTime = inactive_time; @@ -4112,7 +4112,7 @@ s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) sema_init(&hif_drv->sem_get_rssi, 0); sema_init(&hif_drv->sem_get_link_speed, 0); sema_init(&hif_drv->sem_get_chnl, 0); - sema_init(&hif_drv->hSemInactiveTime, 0); + sema_init(&hif_drv->sem_inactive_time, 0); PRINT_D(HOSTINF_DBG, "INIT: CLIENT COUNT %d\n", clients_count); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 8d12099d584f..de3baaf4d2e4 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -310,7 +310,7 @@ struct host_if_drv { struct semaphore sem_get_rssi; struct semaphore sem_get_link_speed; struct semaphore sem_get_chnl; - struct semaphore hSemInactiveTime; + struct semaphore sem_inactive_time; /* timer handlers */ struct timer_list hScanTimer; struct timer_list hConnectTimer; From 13b313e45c6dbd20dc6bc174f423be5a372b992f Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:34 +0900 Subject: [PATCH 124/843] staging: wilc1000: rename hScanTimer of struct host_if_drv This patch renames hScanTimer of struct host_if_drv to scan_timer to avoid CamelCase naming convention. And, remove the relation comment. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 21 ++++++++++----------- drivers/staging/wilc1000/host_interface.h | 4 ++-- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index f95d662cbdbb..8b13e67b2ddf 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -921,7 +921,7 @@ static s32 Handle_Scan(struct host_if_drv *hif_drv, ERRORHANDLER: if (result) { - del_timer(&hif_drv->hScanTimer); + del_timer(&hif_drv->scan_timer); Handle_ScanDone(hif_drv, SCAN_EVENT_ABORTED); } @@ -1636,7 +1636,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, if (hif_drv->usr_scan_req.pfUserScanResult) { PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running OBSS Scan >>\n\n"); - del_timer(&hif_drv->hScanTimer); + del_timer(&hif_drv->scan_timer); Handle_ScanDone((void *)hif_drv, SCAN_EVENT_ABORTED); } @@ -1683,7 +1683,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW while scanning\n"); PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running Scan >>\n\n"); - del_timer(&hif_drv->hScanTimer); + del_timer(&hif_drv->scan_timer); if (hif_drv->usr_scan_req.pfUserScanResult) Handle_ScanDone(hif_drv, SCAN_EVENT_ABORTED); } @@ -1999,7 +1999,7 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv) strDisconnectNotifInfo.ie_len = 0; if (hif_drv->usr_scan_req.pfUserScanResult) { - del_timer(&hif_drv->hScanTimer); + del_timer(&hif_drv->scan_timer); hif_drv->usr_scan_req.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, hif_drv->usr_scan_req.u32UserScanPvoid, NULL); @@ -2881,7 +2881,7 @@ static int hostIFthread(void *pvArg) break; case HOST_IF_MSG_RCVD_SCAN_COMPLETE: - del_timer(&hif_drv->hScanTimer); + del_timer(&hif_drv->scan_timer); PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); if (!linux_wlan_get_num_conn_ifcs()) @@ -3920,8 +3920,8 @@ s32 host_int_scan(struct host_if_drv *hif_drv, u8 u8ScanSource, } PRINT_D(HOSTINF_DBG, ">> Starting the SCAN timer\n"); - hif_drv->hScanTimer.data = (unsigned long)hif_drv; - mod_timer(&hif_drv->hScanTimer, + hif_drv->scan_timer.data = (unsigned long)hif_drv; + mod_timer(&hif_drv->scan_timer, jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT)); return result; @@ -4137,8 +4137,7 @@ s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000)); } - setup_timer(&hif_drv->hScanTimer, TimerCB_Scan, 0); - + setup_timer(&hif_drv->scan_timer, TimerCB_Scan, 0); setup_timer(&hif_drv->hConnectTimer, TimerCB_Connect, 0); setup_timer(&hif_drv->hRemainOnChannel, ListenTimerCB, 0); @@ -4171,7 +4170,7 @@ s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) _fail_timer_2: up(&hif_drv->sem_cfg_values); del_timer_sync(&hif_drv->hConnectTimer); - del_timer_sync(&hif_drv->hScanTimer); + del_timer_sync(&hif_drv->scan_timer); kthread_stop(hif_thread_handler); _fail_mq_: wilc_mq_destroy(&hif_msg_q); @@ -4195,7 +4194,7 @@ s32 host_int_deinit(struct host_if_drv *hif_drv) terminated_handle = hif_drv; PRINT_D(HOSTINF_DBG, "De-initializing host interface for client %d\n", clients_count); - if (del_timer_sync(&hif_drv->hScanTimer)) + if (del_timer_sync(&hif_drv->scan_timer)) PRINT_D(HOSTINF_DBG, ">> Scan timer is active\n"); if (del_timer_sync(&hif_drv->hConnectTimer)) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index de3baaf4d2e4..55afcae2977e 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -311,8 +311,8 @@ struct host_if_drv { struct semaphore sem_get_link_speed; struct semaphore sem_get_chnl; struct semaphore sem_inactive_time; -/* timer handlers */ - struct timer_list hScanTimer; + + struct timer_list scan_timer; struct timer_list hConnectTimer; struct timer_list hRemainOnChannel; From 81a59506f2788cd1ed438e9e54714af5dd2f3df7 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:35 +0900 Subject: [PATCH 125/843] staging: wilc1000: rename hConnectTimer of struct host_if_drv This patch renames hConnectTimer of struct host_if_drv to connect_timer to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 17 ++++++++--------- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 8b13e67b2ddf..6cde0bfab436 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1223,7 +1223,7 @@ ERRORHANDLER: if (result) { tstrConnectInfo strConnectInfo; - del_timer(&hif_drv->hConnectTimer); + del_timer(&hif_drv->connect_timer); PRINT_D(HOSTINF_DBG, "could not start connecting to the required network\n"); @@ -1594,7 +1594,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, hif_drv->usr_conn_req.ConnReqIEsLen); } - del_timer(&hif_drv->hConnectTimer); + del_timer(&hif_drv->connect_timer); hif_drv->usr_conn_req.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, &strConnectInfo, u8MacStatus, @@ -2009,7 +2009,7 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv) if (hif_drv->usr_conn_req.pfUserConnectResult) { if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) { PRINT_D(HOSTINF_DBG, "Upper layer requested termination of connection\n"); - del_timer(&hif_drv->hConnectTimer); + del_timer(&hif_drv->connect_timer); } hif_drv->usr_conn_req.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, @@ -3512,8 +3512,8 @@ s32 host_int_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid, return -EFAULT; } - hif_drv->hConnectTimer.data = (unsigned long)hif_drv; - mod_timer(&hif_drv->hConnectTimer, + hif_drv->connect_timer.data = (unsigned long)hif_drv; + mod_timer(&hif_drv->connect_timer, jiffies + msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT)); return result; @@ -4138,8 +4138,7 @@ s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) } setup_timer(&hif_drv->scan_timer, TimerCB_Scan, 0); - setup_timer(&hif_drv->hConnectTimer, TimerCB_Connect, 0); - + setup_timer(&hif_drv->connect_timer, TimerCB_Connect, 0); setup_timer(&hif_drv->hRemainOnChannel, ListenTimerCB, 0); sema_init(&hif_drv->sem_cfg_values, 1); @@ -4169,7 +4168,7 @@ s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) _fail_timer_2: up(&hif_drv->sem_cfg_values); - del_timer_sync(&hif_drv->hConnectTimer); + del_timer_sync(&hif_drv->connect_timer); del_timer_sync(&hif_drv->scan_timer); kthread_stop(hif_thread_handler); _fail_mq_: @@ -4197,7 +4196,7 @@ s32 host_int_deinit(struct host_if_drv *hif_drv) if (del_timer_sync(&hif_drv->scan_timer)) PRINT_D(HOSTINF_DBG, ">> Scan timer is active\n"); - if (del_timer_sync(&hif_drv->hConnectTimer)) + if (del_timer_sync(&hif_drv->connect_timer)) PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); if (del_timer_sync(&periodic_rssi)) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 55afcae2977e..d95011e73b01 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -313,7 +313,7 @@ struct host_if_drv { struct semaphore sem_inactive_time; struct timer_list scan_timer; - struct timer_list hConnectTimer; + struct timer_list connect_timer; struct timer_list hRemainOnChannel; bool IFC_UP; From cc2d7e9e86e279eb71c6be985b6e6dc81b05c251 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:36 +0900 Subject: [PATCH 126/843] staging: wilc1000: rename hRemainOnChannel of struct host_if_drv This patch renames hRemainOnChannel of struct host_if_drv to remain_on_ch_timer to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 12 ++++++------ drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 6cde0bfab436..3cff865011ae 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2530,8 +2530,8 @@ static int Handle_RemainOnChan(struct host_if_drv *hif_drv, ERRORHANDLER: { P2P_LISTEN_STATE = 1; - hif_drv->hRemainOnChannel.data = (unsigned long)hif_drv; - mod_timer(&hif_drv->hRemainOnChannel, + hif_drv->remain_on_ch_timer.data = (unsigned long)hif_drv; + mod_timer(&hif_drv->remain_on_ch_timer, jiffies + msecs_to_jiffies(pstrHostIfRemainOnChan->u32duration)); @@ -2628,7 +2628,7 @@ static void ListenTimerCB(unsigned long arg) struct host_if_msg msg; struct host_if_drv *hif_drv = (struct host_if_drv *)arg; - del_timer(&hif_drv->hRemainOnChannel); + del_timer(&hif_drv->remain_on_ch_timer); memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; @@ -4139,7 +4139,7 @@ s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) setup_timer(&hif_drv->scan_timer, TimerCB_Scan, 0); setup_timer(&hif_drv->connect_timer, TimerCB_Connect, 0); - setup_timer(&hif_drv->hRemainOnChannel, ListenTimerCB, 0); + setup_timer(&hif_drv->remain_on_ch_timer, ListenTimerCB, 0); sema_init(&hif_drv->sem_cfg_values, 1); down(&hif_drv->sem_cfg_values); @@ -4202,7 +4202,7 @@ s32 host_int_deinit(struct host_if_drv *hif_drv) if (del_timer_sync(&periodic_rssi)) PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); - del_timer_sync(&hif_drv->hRemainOnChannel); + del_timer_sync(&hif_drv->remain_on_ch_timer); host_int_set_wfi_drv_handler(NULL); down(&hif_sema_driver); @@ -4391,7 +4391,7 @@ s32 host_int_ListenStateExpired(struct host_if_drv *hif_drv, u32 u32SessionID) return -EFAULT; } - del_timer(&hif_drv->hRemainOnChannel); + del_timer(&hif_drv->remain_on_ch_timer); memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index d95011e73b01..71788b1e80a8 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -314,7 +314,7 @@ struct host_if_drv { struct timer_list scan_timer; struct timer_list connect_timer; - struct timer_list hRemainOnChannel; + struct timer_list remain_on_ch_timer; bool IFC_UP; }; From e3e7e8acf5e6d87fc44d969abdf272c9bc10efa2 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:37 +0900 Subject: [PATCH 127/843] staging: wilc1000: host_interface.h : remove over-commenting There are over-commenting in the host_interface.h file and most of them are not helpful to explain what the code does and generate 80 ending line over warnings. So, all of comments are removed in this patch and the comments will later be added if necessary with the preferred Linux style. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.h | 740 +--------------------- 1 file changed, 4 insertions(+), 736 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 71788b1e80a8..37e5c7487c4a 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -1,12 +1,3 @@ -/*! - * @file host_interface.h - * @brief File containg host interface APIs - * @author zsalah - * @sa host_interface.c - * @date 8 March 2012 - * @version 1.0 - */ - #ifndef HOST_INT_H #define HOST_INT_H @@ -173,31 +164,18 @@ enum KEY_TYPE { PMKSA, }; - -/*Scan callBack function definition*/ typedef void (*wilc_scan_result)(enum scan_event, tstrNetworkInfo *, void *, void *); -/*Connect callBack function definition*/ typedef void (*wilc_connect_result)(enum conn_event, tstrConnectInfo *, u8, tstrDisconnectNotifInfo *, void *); -typedef void (*wilc_remain_on_chan_expired)(void *, u32); /*Remain on channel expiration callback function*/ -typedef void (*wilc_remain_on_chan_ready)(void *); /*Remain on channel callback function*/ +typedef void (*wilc_remain_on_chan_expired)(void *, u32); +typedef void (*wilc_remain_on_chan_ready)(void *); -/*! - * @struct rcvd_net_info - * @brief Structure to hold Received Asynchronous Network info - * @details - * @todo - * @sa - * @author Mostafa Abu Bakr - * @date 25 March 2012 - * @version 1.0 - */ struct rcvd_net_info { u8 *buffer; u32 len; @@ -214,10 +192,7 @@ struct hidden_network { }; struct user_scan_req { - /* Scan user call back function */ wilc_scan_result pfUserScanResult; - - /* User specific parameter to be delivered through the Scan User Callback function */ void *u32UserScanPvoid; u32 u32RcvdChCount; @@ -232,10 +207,8 @@ struct user_conn_req { size_t ssidLen; u8 *pu8ConnReqIEs; size_t ConnReqIEsLen; - /* Connect user call back function */ wilc_connect_result pfUserConnectResult; bool IsHTCapable; - /* User specific parameter to be delivered through the Connect User Callback function */ void *u32UserConnectPvoid; }; @@ -331,335 +304,37 @@ struct add_sta_param { u16 u16HTExtParams; u32 u32TxBeamformingCap; u8 u8ASELCap; - u16 u16FlagsMask; /**/ - u16 u16FlagsSet; /* Date: Thu, 29 Oct 2015 11:58:38 +0900 Subject: [PATCH 128/843] staging: wilc1000: rename bReg of struct reg_frame This patch renames bReg of struct reg_frame to reg to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 8 +++++--- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 3cff865011ae..41f226ff6c65 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2552,7 +2552,9 @@ static int Handle_RegisterFrame(struct host_if_drv *hif_drv, struct wid wid; u8 *pu8CurrByte; - PRINT_D(HOSTINF_DBG, "Handling frame register Flag : %d FrameType: %d\n", pstrHostIfRegisterFrame->bReg, pstrHostIfRegisterFrame->u16FrameType); + PRINT_D(HOSTINF_DBG, "Handling frame register : %d FrameType: %d\n", + pstrHostIfRegisterFrame->reg, + pstrHostIfRegisterFrame->u16FrameType); wid.id = (u16)WID_REGISTER_FRAME; wid.type = WID_STR; @@ -2562,7 +2564,7 @@ static int Handle_RegisterFrame(struct host_if_drv *hif_drv, pu8CurrByte = wid.val; - *pu8CurrByte++ = pstrHostIfRegisterFrame->bReg; + *pu8CurrByte++ = pstrHostIfRegisterFrame->reg; *pu8CurrByte++ = pstrHostIfRegisterFrame->u8Regid; memcpy(pu8CurrByte, &pstrHostIfRegisterFrame->u16FrameType, sizeof(u16)); @@ -4434,7 +4436,7 @@ s32 host_int_frame_register(struct host_if_drv *hif_drv, u16 u16FrameType, bool break; } msg.body.reg_frame.u16FrameType = u16FrameType; - msg.body.reg_frame.bReg = bReg; + msg.body.reg_frame.reg = bReg; msg.drv = hif_drv; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 37e5c7487c4a..ad3071a0ac55 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -245,7 +245,7 @@ struct remain_ch { }; struct reg_frame { - bool bReg; + bool reg; u16 u16FrameType; u8 u8Regid; }; From d5f654cabbf6c4133450326c16cd1d577ff175e2 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:39 +0900 Subject: [PATCH 129/843] staging: wilc1000: rename u16FrameType of struct reg_frame This patch renames u16FrameType of struct reg_frame to frame_type to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 7 +++---- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 41f226ff6c65..3c179123efad 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2554,7 +2554,7 @@ static int Handle_RegisterFrame(struct host_if_drv *hif_drv, PRINT_D(HOSTINF_DBG, "Handling frame register : %d FrameType: %d\n", pstrHostIfRegisterFrame->reg, - pstrHostIfRegisterFrame->u16FrameType); + pstrHostIfRegisterFrame->frame_type); wid.id = (u16)WID_REGISTER_FRAME; wid.type = WID_STR; @@ -2566,8 +2566,7 @@ static int Handle_RegisterFrame(struct host_if_drv *hif_drv, *pu8CurrByte++ = pstrHostIfRegisterFrame->reg; *pu8CurrByte++ = pstrHostIfRegisterFrame->u8Regid; - memcpy(pu8CurrByte, &pstrHostIfRegisterFrame->u16FrameType, - sizeof(u16)); + memcpy(pu8CurrByte, &pstrHostIfRegisterFrame->frame_type, sizeof(u16)); wid.size = sizeof(u16) + 2; @@ -4435,7 +4434,7 @@ s32 host_int_frame_register(struct host_if_drv *hif_drv, u16 u16FrameType, bool PRINT_D(HOSTINF_DBG, "Not valid frame type\n"); break; } - msg.body.reg_frame.u16FrameType = u16FrameType; + msg.body.reg_frame.frame_type = u16FrameType; msg.body.reg_frame.reg = bReg; msg.drv = hif_drv; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index ad3071a0ac55..f4239a782e0b 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -246,7 +246,7 @@ struct remain_ch { struct reg_frame { bool reg; - u16 u16FrameType; + u16 frame_type; u8 u8Regid; }; From bcb410bbc971e585f56fec4f19cbeec54953ab71 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:40 +0900 Subject: [PATCH 130/843] staging: wilc1000: rename u8Regid of struct reg_frame This patch renames u8Regid of struct reg_frame to reg_id to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 6 +++--- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 3c179123efad..12e0d210a3b1 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2565,7 +2565,7 @@ static int Handle_RegisterFrame(struct host_if_drv *hif_drv, pu8CurrByte = wid.val; *pu8CurrByte++ = pstrHostIfRegisterFrame->reg; - *pu8CurrByte++ = pstrHostIfRegisterFrame->u8Regid; + *pu8CurrByte++ = pstrHostIfRegisterFrame->reg_id; memcpy(pu8CurrByte, &pstrHostIfRegisterFrame->frame_type, sizeof(u16)); wid.size = sizeof(u16) + 2; @@ -4422,12 +4422,12 @@ s32 host_int_frame_register(struct host_if_drv *hif_drv, u16 u16FrameType, bool switch (u16FrameType) { case ACTION: PRINT_D(HOSTINF_DBG, "ACTION\n"); - msg.body.reg_frame.u8Regid = ACTION_FRM_IDX; + msg.body.reg_frame.reg_id = ACTION_FRM_IDX; break; case PROBE_REQ: PRINT_D(HOSTINF_DBG, "PROBE REQ\n"); - msg.body.reg_frame.u8Regid = PROBE_REQ_IDX; + msg.body.reg_frame.reg_id = PROBE_REQ_IDX; break; default: diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index f4239a782e0b..6cca6e07d2ff 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -247,7 +247,7 @@ struct remain_ch { struct reg_frame { bool reg; u16 frame_type; - u8 u8Regid; + u8 reg_id; }; From 839ab709b3c49b5dd4535502ec2d2a57f981704c Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:41 +0900 Subject: [PATCH 131/843] staging: wilc1000: rename u16Channel of struct remain_ch This patch renames u16Channel of struct remain_ch to ch to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 11 ++++++----- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 12e0d210a3b1..99958f4c4ba4 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2483,10 +2483,10 @@ static int Handle_RemainOnChan(struct host_if_drv *hif_drv, hif_drv->remain_on_ch.pVoid = pstrHostIfRemainOnChan->pVoid; hif_drv->remain_on_ch.pRemainOnChanExpired = pstrHostIfRemainOnChan->pRemainOnChanExpired; hif_drv->remain_on_ch.pRemainOnChanReady = pstrHostIfRemainOnChan->pRemainOnChanReady; - hif_drv->remain_on_ch.u16Channel = pstrHostIfRemainOnChan->u16Channel; + hif_drv->remain_on_ch.ch = pstrHostIfRemainOnChan->ch; hif_drv->remain_on_ch.u32ListenSessionID = pstrHostIfRemainOnChan->u32ListenSessionID; } else { - pstrHostIfRemainOnChan->u16Channel = hif_drv->remain_on_ch.u16Channel; + pstrHostIfRemainOnChan->ch = hif_drv->remain_on_ch.ch; } if (hif_drv->usr_scan_req.pfUserScanResult) { @@ -2507,7 +2507,8 @@ static int Handle_RemainOnChan(struct host_if_drv *hif_drv, goto ERRORHANDLER; } - PRINT_D(HOSTINF_DBG, "Setting channel :%d\n", pstrHostIfRemainOnChan->u16Channel); + PRINT_D(HOSTINF_DBG, "Setting channel :%d\n", + pstrHostIfRemainOnChan->ch); u8remain_on_chan_flag = true; wid.id = (u16)WID_REMAIN_ON_CHAN; @@ -2520,7 +2521,7 @@ static int Handle_RemainOnChan(struct host_if_drv *hif_drv, } wid.val[0] = u8remain_on_chan_flag; - wid.val[1] = (s8)pstrHostIfRemainOnChan->u16Channel; + wid.val[1] = (s8)pstrHostIfRemainOnChan->ch; result = send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); @@ -4367,7 +4368,7 @@ s32 host_int_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID, memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_REMAIN_ON_CHAN; - msg.body.remain_on_ch.u16Channel = chan; + msg.body.remain_on_ch.ch = chan; msg.body.remain_on_ch.pRemainOnChanExpired = RemainOnChanExpired; msg.body.remain_on_ch.pRemainOnChanReady = RemainOnChanReady; msg.body.remain_on_ch.pVoid = pvUserArg; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 6cca6e07d2ff..dc68711c6710 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -236,7 +236,7 @@ struct ba_session_info { }; struct remain_ch { - u16 u16Channel; + u16 ch; u32 u32duration; wilc_remain_on_chan_expired pRemainOnChanExpired; wilc_remain_on_chan_ready pRemainOnChanReady; From bfb62abc27789dfb4b30702c17795345a7f7fab3 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:42 +0900 Subject: [PATCH 132/843] staging: wilc1000: rename pRemainOnChanExpired of struct remain_ch This patch renames pRemainOnChanExpired of struct remain_ch to expired to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 10 +++++----- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 99958f4c4ba4..e0ba7202b584 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2481,7 +2481,7 @@ static int Handle_RemainOnChan(struct host_if_drv *hif_drv, if (!hif_drv->remain_on_ch_pending) { hif_drv->remain_on_ch.pVoid = pstrHostIfRemainOnChan->pVoid; - hif_drv->remain_on_ch.pRemainOnChanExpired = pstrHostIfRemainOnChan->pRemainOnChanExpired; + hif_drv->remain_on_ch.expired = pstrHostIfRemainOnChan->expired; hif_drv->remain_on_ch.pRemainOnChanReady = pstrHostIfRemainOnChan->pRemainOnChanReady; hif_drv->remain_on_ch.ch = pstrHostIfRemainOnChan->ch; hif_drv->remain_on_ch.u32ListenSessionID = pstrHostIfRemainOnChan->u32ListenSessionID; @@ -2610,9 +2610,9 @@ static u32 Handle_ListenStateExpired(struct host_if_drv *hif_drv, goto _done_; } - if (hif_drv->remain_on_ch.pRemainOnChanExpired) { - hif_drv->remain_on_ch.pRemainOnChanExpired(hif_drv->remain_on_ch.pVoid, - pstrHostIfRemainOnChan->u32ListenSessionID); + if (hif_drv->remain_on_ch.expired) { + hif_drv->remain_on_ch.expired(hif_drv->remain_on_ch.pVoid, + pstrHostIfRemainOnChan->u32ListenSessionID); } P2P_LISTEN_STATE = 0; } else { @@ -4369,7 +4369,7 @@ s32 host_int_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID, msg.id = HOST_IF_MSG_REMAIN_ON_CHAN; msg.body.remain_on_ch.ch = chan; - msg.body.remain_on_ch.pRemainOnChanExpired = RemainOnChanExpired; + msg.body.remain_on_ch.expired = RemainOnChanExpired; msg.body.remain_on_ch.pRemainOnChanReady = RemainOnChanReady; msg.body.remain_on_ch.pVoid = pvUserArg; msg.body.remain_on_ch.u32duration = u32duration; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index dc68711c6710..3a9f08cc156f 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -238,7 +238,7 @@ struct ba_session_info { struct remain_ch { u16 ch; u32 u32duration; - wilc_remain_on_chan_expired pRemainOnChanExpired; + wilc_remain_on_chan_expired expired; wilc_remain_on_chan_ready pRemainOnChanReady; void *pVoid; u32 u32ListenSessionID; From 5e5f7916b37741de3219c8b84a162e2b7b949dd9 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:43 +0900 Subject: [PATCH 133/843] staging: wilc1000: rename pRemainOnChanReady of struct remain_ch This patch renames pRemainOnChanReady of struct remain_ch to ready to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 8 ++++---- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index e0ba7202b584..c49bbbf1a1ed 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2482,7 +2482,7 @@ static int Handle_RemainOnChan(struct host_if_drv *hif_drv, if (!hif_drv->remain_on_ch_pending) { hif_drv->remain_on_ch.pVoid = pstrHostIfRemainOnChan->pVoid; hif_drv->remain_on_ch.expired = pstrHostIfRemainOnChan->expired; - hif_drv->remain_on_ch.pRemainOnChanReady = pstrHostIfRemainOnChan->pRemainOnChanReady; + hif_drv->remain_on_ch.ready = pstrHostIfRemainOnChan->ready; hif_drv->remain_on_ch.ch = pstrHostIfRemainOnChan->ch; hif_drv->remain_on_ch.u32ListenSessionID = pstrHostIfRemainOnChan->u32ListenSessionID; } else { @@ -2536,8 +2536,8 @@ ERRORHANDLER: jiffies + msecs_to_jiffies(pstrHostIfRemainOnChan->u32duration)); - if (hif_drv->remain_on_ch.pRemainOnChanReady) - hif_drv->remain_on_ch.pRemainOnChanReady(hif_drv->remain_on_ch.pVoid); + if (hif_drv->remain_on_ch.ready) + hif_drv->remain_on_ch.ready(hif_drv->remain_on_ch.pVoid); if (hif_drv->remain_on_ch_pending) hif_drv->remain_on_ch_pending = 0; @@ -4370,7 +4370,7 @@ s32 host_int_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID, msg.id = HOST_IF_MSG_REMAIN_ON_CHAN; msg.body.remain_on_ch.ch = chan; msg.body.remain_on_ch.expired = RemainOnChanExpired; - msg.body.remain_on_ch.pRemainOnChanReady = RemainOnChanReady; + msg.body.remain_on_ch.ready = RemainOnChanReady; msg.body.remain_on_ch.pVoid = pvUserArg; msg.body.remain_on_ch.u32duration = u32duration; msg.body.remain_on_ch.u32ListenSessionID = u32SessionID; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 3a9f08cc156f..d3dafc608625 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -239,7 +239,7 @@ struct remain_ch { u16 ch; u32 u32duration; wilc_remain_on_chan_expired expired; - wilc_remain_on_chan_ready pRemainOnChanReady; + wilc_remain_on_chan_ready ready; void *pVoid; u32 u32ListenSessionID; }; From c5cc4b12641bf029286b24f418847409ed513259 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:44 +0900 Subject: [PATCH 134/843] staging: wilc1000: rename pVoid of struct remain_ch This patch renames pVoid of struct remain_ch to arg to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 8 ++++---- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index c49bbbf1a1ed..1ccf45024c5e 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2480,7 +2480,7 @@ static int Handle_RemainOnChan(struct host_if_drv *hif_drv, struct wid wid; if (!hif_drv->remain_on_ch_pending) { - hif_drv->remain_on_ch.pVoid = pstrHostIfRemainOnChan->pVoid; + hif_drv->remain_on_ch.arg = pstrHostIfRemainOnChan->arg; hif_drv->remain_on_ch.expired = pstrHostIfRemainOnChan->expired; hif_drv->remain_on_ch.ready = pstrHostIfRemainOnChan->ready; hif_drv->remain_on_ch.ch = pstrHostIfRemainOnChan->ch; @@ -2537,7 +2537,7 @@ ERRORHANDLER: msecs_to_jiffies(pstrHostIfRemainOnChan->u32duration)); if (hif_drv->remain_on_ch.ready) - hif_drv->remain_on_ch.ready(hif_drv->remain_on_ch.pVoid); + hif_drv->remain_on_ch.ready(hif_drv->remain_on_ch.arg); if (hif_drv->remain_on_ch_pending) hif_drv->remain_on_ch_pending = 0; @@ -2611,7 +2611,7 @@ static u32 Handle_ListenStateExpired(struct host_if_drv *hif_drv, } if (hif_drv->remain_on_ch.expired) { - hif_drv->remain_on_ch.expired(hif_drv->remain_on_ch.pVoid, + hif_drv->remain_on_ch.expired(hif_drv->remain_on_ch.arg, pstrHostIfRemainOnChan->u32ListenSessionID); } P2P_LISTEN_STATE = 0; @@ -4371,7 +4371,7 @@ s32 host_int_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID, msg.body.remain_on_ch.ch = chan; msg.body.remain_on_ch.expired = RemainOnChanExpired; msg.body.remain_on_ch.ready = RemainOnChanReady; - msg.body.remain_on_ch.pVoid = pvUserArg; + msg.body.remain_on_ch.arg = pvUserArg; msg.body.remain_on_ch.u32duration = u32duration; msg.body.remain_on_ch.u32ListenSessionID = u32SessionID; msg.drv = hif_drv; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index d3dafc608625..a69be5574e6e 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -240,7 +240,7 @@ struct remain_ch { u32 u32duration; wilc_remain_on_chan_expired expired; wilc_remain_on_chan_ready ready; - void *pVoid; + void *arg; u32 u32ListenSessionID; }; From 3fc4999e3d81546f4be2c11bce82adbfc7cb216e Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:45 +0900 Subject: [PATCH 135/843] staging: wilc1000: rename au8Bssid of struct ba_session_info This patch renames au8Bssid of struct ba_session_info to bssid to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 22 +++++++++++----------- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 1ccf45024c5e..872f239c4676 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2715,9 +2715,9 @@ static s32 Handle_AddBASession(struct host_if_drv *hif_drv, char *ptr = NULL; PRINT_D(HOSTINF_DBG, "Opening Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\nBufferSize == %d\nSessionTimeOut = %d\n", - strHostIfBASessionInfo->au8Bssid[0], - strHostIfBASessionInfo->au8Bssid[1], - strHostIfBASessionInfo->au8Bssid[2], + strHostIfBASessionInfo->bssid[0], + strHostIfBASessionInfo->bssid[1], + strHostIfBASessionInfo->bssid[2], strHostIfBASessionInfo->u16BufferSize, strHostIfBASessionInfo->u16SessionTimeout, strHostIfBASessionInfo->u8Ted); @@ -2730,7 +2730,7 @@ static s32 Handle_AddBASession(struct host_if_drv *hif_drv, *ptr++ = 0x14; *ptr++ = 0x3; *ptr++ = 0x0; - memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); + memcpy(ptr, strHostIfBASessionInfo->bssid, ETH_ALEN); ptr += ETH_ALEN; *ptr++ = strHostIfBASessionInfo->u8Ted; *ptr++ = 1; @@ -2755,7 +2755,7 @@ static s32 Handle_AddBASession(struct host_if_drv *hif_drv, *ptr++ = 15; *ptr++ = 7; *ptr++ = 0x2; - memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); + memcpy(ptr, strHostIfBASessionInfo->bssid, ETH_ALEN); ptr += ETH_ALEN; *ptr++ = strHostIfBASessionInfo->u8Ted; *ptr++ = 8; @@ -2778,9 +2778,9 @@ static s32 Handle_DelAllRxBASessions(struct host_if_drv *hif_drv, char *ptr = NULL; PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\n", - strHostIfBASessionInfo->au8Bssid[0], - strHostIfBASessionInfo->au8Bssid[1], - strHostIfBASessionInfo->au8Bssid[2], + strHostIfBASessionInfo->bssid[0], + strHostIfBASessionInfo->bssid[1], + strHostIfBASessionInfo->bssid[2], strHostIfBASessionInfo->u8Ted); wid.id = (u16)WID_DEL_ALL_RX_BA; @@ -2791,7 +2791,7 @@ static s32 Handle_DelAllRxBASessions(struct host_if_drv *hif_drv, *ptr++ = 0x14; *ptr++ = 0x3; *ptr++ = 0x2; - memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); + memcpy(ptr, strHostIfBASessionInfo->bssid, ETH_ALEN); ptr += ETH_ALEN; *ptr++ = strHostIfBASessionInfo->u8Ted; *ptr++ = 0; @@ -4914,7 +4914,7 @@ s32 host_int_delBASession(struct host_if_drv *hif_drv, char *pBSSID, char TID) msg.id = HOST_IF_MSG_DEL_BA_SESSION; - memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); + memcpy(pBASessionInfo->bssid, pBSSID, ETH_ALEN); pBASessionInfo->u8Ted = TID; msg.drv = hif_drv; @@ -4944,7 +4944,7 @@ s32 host_int_del_All_Rx_BASession(struct host_if_drv *hif_drv, msg.id = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS; - memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); + memcpy(pBASessionInfo->bssid, pBSSID, ETH_ALEN); pBASessionInfo->u8Ted = TID; msg.drv = hif_drv; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index a69be5574e6e..29cab4eb0180 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -229,7 +229,7 @@ struct get_mac_addr { }; struct ba_session_info { - u8 au8Bssid[ETH_ALEN]; + u8 bssid[ETH_ALEN]; u8 u8Ted; u16 u16BufferSize; u16 u16SessionTimeout; From 16c9b391425340e09be378e7becee0d4319dd295 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:46 +0900 Subject: [PATCH 136/843] staging: wilc1000: rename u8Ted of struct ba_session_info This patch renames u8Ted of struct ba_session_info to tid to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 14 +++++++------- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 872f239c4676..74d4c8f48744 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2720,7 +2720,7 @@ static s32 Handle_AddBASession(struct host_if_drv *hif_drv, strHostIfBASessionInfo->bssid[2], strHostIfBASessionInfo->u16BufferSize, strHostIfBASessionInfo->u16SessionTimeout, - strHostIfBASessionInfo->u8Ted); + strHostIfBASessionInfo->tid); wid.id = (u16)WID_11E_P_ACTION_REQ; wid.type = WID_STR; @@ -2732,7 +2732,7 @@ static s32 Handle_AddBASession(struct host_if_drv *hif_drv, *ptr++ = 0x0; memcpy(ptr, strHostIfBASessionInfo->bssid, ETH_ALEN); ptr += ETH_ALEN; - *ptr++ = strHostIfBASessionInfo->u8Ted; + *ptr++ = strHostIfBASessionInfo->tid; *ptr++ = 1; *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); *ptr++ = ((strHostIfBASessionInfo->u16BufferSize >> 16) & 0xFF); @@ -2757,7 +2757,7 @@ static s32 Handle_AddBASession(struct host_if_drv *hif_drv, *ptr++ = 0x2; memcpy(ptr, strHostIfBASessionInfo->bssid, ETH_ALEN); ptr += ETH_ALEN; - *ptr++ = strHostIfBASessionInfo->u8Ted; + *ptr++ = strHostIfBASessionInfo->tid; *ptr++ = 8; *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); @@ -2781,7 +2781,7 @@ static s32 Handle_DelAllRxBASessions(struct host_if_drv *hif_drv, strHostIfBASessionInfo->bssid[0], strHostIfBASessionInfo->bssid[1], strHostIfBASessionInfo->bssid[2], - strHostIfBASessionInfo->u8Ted); + strHostIfBASessionInfo->tid); wid.id = (u16)WID_DEL_ALL_RX_BA; wid.type = WID_STR; @@ -2793,7 +2793,7 @@ static s32 Handle_DelAllRxBASessions(struct host_if_drv *hif_drv, *ptr++ = 0x2; memcpy(ptr, strHostIfBASessionInfo->bssid, ETH_ALEN); ptr += ETH_ALEN; - *ptr++ = strHostIfBASessionInfo->u8Ted; + *ptr++ = strHostIfBASessionInfo->tid; *ptr++ = 0; *ptr++ = 32; @@ -4915,7 +4915,7 @@ s32 host_int_delBASession(struct host_if_drv *hif_drv, char *pBSSID, char TID) msg.id = HOST_IF_MSG_DEL_BA_SESSION; memcpy(pBASessionInfo->bssid, pBSSID, ETH_ALEN); - pBASessionInfo->u8Ted = TID; + pBASessionInfo->tid = TID; msg.drv = hif_drv; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -4945,7 +4945,7 @@ s32 host_int_del_All_Rx_BASession(struct host_if_drv *hif_drv, msg.id = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS; memcpy(pBASessionInfo->bssid, pBSSID, ETH_ALEN); - pBASessionInfo->u8Ted = TID; + pBASessionInfo->tid = TID; msg.drv = hif_drv; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 29cab4eb0180..9110e9ecf8cd 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -230,7 +230,7 @@ struct get_mac_addr { struct ba_session_info { u8 bssid[ETH_ALEN]; - u8 u8Ted; + u8 tid; u16 u16BufferSize; u16 u16SessionTimeout; }; From 277c21308f1e8e135ca7d27bce9b6d496b3ad24f Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:47 +0900 Subject: [PATCH 137/843] staging: wilc1000: rename u16BufferSize of struct ba_session_info This patch renames u16BufferSize of struct ba_session_info to buf_size to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 8 ++++---- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 74d4c8f48744..75ad6d006944 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2718,7 +2718,7 @@ static s32 Handle_AddBASession(struct host_if_drv *hif_drv, strHostIfBASessionInfo->bssid[0], strHostIfBASessionInfo->bssid[1], strHostIfBASessionInfo->bssid[2], - strHostIfBASessionInfo->u16BufferSize, + strHostIfBASessionInfo->buf_size, strHostIfBASessionInfo->u16SessionTimeout, strHostIfBASessionInfo->tid); @@ -2734,8 +2734,8 @@ static s32 Handle_AddBASession(struct host_if_drv *hif_drv, ptr += ETH_ALEN; *ptr++ = strHostIfBASessionInfo->tid; *ptr++ = 1; - *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); - *ptr++ = ((strHostIfBASessionInfo->u16BufferSize >> 16) & 0xFF); + *ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF); + *ptr++ = ((strHostIfBASessionInfo->buf_size >> 16) & 0xFF); *ptr++ = (strHostIfBASessionInfo->u16SessionTimeout & 0xFF); *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); *ptr++ = (AddbaTimeout & 0xFF); @@ -2759,7 +2759,7 @@ static s32 Handle_AddBASession(struct host_if_drv *hif_drv, ptr += ETH_ALEN; *ptr++ = strHostIfBASessionInfo->tid; *ptr++ = 8; - *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); + *ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF); *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); *ptr++ = 3; result = send_config_pkt(SET_CFG, &wid, 1, diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 9110e9ecf8cd..e020a6d72d06 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -231,7 +231,7 @@ struct get_mac_addr { struct ba_session_info { u8 bssid[ETH_ALEN]; u8 tid; - u16 u16BufferSize; + u16 buf_size; u16 u16SessionTimeout; }; From 23d0bfaa69648efaa91b247c7ac2fbdc21e0a90c Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:48 +0900 Subject: [PATCH 138/843] staging: wilc1000: rename u16SessionTimeout of struct ba_session_info This patch renames u16SessionTimeout of struct ba_session_info to time_out to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 8 ++++---- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 75ad6d006944..5bc85dd27589 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2719,7 +2719,7 @@ static s32 Handle_AddBASession(struct host_if_drv *hif_drv, strHostIfBASessionInfo->bssid[1], strHostIfBASessionInfo->bssid[2], strHostIfBASessionInfo->buf_size, - strHostIfBASessionInfo->u16SessionTimeout, + strHostIfBASessionInfo->time_out, strHostIfBASessionInfo->tid); wid.id = (u16)WID_11E_P_ACTION_REQ; @@ -2736,8 +2736,8 @@ static s32 Handle_AddBASession(struct host_if_drv *hif_drv, *ptr++ = 1; *ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF); *ptr++ = ((strHostIfBASessionInfo->buf_size >> 16) & 0xFF); - *ptr++ = (strHostIfBASessionInfo->u16SessionTimeout & 0xFF); - *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); + *ptr++ = (strHostIfBASessionInfo->time_out & 0xFF); + *ptr++ = ((strHostIfBASessionInfo->time_out >> 16) & 0xFF); *ptr++ = (AddbaTimeout & 0xFF); *ptr++ = ((AddbaTimeout >> 16) & 0xFF); *ptr++ = 8; @@ -2760,7 +2760,7 @@ static s32 Handle_AddBASession(struct host_if_drv *hif_drv, *ptr++ = strHostIfBASessionInfo->tid; *ptr++ = 8; *ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF); - *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); + *ptr++ = ((strHostIfBASessionInfo->time_out >> 16) & 0xFF); *ptr++ = 3; result = send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index e020a6d72d06..2050fbe45ced 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -232,7 +232,7 @@ struct ba_session_info { u8 bssid[ETH_ALEN]; u8 tid; u16 buf_size; - u16 u16SessionTimeout; + u16 time_out; }; struct remain_ch { From 6bd77755b687f0b6f0b4a1ee1a8733fb5e4c0973 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:49 +0900 Subject: [PATCH 139/843] staging: wilc1000: remove warnings line over 80 characters This patch removes the warnings reported by checkpatch.pl for line over 80 characters. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.h | 116 ++++++++++++++-------- 1 file changed, 74 insertions(+), 42 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 2050fbe45ced..486c647d6ea4 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -316,82 +316,114 @@ int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv, int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, const u8 *key, u8 len, u8 index, u8 mode, enum AUTHTYPE auth_type); -s32 host_int_add_ptk(struct host_if_drv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen, - const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx); -s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime); -s32 host_int_add_rx_gtk(struct host_if_drv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKeylen, - u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC, - const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode); -s32 host_int_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk, u8 u8KeyIdx); -s32 host_int_set_pmkid_info(struct host_if_drv *hWFIDrv, struct host_if_pmkid_attr *pu8PmkidInfoArray); +s32 host_int_add_ptk(struct host_if_drv *hWFIDrv, const u8 *pu8Ptk, + u8 u8PtkKeylen, const u8 *mac_addr, + const u8 *pu8RxMic, const u8 *pu8TxMic, + u8 mode, u8 u8Ciphermode, u8 u8Idx); +s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, + u32 *pu32InactiveTime); +s32 host_int_add_rx_gtk(struct host_if_drv *hWFIDrv, const u8 *pu8RxGtk, + u8 u8GtkKeylen, u8 u8KeyIdx, + u32 u32KeyRSClen, const u8 *KeyRSC, + const u8 *pu8RxMic, const u8 *pu8TxMic, + u8 mode, u8 u8Ciphermode); +s32 host_int_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen, + u8 *pu8TxGtk, u8 u8KeyIdx); +s32 host_int_set_pmkid_info(struct host_if_drv *hWFIDrv, + struct host_if_pmkid_attr *pu8PmkidInfoArray); s32 host_int_get_pmkid_info(struct host_if_drv *hWFIDrv, u8 *pu8PmkidInfoArray, - u32 u32PmkidInfoLen); -s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hWFIDrv, u8 *pu8PassPhrase, - u8 u8Psklength); + u32 u32PmkidInfoLen); +s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hWFIDrv, + u8 *pu8PassPhrase, + u8 u8Psklength); s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hWFIDrv, - u8 *pu8PassPhrase, u8 u8Psklength); + u8 *pu8PassPhrase, u8 u8Psklength); s32 host_int_get_MacAddress(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress); s32 host_int_set_MacAddress(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress); int host_int_wait_msg_queue_idle(void); s32 host_int_set_start_scan_req(struct host_if_drv *hWFIDrv, u8 scanSource); s32 host_int_get_start_scan_req(struct host_if_drv *hWFIDrv, u8 *pu8ScanSource); s32 host_int_set_join_req(struct host_if_drv *hWFIDrv, u8 *pu8bssid, - const u8 *pu8ssid, size_t ssidLen, - const u8 *pu8IEs, size_t IEsLen, - wilc_connect_result pfConnectResult, void *pvUserArg, - u8 u8security, enum AUTHTYPE tenuAuth_type, - u8 u8channel, - void *pJoinParams); + const u8 *pu8ssid, size_t ssidLen, + const u8 *pu8IEs, size_t IEsLen, + wilc_connect_result pfConnectResult, void *pvUserArg, + u8 u8security, enum AUTHTYPE tenuAuth_type, + u8 u8channel, void *pJoinParams); s32 host_int_flush_join_req(struct host_if_drv *hWFIDrv); s32 host_int_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode); s32 host_int_disconnect_station(struct host_if_drv *hWFIDrv, u8 assoc_id); -s32 host_int_get_assoc_req_info(struct host_if_drv *hWFIDrv, u8 *pu8AssocReqInfo, - u32 u32AssocReqInfoLen); -s32 host_int_get_assoc_res_info(struct host_if_drv *hWFIDrv, u8 *pu8AssocRespInfo, - u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen); -s32 host_int_get_rx_power_level(struct host_if_drv *hWFIDrv, u8 *pu8RxPowerLevel, - u32 u32RxPowerLevelLen); +s32 host_int_get_assoc_req_info(struct host_if_drv *hWFIDrv, + u8 *pu8AssocReqInfo, + u32 u32AssocReqInfoLen); +s32 host_int_get_assoc_res_info(struct host_if_drv *hWFIDrv, + u8 *pu8AssocRespInfo, + u32 u32MaxAssocRespInfoLen, + u32 *pu32RcvdAssocRespInfoLen); +s32 host_int_get_rx_power_level(struct host_if_drv *hWFIDrv, + u8 *pu8RxPowerLevel, + u32 u32RxPowerLevelLen); int host_int_set_mac_chnl_num(struct host_if_drv *wfi_drv, u8 channel); s32 host_int_get_host_chnl_num(struct host_if_drv *hWFIDrv, u8 *pu8ChNo); s32 host_int_get_rssi(struct host_if_drv *hWFIDrv, s8 *ps8Rssi); s32 host_int_get_link_speed(struct host_if_drv *hWFIDrv, s8 *ps8lnkspd); s32 host_int_scan(struct host_if_drv *hWFIDrv, u8 u8ScanSource, - u8 u8ScanType, u8 *pu8ChnlFreqList, - u8 u8ChnlListLen, const u8 *pu8IEs, - size_t IEsLen, wilc_scan_result ScanResult, - void *pvUserArg, - struct hidden_network *pstrHiddenNetwork); -s32 hif_set_cfg(struct host_if_drv *hWFIDrv, struct cfg_param_val *pstrCfgParamVal); + u8 u8ScanType, u8 *pu8ChnlFreqList, + u8 u8ChnlListLen, const u8 *pu8IEs, + size_t IEsLen, wilc_scan_result ScanResult, + void *pvUserArg, struct hidden_network *pstrHiddenNetwork); +s32 hif_set_cfg(struct host_if_drv *hWFIDrv, + struct cfg_param_val *pstrCfgParamVal); s32 hif_get_cfg(struct host_if_drv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value); s32 host_int_init(struct net_device *dev, struct host_if_drv **phWFIDrv); s32 host_int_deinit(struct host_if_drv *hWFIDrv); s32 host_int_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval, - u32 u32DTIMPeriod, - u32 u32HeadLen, u8 *pu8Head, - u32 u32TailLen, u8 *pu8tail); + u32 u32DTIMPeriod, + u32 u32HeadLen, + u8 *pu8Head, + u32 u32TailLen, + u8 *pu8tail); s32 host_int_del_beacon(struct host_if_drv *hWFIDrv); s32 host_int_add_station(struct host_if_drv *hWFIDrv, struct add_sta_param *pstrStaParams); -s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]); +s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, + u8 pu8MacAddr[][ETH_ALEN]); s32 host_int_del_station(struct host_if_drv *hWFIDrv, const u8 *pu8MacAddr); s32 host_int_edit_station(struct host_if_drv *hWFIDrv, struct add_sta_param *pstrStaParams); -s32 host_int_set_power_mgmt(struct host_if_drv *hWFIDrv, bool bIsEnabled, u32 u32Timeout); -s32 host_int_setup_multicast_filter(struct host_if_drv *hWFIDrv, bool bIsEnabled, u32 u32count); -s32 host_int_setup_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx); +s32 host_int_set_power_mgmt(struct host_if_drv *hWFIDrv, + bool bIsEnabled, + u32 u32Timeout); +s32 host_int_setup_multicast_filter(struct host_if_drv *hWFIDrv, + bool bIsEnabled, + u32 u32count); +s32 host_int_setup_ipaddress(struct host_if_drv *hWFIDrv, + u8 *pu8IPAddr, + u8 idx); s32 host_int_delBASession(struct host_if_drv *hWFIDrv, char *pBSSID, char TID); -s32 host_int_del_All_Rx_BASession(struct host_if_drv *hWFIDrv, char *pBSSID, char TID); +s32 host_int_del_All_Rx_BASession(struct host_if_drv *hWFIDrv, + char *pBSSID, + char TID); s32 host_int_get_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx); -s32 host_int_remain_on_channel(struct host_if_drv *hWFIDrv, u32 u32SessionID, u32 u32duration, u16 chan, wilc_remain_on_chan_expired RemainOnChanExpired, wilc_remain_on_chan_ready RemainOnChanReady, void *pvUserArg); +s32 host_int_remain_on_channel(struct host_if_drv *hWFIDrv, + u32 u32SessionID, + u32 u32duration, + u16 chan, + wilc_remain_on_chan_expired RemainOnChanExpired, + wilc_remain_on_chan_ready RemainOnChanReady, + void *pvUserArg); s32 host_int_ListenStateExpired(struct host_if_drv *hWFIDrv, u32 u32SessionID); -s32 host_int_frame_register(struct host_if_drv *hWFIDrv, u16 u16FrameType, bool bReg); +s32 host_int_frame_register(struct host_if_drv *hWFIDrv, + u16 u16FrameType, + bool bReg); int host_int_set_wfi_drv_handler(struct host_if_drv *address); int host_int_set_operation_mode(struct host_if_drv *wfi_drv, u32 mode); -static s32 Handle_ScanDone(struct host_if_drv *drvHandler, enum scan_event enuEvent); +static s32 Handle_ScanDone(struct host_if_drv *drvHandler, + enum scan_event enuEvent); void host_int_freeJoinParams(void *pJoinParams); -s32 host_int_get_statistics(struct host_if_drv *hWFIDrv, struct rf_info *pstrStatistics); +s32 host_int_get_statistics(struct host_if_drv *hWFIDrv, + struct rf_info *pstrStatistics); #endif From bc80185546ad4c801485d94116cafeffa5da776f Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:50 +0900 Subject: [PATCH 140/843] staging: wilc1000: rename pfUserScanResult of struct user_scan_req This patch renames pfUserScanResult of struct user_scan_req to scan_result to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 56 +++++++++++------------ drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 5bc85dd27589..a1437e2df5fd 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -822,7 +822,7 @@ static s32 Handle_Scan(struct host_if_drv *hif_drv, PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state\n", hif_drv->hif_state); - hif_drv->usr_scan_req.pfUserScanResult = pstrHostIFscanAttr->result; + hif_drv->usr_scan_req.scan_result = pstrHostIFscanAttr->result; hif_drv->usr_scan_req.u32UserScanPvoid = pstrHostIFscanAttr->arg; if ((hif_drv->hif_state >= HOST_IF_SCANNING) && @@ -969,10 +969,10 @@ static s32 Handle_ScanDone(struct host_if_drv *hif_drv, return result; } - if (hif_drv->usr_scan_req.pfUserScanResult) { - hif_drv->usr_scan_req.pfUserScanResult(enuEvent, NULL, - hif_drv->usr_scan_req.u32UserScanPvoid, NULL); - hif_drv->usr_scan_req.pfUserScanResult = NULL; + if (hif_drv->usr_scan_req.scan_result) { + hif_drv->usr_scan_req.scan_result(enuEvent, NULL, + hif_drv->usr_scan_req.u32UserScanPvoid, NULL); + hif_drv->usr_scan_req.scan_result = NULL; } return result; @@ -1404,11 +1404,11 @@ static s32 Handle_RcvdNtwrkInfo(struct host_if_drv *hif_drv, bNewNtwrkFound = true; PRINT_INFO(HOSTINF_DBG, "Handling received network info\n"); - if (hif_drv->usr_scan_req.pfUserScanResult) { + if (hif_drv->usr_scan_req.scan_result) { PRINT_D(HOSTINF_DBG, "State: Scanning, parsing network information received\n"); parse_network_info(pstrRcvdNetworkInfo->buffer, &pstrNetworkInfo); if ((!pstrNetworkInfo) || - (!hif_drv->usr_scan_req.pfUserScanResult)) { + (!hif_drv->usr_scan_req.scan_result)) { PRINT_ER("driver is null\n"); result = -EINVAL; goto done; @@ -1447,17 +1447,17 @@ static s32 Handle_RcvdNtwrkInfo(struct host_if_drv *hif_drv, pstrNetworkInfo->bNewNetwork = true; pJoinParams = host_int_ParseJoinBssParam(pstrNetworkInfo); - hif_drv->usr_scan_req.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, - hif_drv->usr_scan_req.u32UserScanPvoid, - pJoinParams); + hif_drv->usr_scan_req.scan_result(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, + hif_drv->usr_scan_req.u32UserScanPvoid, + pJoinParams); } } else { PRINT_WRN(HOSTINF_DBG, "Discovered networks exceeded max. limit\n"); } } else { pstrNetworkInfo->bNewNetwork = false; - hif_drv->usr_scan_req.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, - hif_drv->usr_scan_req.u32UserScanPvoid, NULL); + hif_drv->usr_scan_req.scan_result(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, + hif_drv->usr_scan_req.u32UserScanPvoid, NULL); } } @@ -1498,7 +1498,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, if ((hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) || (hif_drv->hif_state == HOST_IF_CONNECTED) || - hif_drv->usr_scan_req.pfUserScanResult) { + hif_drv->usr_scan_req.scan_result) { if (!pstrRcvdGnrlAsyncInfo->buffer || !hif_drv->usr_conn_req.pfUserConnectResult) { PRINT_ER("driver is null\n"); @@ -1634,7 +1634,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); - if (hif_drv->usr_scan_req.pfUserScanResult) { + if (hif_drv->usr_scan_req.scan_result) { PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running OBSS Scan >>\n\n"); del_timer(&hif_drv->scan_timer); Handle_ScanDone((void *)hif_drv, SCAN_EVENT_ABORTED); @@ -1679,12 +1679,12 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, scan_while_connected = false; } else if ((u8MacStatus == MAC_DISCONNECTED) && - (hif_drv->usr_scan_req.pfUserScanResult)) { + (hif_drv->usr_scan_req.scan_result)) { PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW while scanning\n"); PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running Scan >>\n\n"); del_timer(&hif_drv->scan_timer); - if (hif_drv->usr_scan_req.pfUserScanResult) + if (hif_drv->usr_scan_req.scan_result) Handle_ScanDone(hif_drv, SCAN_EVENT_ABORTED); } } @@ -1998,12 +1998,11 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv) strDisconnectNotifInfo.ie = NULL; strDisconnectNotifInfo.ie_len = 0; - if (hif_drv->usr_scan_req.pfUserScanResult) { + if (hif_drv->usr_scan_req.scan_result) { del_timer(&hif_drv->scan_timer); - hif_drv->usr_scan_req.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, - hif_drv->usr_scan_req.u32UserScanPvoid, NULL); - - hif_drv->usr_scan_req.pfUserScanResult = NULL; + hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, NULL, + hif_drv->usr_scan_req.u32UserScanPvoid, NULL); + hif_drv->usr_scan_req.scan_result = NULL; } if (hif_drv->usr_conn_req.pfUserConnectResult) { @@ -2489,7 +2488,7 @@ static int Handle_RemainOnChan(struct host_if_drv *hif_drv, pstrHostIfRemainOnChan->ch = hif_drv->remain_on_ch.ch; } - if (hif_drv->usr_scan_req.pfUserScanResult) { + if (hif_drv->usr_scan_req.scan_result) { PRINT_INFO(GENERIC_DBG, "Required to remain on chan while scanning return\n"); hif_drv->remain_on_ch_pending = 1; result = -EBUSY; @@ -2833,7 +2832,7 @@ static int hostIFthread(void *pvArg) } if (msg.id == HOST_IF_MSG_CONNECT && - hif_drv->usr_scan_req.pfUserScanResult) { + hif_drv->usr_scan_req.scan_result) { PRINT_D(HOSTINF_DBG, "Requeue connect request till scan done received\n"); wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); usleep_range(2 * 1000, 2 * 1000); @@ -4209,11 +4208,10 @@ s32 host_int_deinit(struct host_if_drv *hif_drv) host_int_set_wfi_drv_handler(NULL); down(&hif_sema_driver); - if (hif_drv->usr_scan_req.pfUserScanResult) { - hif_drv->usr_scan_req.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, - hif_drv->usr_scan_req.u32UserScanPvoid, NULL); - - hif_drv->usr_scan_req.pfUserScanResult = NULL; + if (hif_drv->usr_scan_req.scan_result) { + hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, NULL, + hif_drv->usr_scan_req.u32UserScanPvoid, NULL); + hif_drv->usr_scan_req.scan_result = NULL; } hif_drv->hif_state = HOST_IF_IDLE; @@ -4337,7 +4335,7 @@ void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) if (!hif_drv || hif_drv == terminated_handle) return; - if (hif_drv->usr_scan_req.pfUserScanResult) { + if (hif_drv->usr_scan_req.scan_result) { memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_RCVD_SCAN_COMPLETE; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 486c647d6ea4..b90d9d2aba57 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -192,7 +192,7 @@ struct hidden_network { }; struct user_scan_req { - wilc_scan_result pfUserScanResult; + wilc_scan_result scan_result; void *u32UserScanPvoid; u32 u32RcvdChCount; From 66eaea30867d9d85ab1f579f9d30a4d0e0a22346 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:51 +0900 Subject: [PATCH 141/843] staging: wilc1000: rename u32UserScanPvoid of struct user_scan_req This patch renames u32UserScanPvoid of struct user_scan_req to arg to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 12 ++++++------ drivers/staging/wilc1000/host_interface.h | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index a1437e2df5fd..3648e3cf642d 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -823,7 +823,7 @@ static s32 Handle_Scan(struct host_if_drv *hif_drv, PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state\n", hif_drv->hif_state); hif_drv->usr_scan_req.scan_result = pstrHostIFscanAttr->result; - hif_drv->usr_scan_req.u32UserScanPvoid = pstrHostIFscanAttr->arg; + hif_drv->usr_scan_req.arg = pstrHostIFscanAttr->arg; if ((hif_drv->hif_state >= HOST_IF_SCANNING) && (hif_drv->hif_state < HOST_IF_CONNECTED)) { @@ -971,7 +971,7 @@ static s32 Handle_ScanDone(struct host_if_drv *hif_drv, if (hif_drv->usr_scan_req.scan_result) { hif_drv->usr_scan_req.scan_result(enuEvent, NULL, - hif_drv->usr_scan_req.u32UserScanPvoid, NULL); + hif_drv->usr_scan_req.arg, NULL); hif_drv->usr_scan_req.scan_result = NULL; } @@ -1448,7 +1448,7 @@ static s32 Handle_RcvdNtwrkInfo(struct host_if_drv *hif_drv, pJoinParams = host_int_ParseJoinBssParam(pstrNetworkInfo); hif_drv->usr_scan_req.scan_result(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, - hif_drv->usr_scan_req.u32UserScanPvoid, + hif_drv->usr_scan_req.arg, pJoinParams); } } else { @@ -1457,7 +1457,7 @@ static s32 Handle_RcvdNtwrkInfo(struct host_if_drv *hif_drv, } else { pstrNetworkInfo->bNewNetwork = false; hif_drv->usr_scan_req.scan_result(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, - hif_drv->usr_scan_req.u32UserScanPvoid, NULL); + hif_drv->usr_scan_req.arg, NULL); } } @@ -2001,7 +2001,7 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv) if (hif_drv->usr_scan_req.scan_result) { del_timer(&hif_drv->scan_timer); hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, NULL, - hif_drv->usr_scan_req.u32UserScanPvoid, NULL); + hif_drv->usr_scan_req.arg, NULL); hif_drv->usr_scan_req.scan_result = NULL; } @@ -4210,7 +4210,7 @@ s32 host_int_deinit(struct host_if_drv *hif_drv) if (hif_drv->usr_scan_req.scan_result) { hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, NULL, - hif_drv->usr_scan_req.u32UserScanPvoid, NULL); + hif_drv->usr_scan_req.arg, NULL); hif_drv->usr_scan_req.scan_result = NULL; } diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index b90d9d2aba57..058ea1737907 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -193,8 +193,7 @@ struct hidden_network { struct user_scan_req { wilc_scan_result scan_result; - void *u32UserScanPvoid; - + void *arg; u32 u32RcvdChCount; struct found_net_info astrFoundNetworkInfo[MAX_NUM_SCANNED_NETWORKS]; }; From af973f30a70aafbb775d9811fa89bee804a5e9d9 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:52 +0900 Subject: [PATCH 142/843] staging: wilc1000: rename astrFoundNetworkInfo of struct user_scan_req This patch renames astrFoundNetworkInfo of struct user_scan_req to net_info to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 14 +++++++------- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 3648e3cf642d..35a1262e9098 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1415,15 +1415,15 @@ static s32 Handle_RcvdNtwrkInfo(struct host_if_drv *hif_drv, } for (i = 0; i < hif_drv->usr_scan_req.u32RcvdChCount; i++) { - if ((hif_drv->usr_scan_req.astrFoundNetworkInfo[i].au8bssid) && + if ((hif_drv->usr_scan_req.net_info[i].au8bssid) && (pstrNetworkInfo->au8bssid)) { - if (memcmp(hif_drv->usr_scan_req.astrFoundNetworkInfo[i].au8bssid, + if (memcmp(hif_drv->usr_scan_req.net_info[i].au8bssid, pstrNetworkInfo->au8bssid, 6) == 0) { - if (pstrNetworkInfo->s8rssi <= hif_drv->usr_scan_req.astrFoundNetworkInfo[i].s8rssi) { + if (pstrNetworkInfo->s8rssi <= hif_drv->usr_scan_req.net_info[i].s8rssi) { PRINT_D(HOSTINF_DBG, "Network previously discovered\n"); goto done; } else { - hif_drv->usr_scan_req.astrFoundNetworkInfo[i].s8rssi = pstrNetworkInfo->s8rssi; + hif_drv->usr_scan_req.net_info[i].s8rssi = pstrNetworkInfo->s8rssi; bNewNtwrkFound = false; break; } @@ -1435,11 +1435,11 @@ static s32 Handle_RcvdNtwrkInfo(struct host_if_drv *hif_drv, PRINT_D(HOSTINF_DBG, "New network found\n"); if (hif_drv->usr_scan_req.u32RcvdChCount < MAX_NUM_SCANNED_NETWORKS) { - hif_drv->usr_scan_req.astrFoundNetworkInfo[hif_drv->usr_scan_req.u32RcvdChCount].s8rssi = pstrNetworkInfo->s8rssi; + hif_drv->usr_scan_req.net_info[hif_drv->usr_scan_req.u32RcvdChCount].s8rssi = pstrNetworkInfo->s8rssi; - if (hif_drv->usr_scan_req.astrFoundNetworkInfo[hif_drv->usr_scan_req.u32RcvdChCount].au8bssid && + if (hif_drv->usr_scan_req.net_info[hif_drv->usr_scan_req.u32RcvdChCount].au8bssid && pstrNetworkInfo->au8bssid) { - memcpy(hif_drv->usr_scan_req.astrFoundNetworkInfo[hif_drv->usr_scan_req.u32RcvdChCount].au8bssid, + memcpy(hif_drv->usr_scan_req.net_info[hif_drv->usr_scan_req.u32RcvdChCount].au8bssid, pstrNetworkInfo->au8bssid, 6); hif_drv->usr_scan_req.u32RcvdChCount++; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 058ea1737907..dcb68eae24a0 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -195,7 +195,7 @@ struct user_scan_req { wilc_scan_result scan_result; void *arg; u32 u32RcvdChCount; - struct found_net_info astrFoundNetworkInfo[MAX_NUM_SCANNED_NETWORKS]; + struct found_net_info net_info[MAX_NUM_SCANNED_NETWORKS]; }; struct user_conn_req { From 74ab5e45edf75a8476ee264c8250c35f9b143d4e Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:53 +0900 Subject: [PATCH 143/843] staging: wilc1000: rename ssidLen of struct user_conn_req This patch renames ssidLen of struct user_conn_req to ssid_len to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 10 +++++----- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 35a1262e9098..9f70a858f403 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1010,7 +1010,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv, memcpy(hif_drv->usr_conn_req.pu8bssid, pstrHostIFconnectAttr->bssid, 6); } - hif_drv->usr_conn_req.ssidLen = pstrHostIFconnectAttr->ssid_len; + hif_drv->usr_conn_req.ssid_len = pstrHostIFconnectAttr->ssid_len; if (pstrHostIFconnectAttr->ssid) { hif_drv->usr_conn_req.pu8ssid = kmalloc(pstrHostIFconnectAttr->ssid_len + 1, GFP_KERNEL); memcpy(hif_drv->usr_conn_req.pu8ssid, @@ -1371,7 +1371,7 @@ static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv) if (result) PRINT_ER("Failed to send dissconect config packet\n"); - hif_drv->usr_conn_req.ssidLen = 0; + hif_drv->usr_conn_req.ssid_len = 0; kfree(hif_drv->usr_conn_req.pu8ssid); kfree(hif_drv->usr_conn_req.pu8bssid); hif_drv->usr_conn_req.ConnReqIEsLen = 0; @@ -1623,7 +1623,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, kfree(strConnectInfo.pu8ReqIEs); strConnectInfo.pu8ReqIEs = NULL; - hif_drv->usr_conn_req.ssidLen = 0; + hif_drv->usr_conn_req.ssid_len = 0; kfree(hif_drv->usr_conn_req.pu8ssid); kfree(hif_drv->usr_conn_req.pu8bssid); hif_drv->usr_conn_req.ConnReqIEsLen = 0; @@ -1659,7 +1659,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, eth_zero_addr(hif_drv->assoc_bssid); - hif_drv->usr_conn_req.ssidLen = 0; + hif_drv->usr_conn_req.ssid_len = 0; kfree(hif_drv->usr_conn_req.pu8ssid); kfree(hif_drv->usr_conn_req.pu8bssid); hif_drv->usr_conn_req.ConnReqIEsLen = 0; @@ -2023,7 +2023,7 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv) eth_zero_addr(hif_drv->assoc_bssid); - hif_drv->usr_conn_req.ssidLen = 0; + hif_drv->usr_conn_req.ssid_len = 0; kfree(hif_drv->usr_conn_req.pu8ssid); kfree(hif_drv->usr_conn_req.pu8bssid); hif_drv->usr_conn_req.ConnReqIEsLen = 0; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index dcb68eae24a0..69ce8f14fb2e 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -203,7 +203,7 @@ struct user_conn_req { u8 *pu8ssid; u8 u8security; enum AUTHTYPE tenuAuth_type; - size_t ssidLen; + size_t ssid_len; u8 *pu8ConnReqIEs; size_t ConnReqIEsLen; wilc_connect_result pfUserConnectResult; From a3b2f4b91b3ddd814e853efea423a97dbe7d474b Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:54 +0900 Subject: [PATCH 144/843] staging: wilc1000: rename pu8ConnReqIEs of struct user_conn_req This patch renames pu8ConnReqIEs of struct user_conn_req to ies to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 24 +++++++++++------------ drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 9f70a858f403..667bd2d892cf 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1021,8 +1021,8 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv, hif_drv->usr_conn_req.ConnReqIEsLen = pstrHostIFconnectAttr->ies_len; if (pstrHostIFconnectAttr->ies) { - hif_drv->usr_conn_req.pu8ConnReqIEs = kmalloc(pstrHostIFconnectAttr->ies_len, GFP_KERNEL); - memcpy(hif_drv->usr_conn_req.pu8ConnReqIEs, + hif_drv->usr_conn_req.ies = kmalloc(pstrHostIFconnectAttr->ies_len, GFP_KERNEL); + memcpy(hif_drv->usr_conn_req.ies, pstrHostIFconnectAttr->ies, pstrHostIFconnectAttr->ies_len); } @@ -1053,14 +1053,14 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv, { strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE; strWIDList[u32WidsCount].type = WID_BIN_DATA; - strWIDList[u32WidsCount].val = hif_drv->usr_conn_req.pu8ConnReqIEs; + strWIDList[u32WidsCount].val = hif_drv->usr_conn_req.ies; strWIDList[u32WidsCount].size = hif_drv->usr_conn_req.ConnReqIEsLen; u32WidsCount++; if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) { info_element_size = hif_drv->usr_conn_req.ConnReqIEsLen; info_element = kmalloc(info_element_size, GFP_KERNEL); - memcpy(info_element, hif_drv->usr_conn_req.pu8ConnReqIEs, + memcpy(info_element, hif_drv->usr_conn_req.ies, info_element_size); } } @@ -1339,11 +1339,11 @@ static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv) hif_drv->usr_conn_req.pu8bssid, 6); } - if (hif_drv->usr_conn_req.pu8ConnReqIEs) { + if (hif_drv->usr_conn_req.ies) { strConnectInfo.ReqIEsLen = hif_drv->usr_conn_req.ConnReqIEsLen; strConnectInfo.pu8ReqIEs = kmalloc(hif_drv->usr_conn_req.ConnReqIEsLen, GFP_KERNEL); memcpy(strConnectInfo.pu8ReqIEs, - hif_drv->usr_conn_req.pu8ConnReqIEs, + hif_drv->usr_conn_req.ies, hif_drv->usr_conn_req.ConnReqIEsLen); } @@ -1375,7 +1375,7 @@ static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv) kfree(hif_drv->usr_conn_req.pu8ssid); kfree(hif_drv->usr_conn_req.pu8bssid); hif_drv->usr_conn_req.ConnReqIEsLen = 0; - kfree(hif_drv->usr_conn_req.pu8ConnReqIEs); + kfree(hif_drv->usr_conn_req.ies); eth_zero_addr(u8ConnectedSSID); @@ -1586,11 +1586,11 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, } } - if (hif_drv->usr_conn_req.pu8ConnReqIEs) { + if (hif_drv->usr_conn_req.ies) { strConnectInfo.ReqIEsLen = hif_drv->usr_conn_req.ConnReqIEsLen; strConnectInfo.pu8ReqIEs = kmalloc(hif_drv->usr_conn_req.ConnReqIEsLen, GFP_KERNEL); memcpy(strConnectInfo.pu8ReqIEs, - hif_drv->usr_conn_req.pu8ConnReqIEs, + hif_drv->usr_conn_req.ies, hif_drv->usr_conn_req.ConnReqIEsLen); } @@ -1627,7 +1627,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, kfree(hif_drv->usr_conn_req.pu8ssid); kfree(hif_drv->usr_conn_req.pu8bssid); hif_drv->usr_conn_req.ConnReqIEsLen = 0; - kfree(hif_drv->usr_conn_req.pu8ConnReqIEs); + kfree(hif_drv->usr_conn_req.ies); } else if ((u8MacStatus == MAC_DISCONNECTED) && (hif_drv->hif_state == HOST_IF_CONNECTED)) { PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW\n"); @@ -1663,7 +1663,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, kfree(hif_drv->usr_conn_req.pu8ssid); kfree(hif_drv->usr_conn_req.pu8bssid); hif_drv->usr_conn_req.ConnReqIEsLen = 0; - kfree(hif_drv->usr_conn_req.pu8ConnReqIEs); + kfree(hif_drv->usr_conn_req.ies); if (join_req && join_req_drv == hif_drv) { kfree(join_req); @@ -2027,7 +2027,7 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv) kfree(hif_drv->usr_conn_req.pu8ssid); kfree(hif_drv->usr_conn_req.pu8bssid); hif_drv->usr_conn_req.ConnReqIEsLen = 0; - kfree(hif_drv->usr_conn_req.pu8ConnReqIEs); + kfree(hif_drv->usr_conn_req.ies); if (join_req && join_req_drv == hif_drv) { kfree(join_req); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 69ce8f14fb2e..de4e7d94dfea 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -204,7 +204,7 @@ struct user_conn_req { u8 u8security; enum AUTHTYPE tenuAuth_type; size_t ssid_len; - u8 *pu8ConnReqIEs; + u8 *ies; size_t ConnReqIEsLen; wilc_connect_result pfUserConnectResult; bool IsHTCapable; From 331ed08002ab1ea682a638e4ef97c88a61c3c090 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:55 +0900 Subject: [PATCH 145/843] staging: wilc1000: rename ConnReqIEsLen of struct user_conn_req This patch renames ConnReqIEsLen of struct user_conn_req to ies_len to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 26 +++++++++++------------ drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 667bd2d892cf..bc899e815752 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1019,7 +1019,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv, hif_drv->usr_conn_req.pu8ssid[pstrHostIFconnectAttr->ssid_len] = '\0'; } - hif_drv->usr_conn_req.ConnReqIEsLen = pstrHostIFconnectAttr->ies_len; + hif_drv->usr_conn_req.ies_len = pstrHostIFconnectAttr->ies_len; if (pstrHostIFconnectAttr->ies) { hif_drv->usr_conn_req.ies = kmalloc(pstrHostIFconnectAttr->ies_len, GFP_KERNEL); memcpy(hif_drv->usr_conn_req.ies, @@ -1054,11 +1054,11 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv, strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE; strWIDList[u32WidsCount].type = WID_BIN_DATA; strWIDList[u32WidsCount].val = hif_drv->usr_conn_req.ies; - strWIDList[u32WidsCount].size = hif_drv->usr_conn_req.ConnReqIEsLen; + strWIDList[u32WidsCount].size = hif_drv->usr_conn_req.ies_len; u32WidsCount++; if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) { - info_element_size = hif_drv->usr_conn_req.ConnReqIEsLen; + info_element_size = hif_drv->usr_conn_req.ies_len; info_element = kmalloc(info_element_size, GFP_KERNEL); memcpy(info_element, hif_drv->usr_conn_req.ies, info_element_size); @@ -1340,11 +1340,11 @@ static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv) } if (hif_drv->usr_conn_req.ies) { - strConnectInfo.ReqIEsLen = hif_drv->usr_conn_req.ConnReqIEsLen; - strConnectInfo.pu8ReqIEs = kmalloc(hif_drv->usr_conn_req.ConnReqIEsLen, GFP_KERNEL); + strConnectInfo.ReqIEsLen = hif_drv->usr_conn_req.ies_len; + strConnectInfo.pu8ReqIEs = kmalloc(hif_drv->usr_conn_req.ies_len, GFP_KERNEL); memcpy(strConnectInfo.pu8ReqIEs, hif_drv->usr_conn_req.ies, - hif_drv->usr_conn_req.ConnReqIEsLen); + hif_drv->usr_conn_req.ies_len); } hif_drv->usr_conn_req.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, @@ -1374,7 +1374,7 @@ static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv) hif_drv->usr_conn_req.ssid_len = 0; kfree(hif_drv->usr_conn_req.pu8ssid); kfree(hif_drv->usr_conn_req.pu8bssid); - hif_drv->usr_conn_req.ConnReqIEsLen = 0; + hif_drv->usr_conn_req.ies_len = 0; kfree(hif_drv->usr_conn_req.ies); eth_zero_addr(u8ConnectedSSID); @@ -1587,11 +1587,11 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, } if (hif_drv->usr_conn_req.ies) { - strConnectInfo.ReqIEsLen = hif_drv->usr_conn_req.ConnReqIEsLen; - strConnectInfo.pu8ReqIEs = kmalloc(hif_drv->usr_conn_req.ConnReqIEsLen, GFP_KERNEL); + strConnectInfo.ReqIEsLen = hif_drv->usr_conn_req.ies_len; + strConnectInfo.pu8ReqIEs = kmalloc(hif_drv->usr_conn_req.ies_len, GFP_KERNEL); memcpy(strConnectInfo.pu8ReqIEs, hif_drv->usr_conn_req.ies, - hif_drv->usr_conn_req.ConnReqIEsLen); + hif_drv->usr_conn_req.ies_len); } del_timer(&hif_drv->connect_timer); @@ -1626,7 +1626,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, hif_drv->usr_conn_req.ssid_len = 0; kfree(hif_drv->usr_conn_req.pu8ssid); kfree(hif_drv->usr_conn_req.pu8bssid); - hif_drv->usr_conn_req.ConnReqIEsLen = 0; + hif_drv->usr_conn_req.ies_len = 0; kfree(hif_drv->usr_conn_req.ies); } else if ((u8MacStatus == MAC_DISCONNECTED) && (hif_drv->hif_state == HOST_IF_CONNECTED)) { @@ -1662,7 +1662,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, hif_drv->usr_conn_req.ssid_len = 0; kfree(hif_drv->usr_conn_req.pu8ssid); kfree(hif_drv->usr_conn_req.pu8bssid); - hif_drv->usr_conn_req.ConnReqIEsLen = 0; + hif_drv->usr_conn_req.ies_len = 0; kfree(hif_drv->usr_conn_req.ies); if (join_req && join_req_drv == hif_drv) { @@ -2026,7 +2026,7 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv) hif_drv->usr_conn_req.ssid_len = 0; kfree(hif_drv->usr_conn_req.pu8ssid); kfree(hif_drv->usr_conn_req.pu8bssid); - hif_drv->usr_conn_req.ConnReqIEsLen = 0; + hif_drv->usr_conn_req.ies_len = 0; kfree(hif_drv->usr_conn_req.ies); if (join_req && join_req_drv == hif_drv) { diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index de4e7d94dfea..b2fe8f96855e 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -205,7 +205,7 @@ struct user_conn_req { enum AUTHTYPE tenuAuth_type; size_t ssid_len; u8 *ies; - size_t ConnReqIEsLen; + size_t ies_len; wilc_connect_result pfUserConnectResult; bool IsHTCapable; void *u32UserConnectPvoid; From 33bfb198fff7f36f90c4b5cc753b8e233d1a32f6 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 11:58:56 +0900 Subject: [PATCH 146/843] staging: wilc1000: rename pfUserConnectResult of struct user_conn_req This patch renames pfUserConnectResult of struct user_conn_req to conn_result to avoid CamelCase naming convention. And, some comments modification that has been included name 'pfUserConnectResult'. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 57 ++++++++++++----------- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index bc899e815752..dc94d0096395 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1029,7 +1029,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv, hif_drv->usr_conn_req.u8security = pstrHostIFconnectAttr->security; hif_drv->usr_conn_req.tenuAuth_type = pstrHostIFconnectAttr->auth_type; - hif_drv->usr_conn_req.pfUserConnectResult = pstrHostIFconnectAttr->result; + hif_drv->usr_conn_req.conn_result = pstrHostIFconnectAttr->result; hif_drv->usr_conn_req.u32UserConnectPvoid = pstrHostIFconnectAttr->arg; strWIDList[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT; @@ -1333,7 +1333,7 @@ static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv) memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); - if (hif_drv->usr_conn_req.pfUserConnectResult) { + if (hif_drv->usr_conn_req.conn_result) { if (hif_drv->usr_conn_req.pu8bssid) { memcpy(strConnectInfo.au8bssid, hif_drv->usr_conn_req.pu8bssid, 6); @@ -1347,11 +1347,11 @@ static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv) hif_drv->usr_conn_req.ies_len); } - hif_drv->usr_conn_req.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, - &strConnectInfo, - MAC_DISCONNECTED, - NULL, - hif_drv->usr_conn_req.u32UserConnectPvoid); + hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_CONN_RESP, + &strConnectInfo, + MAC_DISCONNECTED, + NULL, + hif_drv->usr_conn_req.u32UserConnectPvoid); kfree(strConnectInfo.pu8ReqIEs); strConnectInfo.pu8ReqIEs = NULL; @@ -1500,7 +1500,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, (hif_drv->hif_state == HOST_IF_CONNECTED) || hif_drv->usr_scan_req.scan_result) { if (!pstrRcvdGnrlAsyncInfo->buffer || - !hif_drv->usr_conn_req.pfUserConnectResult) { + !hif_drv->usr_conn_req.conn_result) { PRINT_ER("driver is null\n"); return -EINVAL; } @@ -1595,11 +1595,11 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, } del_timer(&hif_drv->connect_timer); - hif_drv->usr_conn_req.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, - &strConnectInfo, - u8MacStatus, - NULL, - hif_drv->usr_conn_req.u32UserConnectPvoid); + hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_CONN_RESP, + &strConnectInfo, + u8MacStatus, + NULL, + hif_drv->usr_conn_req.u32UserConnectPvoid); if ((u8MacStatus == MAC_CONNECTED) && (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { @@ -1644,15 +1644,15 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, strDisconnectNotifInfo.ie = NULL; strDisconnectNotifInfo.ie_len = 0; - if (hif_drv->usr_conn_req.pfUserConnectResult) { + if (hif_drv->usr_conn_req.conn_result) { g_obtainingIP = false; host_int_set_power_mgmt(hif_drv, 0, 0); - hif_drv->usr_conn_req.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, - NULL, - 0, - &strDisconnectNotifInfo, - hif_drv->usr_conn_req.u32UserConnectPvoid); + hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF, + NULL, + 0, + &strDisconnectNotifInfo, + hif_drv->usr_conn_req.u32UserConnectPvoid); } else { PRINT_ER("Connect result callback function is NULL\n"); } @@ -2000,21 +2000,26 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv) if (hif_drv->usr_scan_req.scan_result) { del_timer(&hif_drv->scan_timer); - hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, NULL, - hif_drv->usr_scan_req.arg, NULL); + hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, + NULL, + hif_drv->usr_scan_req.arg, + NULL); hif_drv->usr_scan_req.scan_result = NULL; } - if (hif_drv->usr_conn_req.pfUserConnectResult) { + if (hif_drv->usr_conn_req.conn_result) { if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) { PRINT_D(HOSTINF_DBG, "Upper layer requested termination of connection\n"); del_timer(&hif_drv->connect_timer); } - hif_drv->usr_conn_req.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, - 0, &strDisconnectNotifInfo, hif_drv->usr_conn_req.u32UserConnectPvoid); + hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF, + NULL, + 0, + &strDisconnectNotifInfo, + hif_drv->usr_conn_req.u32UserConnectPvoid); } else { - PRINT_ER("usr_conn_req.pfUserConnectResult = NULL\n"); + PRINT_ER("usr_conn_req.conn_result = NULL\n"); } scan_while_connected = false; @@ -4298,7 +4303,7 @@ void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) return; } - if (!hif_drv->usr_conn_req.pfUserConnectResult) { + if (!hif_drv->usr_conn_req.conn_result) { PRINT_ER("Received mac status is not needed when there is no current Connect Reques\n"); up(&hif_sema_deinit); return; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index b2fe8f96855e..036306814d67 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -206,7 +206,7 @@ struct user_conn_req { size_t ssid_len; u8 *ies; size_t ies_len; - wilc_connect_result pfUserConnectResult; + wilc_connect_result conn_result; bool IsHTCapable; void *u32UserConnectPvoid; }; From ff06982c758a398c30e8eacd9479b873416367cd Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:26 +0900 Subject: [PATCH 147/843] staging: wilc1000: rename IsHTCapable of struct user_conn_req This patch renames IsHTCapable of struct user_conn_req to ht_capable to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 2 +- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index dc94d0096395..f1f1ef4b4157 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1143,7 +1143,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv, *(pu8CurrByte++) = ptstrJoinBssParam->uapsd_cap; *(pu8CurrByte++) = ptstrJoinBssParam->ht_capable; - hif_drv->usr_conn_req.IsHTCapable = ptstrJoinBssParam->ht_capable; + hif_drv->usr_conn_req.ht_capable = ptstrJoinBssParam->ht_capable; *(pu8CurrByte++) = ptstrJoinBssParam->rsn_found; PRINT_D(HOSTINF_DBG, "* rsn found %d*\n", *(pu8CurrByte - 1)); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 036306814d67..3afe4323072d 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -207,7 +207,7 @@ struct user_conn_req { u8 *ies; size_t ies_len; wilc_connect_result conn_result; - bool IsHTCapable; + bool ht_capable; void *u32UserConnectPvoid; }; From 73abaa4906ae8d90d558e053a6af4ff5df03109d Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:27 +0900 Subject: [PATCH 148/843] staging: wilc1000: rename u32UserConnectPvoid of struct user_conn_req This patch renames u32UserConnectPvoid of struct user_conn_req to arg to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 10 +++++----- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index f1f1ef4b4157..3b24a27704e4 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1030,7 +1030,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv, hif_drv->usr_conn_req.u8security = pstrHostIFconnectAttr->security; hif_drv->usr_conn_req.tenuAuth_type = pstrHostIFconnectAttr->auth_type; hif_drv->usr_conn_req.conn_result = pstrHostIFconnectAttr->result; - hif_drv->usr_conn_req.u32UserConnectPvoid = pstrHostIFconnectAttr->arg; + hif_drv->usr_conn_req.arg = pstrHostIFconnectAttr->arg; strWIDList[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT; strWIDList[u32WidsCount].type = WID_INT; @@ -1351,7 +1351,7 @@ static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv) &strConnectInfo, MAC_DISCONNECTED, NULL, - hif_drv->usr_conn_req.u32UserConnectPvoid); + hif_drv->usr_conn_req.arg); kfree(strConnectInfo.pu8ReqIEs); strConnectInfo.pu8ReqIEs = NULL; @@ -1599,7 +1599,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, &strConnectInfo, u8MacStatus, NULL, - hif_drv->usr_conn_req.u32UserConnectPvoid); + hif_drv->usr_conn_req.arg); if ((u8MacStatus == MAC_CONNECTED) && (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { @@ -1652,7 +1652,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, NULL, 0, &strDisconnectNotifInfo, - hif_drv->usr_conn_req.u32UserConnectPvoid); + hif_drv->usr_conn_req.arg); } else { PRINT_ER("Connect result callback function is NULL\n"); } @@ -2017,7 +2017,7 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv) NULL, 0, &strDisconnectNotifInfo, - hif_drv->usr_conn_req.u32UserConnectPvoid); + hif_drv->usr_conn_req.arg); } else { PRINT_ER("usr_conn_req.conn_result = NULL\n"); } diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 3afe4323072d..9595d488446b 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -208,7 +208,7 @@ struct user_conn_req { size_t ies_len; wilc_connect_result conn_result; bool ht_capable; - void *u32UserConnectPvoid; + void *arg; }; struct drv_handler { From c81f7de85bddae4301b6e801c8175f38d212eaef Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:28 +0900 Subject: [PATCH 149/843] staging: wilc1000: host_interface.h: move local define variables This patch move local define variables to local define position. - ACTION - PROBE_REQ - PROBE_RESP - ACTION_FRM_IDX - PROBE_REQ_IDX Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 9595d488446b..2dfd7f0d6b70 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -10,8 +10,12 @@ #define STATION_MODE 0x02 #define GO_MODE 0x03 #define CLIENT_MODE 0x04 +#define ACTION 0xD0 +#define PROBE_REQ 0x40 +#define PROBE_RESP 0x50 - +#define ACTION_FRM_IDX 0 +#define PROBE_REQ_IDX 1 #define MAX_NUM_STA 9 #define ACTIVE_SCAN_TIME 10 #define PASSIVE_SCAN_TIME 1200 @@ -249,14 +253,6 @@ struct reg_frame { u8 reg_id; }; - -#define ACTION 0xD0 -#define PROBE_REQ 0x40 -#define PROBE_RESP 0x50 -#define ACTION_FRM_IDX 0 -#define PROBE_REQ_IDX 1 - - enum p2p_listen_state { P2P_IDLE, P2P_LISTEN, From 5babeecb9f3e00ea4b2f15a6748b960fc38c189b Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:29 +0900 Subject: [PATCH 150/843] staging: wilc1000: rename u8LinkSpeed of struct rf_info This patch renames u8LinkSpeed of struct rf_info to link_speed to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 2 +- drivers/staging/wilc1000/host_interface.h | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 3b24a27704e4..539911528a37 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2138,7 +2138,7 @@ s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatis strWIDList[u32WidsCount].id = WID_LINKSPEED; strWIDList[u32WidsCount].type = WID_CHAR; strWIDList[u32WidsCount].size = sizeof(char); - strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->u8LinkSpeed; + strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->link_speed; u32WidsCount++; strWIDList[u32WidsCount].id = WID_RSSI; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 2dfd7f0d6b70..cef952a1ef03 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -53,7 +53,7 @@ #define NUM_CONCURRENT_IFC 2 struct rf_info { - u8 u8LinkSpeed; + u8 link_speed; s8 s8RSSI; u32 u32TxCount; u32 u32RxCount; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 3e9501727812..29b769f834fd 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1570,11 +1570,12 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, sinfo->rx_packets = strStatistics.u32RxCount; sinfo->tx_packets = strStatistics.u32TxCount + strStatistics.u32TxFailureCount; sinfo->tx_failed = strStatistics.u32TxFailureCount; - sinfo->txrate.legacy = strStatistics.u8LinkSpeed * 10; + sinfo->txrate.legacy = strStatistics.link_speed * 10; - if ((strStatistics.u8LinkSpeed > TCP_ACK_FILTER_LINK_SPEED_THRESH) && (strStatistics.u8LinkSpeed != DEFAULT_LINK_SPEED)) + if ((strStatistics.link_speed > TCP_ACK_FILTER_LINK_SPEED_THRESH) && + (strStatistics.link_speed != DEFAULT_LINK_SPEED)) Enable_TCP_ACK_Filter(true); - else if (strStatistics.u8LinkSpeed != DEFAULT_LINK_SPEED) + else if (strStatistics.link_speed != DEFAULT_LINK_SPEED) Enable_TCP_ACK_Filter(false); PRINT_D(CORECONFIG_DBG, "*** stats[%d][%d][%d][%d][%d]\n", sinfo->signal, sinfo->rx_packets, sinfo->tx_packets, From 00c8dfcf98d8390165ba47ede6a34fc50452fa47 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:30 +0900 Subject: [PATCH 151/843] staging: wilc1000: rename s8RSSI of struct rf_info This patch renames s8RSSI of struct rf_info to rssi to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 2 +- drivers/staging/wilc1000/host_interface.h | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 539911528a37..bee1f7f11d0c 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2144,7 +2144,7 @@ s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatis strWIDList[u32WidsCount].id = WID_RSSI; strWIDList[u32WidsCount].type = WID_CHAR; strWIDList[u32WidsCount].size = sizeof(char); - strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->s8RSSI; + strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->rssi; u32WidsCount++; strWIDList[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index cef952a1ef03..25f748fd5db0 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -54,7 +54,7 @@ struct rf_info { u8 link_speed; - s8 s8RSSI; + s8 rssi; u32 u32TxCount; u32 u32RxCount; u32 u32TxFailureCount; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 29b769f834fd..632daa802b79 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1566,7 +1566,7 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, BIT(NL80211_STA_INFO_TX_FAILED) | BIT(NL80211_STA_INFO_TX_BITRATE); - sinfo->signal = strStatistics.s8RSSI; + sinfo->signal = strStatistics.rssi; sinfo->rx_packets = strStatistics.u32RxCount; sinfo->tx_packets = strStatistics.u32TxCount + strStatistics.u32TxFailureCount; sinfo->tx_failed = strStatistics.u32TxFailureCount; From 7e84ff4ec3cb8101d29f89fed1188121ab47f498 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:31 +0900 Subject: [PATCH 152/843] staging: wilc1000: rename u32TxCount of struct rf_info This patch renames u32TxCount of struct rf_info to tx_cnt to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 2 +- drivers/staging/wilc1000/host_interface.h | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index bee1f7f11d0c..0d220a807cae 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2150,7 +2150,7 @@ s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatis strWIDList[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT; strWIDList[u32WidsCount].type = WID_INT; strWIDList[u32WidsCount].size = sizeof(u32); - strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->u32TxCount; + strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->tx_cnt; u32WidsCount++; strWIDList[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 25f748fd5db0..9d31c4e87347 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -55,7 +55,7 @@ struct rf_info { u8 link_speed; s8 rssi; - u32 u32TxCount; + u32 tx_cnt; u32 u32RxCount; u32 u32TxFailureCount; }; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 632daa802b79..73cec4bb89f2 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1568,7 +1568,7 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, sinfo->signal = strStatistics.rssi; sinfo->rx_packets = strStatistics.u32RxCount; - sinfo->tx_packets = strStatistics.u32TxCount + strStatistics.u32TxFailureCount; + sinfo->tx_packets = strStatistics.tx_cnt + strStatistics.u32TxFailureCount; sinfo->tx_failed = strStatistics.u32TxFailureCount; sinfo->txrate.legacy = strStatistics.link_speed * 10; From 9b99274a72ac81d4f251d4d137fcfdee13580fc3 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:32 +0900 Subject: [PATCH 153/843] staging: wilc1000: rename u32RxCount of struct rf_info This patch renames u32RxCount of struct rf_info to rx_cnt to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 2 +- drivers/staging/wilc1000/host_interface.h | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 0d220a807cae..4f64ee78d306 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2156,7 +2156,7 @@ s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatis strWIDList[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT; strWIDList[u32WidsCount].type = WID_INT; strWIDList[u32WidsCount].size = sizeof(u32); - strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->u32RxCount; + strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->rx_cnt; u32WidsCount++; strWIDList[u32WidsCount].id = WID_FAILED_COUNT; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 9d31c4e87347..d61b9b7089cb 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -56,7 +56,7 @@ struct rf_info { u8 link_speed; s8 rssi; u32 tx_cnt; - u32 u32RxCount; + u32 rx_cnt; u32 u32TxFailureCount; }; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 73cec4bb89f2..9b7cac3cdbdd 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1567,7 +1567,7 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, BIT(NL80211_STA_INFO_TX_BITRATE); sinfo->signal = strStatistics.rssi; - sinfo->rx_packets = strStatistics.u32RxCount; + sinfo->rx_packets = strStatistics.rx_cnt; sinfo->tx_packets = strStatistics.tx_cnt + strStatistics.u32TxFailureCount; sinfo->tx_failed = strStatistics.u32TxFailureCount; sinfo->txrate.legacy = strStatistics.link_speed * 10; From 5416037670fd29045eb59b78beea2c7da4da611c Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:33 +0900 Subject: [PATCH 154/843] staging: wilc1000: rename u32TxFailureCount of struct rf_info This patch renames u32TxFailureCount of struct rf_info to tx_fail_cnt to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 2 +- drivers/staging/wilc1000/host_interface.h | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 4f64ee78d306..590d8a423a2e 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2162,7 +2162,7 @@ s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatis strWIDList[u32WidsCount].id = WID_FAILED_COUNT; strWIDList[u32WidsCount].type = WID_INT; strWIDList[u32WidsCount].size = sizeof(u32); - strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->u32TxFailureCount; + strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->tx_fail_cnt; u32WidsCount++; result = send_config_pkt(GET_CFG, strWIDList, u32WidsCount, diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index d61b9b7089cb..59b1949a7ace 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -57,7 +57,7 @@ struct rf_info { s8 rssi; u32 tx_cnt; u32 rx_cnt; - u32 u32TxFailureCount; + u32 tx_fail_cnt; }; enum host_if_state { diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 9b7cac3cdbdd..3060b8d3e149 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1568,8 +1568,8 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, sinfo->signal = strStatistics.rssi; sinfo->rx_packets = strStatistics.rx_cnt; - sinfo->tx_packets = strStatistics.tx_cnt + strStatistics.u32TxFailureCount; - sinfo->tx_failed = strStatistics.u32TxFailureCount; + sinfo->tx_packets = strStatistics.tx_cnt + strStatistics.tx_fail_cnt; + sinfo->tx_failed = strStatistics.tx_fail_cnt; sinfo->txrate.legacy = strStatistics.link_speed * 10; if ((strStatistics.link_speed > TCP_ACK_FILTER_LINK_SPEED_THRESH) && From 5cd8f7ae74f5e13522ff8ea2f4079dba554a9423 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:34 +0900 Subject: [PATCH 155/843] staging: wilc1000: rename WPARxGtk of enum KEY_TYPE This patch renames WPARxGtk of enum KEY_TYPE to WPA_RX_GTK to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 590d8a423a2e..ead99ab111ad 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1795,7 +1795,7 @@ static int Handle_Key(struct host_if_drv *hif_drv, up(&hif_drv->sem_test_key_block); break; - case WPARxGtk: + case WPA_RX_GTK: if (pstrHostIFkeyAttr->action & ADDKEY_AP) { pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); if (!pu8keybuf) { @@ -3285,7 +3285,7 @@ s32 host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *pu8RxGtk, } msg.id = HOST_IF_MSG_KEY; - msg.body.key_info.type = WPARxGtk; + msg.body.key_info.type = WPA_RX_GTK; msg.drv = hif_drv; if (mode == AP_MODE) { diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 59b1949a7ace..b3e74d1ff897 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -163,7 +163,7 @@ enum conn_event { enum KEY_TYPE { WEP, - WPARxGtk, + WPA_RX_GTK, WPAPtk, PMKSA, }; From 2141fe391ec6f21e52e3f37d642cfc157440cf85 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:35 +0900 Subject: [PATCH 156/843] staging: wilc1000: rename WPAPtk of enum KEY_TYPE This patch renames WPAPtk of enum KEY_TYPE to WPA_PTK to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index ead99ab111ad..3e7c6e411982 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1869,7 +1869,7 @@ _WPARxGtk_end_case_: break; - case WPAPtk: + case WPA_PTK: if (pstrHostIFkeyAttr->action & ADDKEY_AP) { pu8keybuf = kmalloc(PTK_KEY_MSG_LEN + 1, GFP_KERNEL); if (!pu8keybuf) { @@ -3216,7 +3216,7 @@ s32 host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *pu8Ptk, memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_KEY; - msg.body.key_info.type = WPAPtk; + msg.body.key_info.type = WPA_PTK; if (mode == AP_MODE) { msg.body.key_info.action = ADDKEY_AP; msg.body.key_info.attr.wpa.index = u8Idx; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index b3e74d1ff897..f94bba69f15b 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -164,7 +164,7 @@ enum conn_event { enum KEY_TYPE { WEP, WPA_RX_GTK, - WPAPtk, + WPA_PTK, PMKSA, }; From f79756eeb0c3af0b6672cae4912ae695f7c0c9d3 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:36 +0900 Subject: [PATCH 157/843] staging: wilc1000: rename u32RcvdChCount of struct user_scan_req This patch renames u32RcvdChCount of struct user_scan_req to rcvd_ch_cnt to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 14 +++++++------- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 3e7c6e411982..f465233fa609 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -843,7 +843,7 @@ static s32 Handle_Scan(struct host_if_drv *hif_drv, PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); - hif_drv->usr_scan_req.u32RcvdChCount = 0; + hif_drv->usr_scan_req.rcvd_ch_cnt = 0; strWIDList[u32WidsCount].id = (u16)WID_SSID_PROBE_REQ; strWIDList[u32WidsCount].type = WID_STR; @@ -1414,7 +1414,7 @@ static s32 Handle_RcvdNtwrkInfo(struct host_if_drv *hif_drv, goto done; } - for (i = 0; i < hif_drv->usr_scan_req.u32RcvdChCount; i++) { + for (i = 0; i < hif_drv->usr_scan_req.rcvd_ch_cnt; i++) { if ((hif_drv->usr_scan_req.net_info[i].au8bssid) && (pstrNetworkInfo->au8bssid)) { if (memcmp(hif_drv->usr_scan_req.net_info[i].au8bssid, @@ -1434,15 +1434,15 @@ static s32 Handle_RcvdNtwrkInfo(struct host_if_drv *hif_drv, if (bNewNtwrkFound) { PRINT_D(HOSTINF_DBG, "New network found\n"); - if (hif_drv->usr_scan_req.u32RcvdChCount < MAX_NUM_SCANNED_NETWORKS) { - hif_drv->usr_scan_req.net_info[hif_drv->usr_scan_req.u32RcvdChCount].s8rssi = pstrNetworkInfo->s8rssi; + if (hif_drv->usr_scan_req.rcvd_ch_cnt < MAX_NUM_SCANNED_NETWORKS) { + hif_drv->usr_scan_req.net_info[hif_drv->usr_scan_req.rcvd_ch_cnt].s8rssi = pstrNetworkInfo->s8rssi; - if (hif_drv->usr_scan_req.net_info[hif_drv->usr_scan_req.u32RcvdChCount].au8bssid && + if (hif_drv->usr_scan_req.net_info[hif_drv->usr_scan_req.rcvd_ch_cnt].au8bssid && pstrNetworkInfo->au8bssid) { - memcpy(hif_drv->usr_scan_req.net_info[hif_drv->usr_scan_req.u32RcvdChCount].au8bssid, + memcpy(hif_drv->usr_scan_req.net_info[hif_drv->usr_scan_req.rcvd_ch_cnt].au8bssid, pstrNetworkInfo->au8bssid, 6); - hif_drv->usr_scan_req.u32RcvdChCount++; + hif_drv->usr_scan_req.rcvd_ch_cnt++; pstrNetworkInfo->bNewNetwork = true; pJoinParams = host_int_ParseJoinBssParam(pstrNetworkInfo); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index f94bba69f15b..f824866c05a0 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -198,7 +198,7 @@ struct hidden_network { struct user_scan_req { wilc_scan_result scan_result; void *arg; - u32 u32RcvdChCount; + u32 rcvd_ch_cnt; struct found_net_info net_info[MAX_NUM_SCANNED_NETWORKS]; }; From 7d06972827829c6b7166314681548a57bb8e3586 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:37 +0900 Subject: [PATCH 158/843] staging: wilc1000: rename tenuAuth_type of struct user_conn_req This patch renames tenuAuth_type of struct user_conn_req to auth_type to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 9 +++++---- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index f465233fa609..6c490916b2d8 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1028,7 +1028,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv, } hif_drv->usr_conn_req.u8security = pstrHostIFconnectAttr->security; - hif_drv->usr_conn_req.tenuAuth_type = pstrHostIFconnectAttr->auth_type; + hif_drv->usr_conn_req.auth_type = pstrHostIFconnectAttr->auth_type; hif_drv->usr_conn_req.conn_result = pstrHostIFconnectAttr->result; hif_drv->usr_conn_req.arg = pstrHostIFconnectAttr->arg; @@ -1078,13 +1078,14 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv, strWIDList[u32WidsCount].id = (u16)WID_AUTH_TYPE; strWIDList[u32WidsCount].type = WID_CHAR; strWIDList[u32WidsCount].size = sizeof(char); - strWIDList[u32WidsCount].val = (s8 *)(&hif_drv->usr_conn_req.tenuAuth_type); + strWIDList[u32WidsCount].val = (s8 *)&hif_drv->usr_conn_req.auth_type; u32WidsCount++; if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) - auth_type = (u8)hif_drv->usr_conn_req.tenuAuth_type; + auth_type = (u8)hif_drv->usr_conn_req.auth_type; - PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", hif_drv->usr_conn_req.tenuAuth_type); + PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", + hif_drv->usr_conn_req.auth_type); PRINT_D(HOSTINF_DBG, "Connecting to network of SSID %s on channel %d\n", hif_drv->usr_conn_req.pu8ssid, pstrHostIFconnectAttr->ch); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index f824866c05a0..c338028b5171 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -206,7 +206,7 @@ struct user_conn_req { u8 *pu8bssid; u8 *pu8ssid; u8 u8security; - enum AUTHTYPE tenuAuth_type; + enum AUTHTYPE auth_type; size_t ssid_len; u8 *ies; size_t ies_len; From 9d764e38d31389d7362a94361cccbc347878d1d3 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:38 +0900 Subject: [PATCH 159/843] staging: wilc1000: rename u32ListenSessionID of struct remain_ch This patch renames u32ListenSessionID of struct remain_ch to id to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 10 +++++----- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 6c490916b2d8..294f90c24507 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2489,7 +2489,7 @@ static int Handle_RemainOnChan(struct host_if_drv *hif_drv, hif_drv->remain_on_ch.expired = pstrHostIfRemainOnChan->expired; hif_drv->remain_on_ch.ready = pstrHostIfRemainOnChan->ready; hif_drv->remain_on_ch.ch = pstrHostIfRemainOnChan->ch; - hif_drv->remain_on_ch.u32ListenSessionID = pstrHostIfRemainOnChan->u32ListenSessionID; + hif_drv->remain_on_ch.id = pstrHostIfRemainOnChan->id; } else { pstrHostIfRemainOnChan->ch = hif_drv->remain_on_ch.ch; } @@ -2617,7 +2617,7 @@ static u32 Handle_ListenStateExpired(struct host_if_drv *hif_drv, if (hif_drv->remain_on_ch.expired) { hif_drv->remain_on_ch.expired(hif_drv->remain_on_ch.arg, - pstrHostIfRemainOnChan->u32ListenSessionID); + pstrHostIfRemainOnChan->id); } P2P_LISTEN_STATE = 0; } else { @@ -2640,7 +2640,7 @@ static void ListenTimerCB(unsigned long arg) memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; msg.drv = hif_drv; - msg.body.remain_on_ch.u32ListenSessionID = hif_drv->remain_on_ch.u32ListenSessionID; + msg.body.remain_on_ch.id = hif_drv->remain_on_ch.id; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) @@ -4377,7 +4377,7 @@ s32 host_int_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID, msg.body.remain_on_ch.ready = RemainOnChanReady; msg.body.remain_on_ch.arg = pvUserArg; msg.body.remain_on_ch.u32duration = u32duration; - msg.body.remain_on_ch.u32ListenSessionID = u32SessionID; + msg.body.remain_on_ch.id = u32SessionID; msg.drv = hif_drv; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -4402,7 +4402,7 @@ s32 host_int_ListenStateExpired(struct host_if_drv *hif_drv, u32 u32SessionID) memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; msg.drv = hif_drv; - msg.body.remain_on_ch.u32ListenSessionID = u32SessionID; + msg.body.remain_on_ch.id = u32SessionID; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index c338028b5171..8450e22acd7e 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -244,7 +244,7 @@ struct remain_ch { wilc_remain_on_chan_expired expired; wilc_remain_on_chan_ready ready; void *arg; - u32 u32ListenSessionID; + u32 id; }; struct reg_frame { From 1229b1ab414c9bb6eebddbf457f324211bf79a79 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:39 +0900 Subject: [PATCH 160/843] staging: wilc1000: rename u64P2p_MgmtTimeout of struct host_if_drv This patch renames u64P2p_MgmtTimeout of struct host_if_drv to p2p_timeout to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 2 +- drivers/staging/wilc1000/host_interface.h | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 294f90c24507..00f271780b83 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4158,7 +4158,7 @@ s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) hif_drv->cfg_values.passive_scan_time = PASSIVE_SCAN_TIME; hif_drv->cfg_values.curr_tx_rate = AUTORATE; - hif_drv->u64P2p_MgmtTimeout = 0; + hif_drv->p2p_timeout = 0; PRINT_INFO(HOSTINF_DBG, "Initialization values, Site survey value: %d\n Scan source: %d\n Active scan time: %d\n Passive scan time: %d\nCurrent tx Rate = %d\n", hif_drv->cfg_values.site_survey_enabled, diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 8450e22acd7e..c9a4ce8dfc7e 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -264,7 +264,7 @@ struct host_if_drv { struct user_conn_req usr_conn_req; struct remain_ch remain_on_ch; u8 remain_on_ch_pending; - u64 u64P2p_MgmtTimeout; + u64 p2p_timeout; u8 u8P2PConnect; enum host_if_state hif_state; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 3060b8d3e149..116c37d2cda7 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1050,7 +1050,7 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co u8P2Plocalrandom = 0x01; u8P2Precvrandom = 0x00; bWilc_ie = false; - pstrWFIDrv->u64P2p_MgmtTimeout = 0; + pstrWFIDrv->p2p_timeout = 0; s32Error = host_int_disconnect(priv->hWILCWFIDrv, reason_code); if (s32Error != 0) { @@ -1958,7 +1958,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size) if (ieee80211_is_action(buff[FRAME_TYPE_ID])) { PRINT_D(GENERIC_DBG, "Rx Action Frame Type: %x %x\n", buff[ACTION_SUBTYPE_ID], buff[P2P_PUB_ACTION_SUBTYPE]); - if (priv->bCfgScanning && time_after_eq(jiffies, (unsigned long)pstrWFIDrv->u64P2p_MgmtTimeout)) { + if (priv->bCfgScanning && time_after_eq(jiffies, (unsigned long)pstrWFIDrv->p2p_timeout)) { PRINT_D(GENERIC_DBG, "Receiving action frames from wrong channels\n"); return; } @@ -2331,10 +2331,10 @@ static int mgmt_tx(struct wiphy *wiphy, } PRINT_D(GENERIC_DBG, "TX: ACTION FRAME Type:%x : Chan:%d\n", buf[ACTION_SUBTYPE_ID], chan->hw_value); - pstrWFIDrv->u64P2p_MgmtTimeout = (jiffies + msecs_to_jiffies(wait)); - - PRINT_D(GENERIC_DBG, "Current Jiffies: %lu Timeout:%llu\n", jiffies, pstrWFIDrv->u64P2p_MgmtTimeout); + pstrWFIDrv->p2p_timeout = (jiffies + msecs_to_jiffies(wait)); + PRINT_D(GENERIC_DBG, "Current Jiffies: %lu Timeout:%llu\n", + jiffies, pstrWFIDrv->p2p_timeout); } wilc_wlan_txq_add_mgmt_pkt(mgmt_tx, mgmt_tx->buff, @@ -2358,7 +2358,7 @@ static int mgmt_tx_cancel_wait(struct wiphy *wiphy, PRINT_D(GENERIC_DBG, "Tx Cancel wait :%lu\n", jiffies); - pstrWFIDrv->u64P2p_MgmtTimeout = jiffies; + pstrWFIDrv->p2p_timeout = jiffies; if (!priv->bInP2PlistenState) { cfg80211_remain_on_channel_expired(priv->wdev, From ab16ec0b813f9f52780e6e43549e7ae171e0b3a9 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:40 +0900 Subject: [PATCH 161/843] staging: wilc1000: rename u8P2PConnect of struct host_if_drv This patch renames u8P2PConnect of struct host_if_drv to p2p_connect to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.h | 2 +- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index c9a4ce8dfc7e..60dcc364e756 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -265,7 +265,7 @@ struct host_if_drv { struct remain_ch remain_on_ch; u8 remain_on_ch_pending; u64 p2p_timeout; - u8 u8P2PConnect; + u8 p2p_connect; enum host_if_state hif_state; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 116c37d2cda7..4828deb24e68 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -564,7 +564,7 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, eth_zero_addr(u8ConnectedSSID); /*Invalidate u8WLANChannel value on wlan0 disconnect*/ - if (!pstrWFIDrv->u8P2PConnect) + if (!pstrWFIDrv->p2p_connect) u8WLANChannel = INVALID_CHANNEL; PRINT_ER("Unspecified failure: Connection status %d : MAC status = %d\n", u16ConnectStatus, u8MacStatus); @@ -623,7 +623,7 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, eth_zero_addr(u8ConnectedSSID); /*Invalidate u8WLANChannel value on wlan0 disconnect*/ - if (!pstrWFIDrv->u8P2PConnect) + if (!pstrWFIDrv->p2p_connect) u8WLANChannel = INVALID_CHANNEL; /*Incase "P2P CLIENT Connected" send deauthentication reason by 3 to force the WPA_SUPPLICANT to directly change * virtual interface to station*/ @@ -804,9 +804,10 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, PRINT_D(CFG80211_DBG, "Connecting to SSID [%s] on netdev [%p] host if [%p]\n", sme->ssid, dev, priv->hWILCWFIDrv); if (!(strncmp(sme->ssid, "DIRECT-", 7))) { PRINT_D(CFG80211_DBG, "Connected to Direct network,OBSS disabled\n"); - pstrWFIDrv->u8P2PConnect = 1; - } else - pstrWFIDrv->u8P2PConnect = 0; + pstrWFIDrv->p2p_connect = 1; + } else { + pstrWFIDrv->p2p_connect = 0; + } PRINT_INFO(CFG80211_DBG, "Required SSID = %s\n , AuthType = %d\n", sme->ssid, sme->auth_type); for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { @@ -997,9 +998,8 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, curr_channel = pstrNetworkInfo->u8channel; - if (!pstrWFIDrv->u8P2PConnect) { + if (!pstrWFIDrv->p2p_connect) u8WLANChannel = pstrNetworkInfo->u8channel; - } linux_wlan_set_bssid(dev, pstrNetworkInfo->au8bssid); @@ -1041,7 +1041,7 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co /*Invalidate u8WLANChannel value on wlan0 disconnect*/ pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv; - if (!pstrWFIDrv->u8P2PConnect) + if (!pstrWFIDrv->p2p_connect) u8WLANChannel = INVALID_CHANNEL; linux_wlan_set_bssid(priv->dev, NullBssid); From 2353c388de7719f8b566fc68f8499018cb5b4a56 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:41 +0900 Subject: [PATCH 162/843] staging: wilc1000: rename au8BSSID of struct add_sta_param This patch renames au8BSSID of struct add_sta_param to bssid to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 2 +- drivers/staging/wilc1000/host_interface.h | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 00f271780b83..2cf3ed5bd1cc 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2308,7 +2308,7 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, pu8CurrByte = pu8Buffer; PRINT_D(HOSTINF_DBG, "Packing STA params\n"); - memcpy(pu8CurrByte, pstrStationParam->au8BSSID, ETH_ALEN); + memcpy(pu8CurrByte, pstrStationParam->bssid, ETH_ALEN); pu8CurrByte += ETH_ALEN; *pu8CurrByte++ = pstrStationParam->u16AssocID & 0xFF; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 60dcc364e756..58e4f920504a 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -288,7 +288,7 @@ struct host_if_drv { }; struct add_sta_param { - u8 au8BSSID[ETH_ALEN]; + u8 bssid[ETH_ALEN]; u16 u16AssocID; u8 u8NumRates; const u8 *pu8Rates; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 4828deb24e68..2ec85f037a7a 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -2995,7 +2995,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, nic = netdev_priv(dev); if (nic->iftype == AP_MODE || nic->iftype == GO_MODE) { - memcpy(strStaParams.au8BSSID, mac, ETH_ALEN); + memcpy(strStaParams.bssid, mac, ETH_ALEN); memcpy(priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid], mac, ETH_ALEN); strStaParams.u16AssocID = params->aid; strStaParams.u8NumRates = params->supported_rates_len; @@ -3109,13 +3109,15 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, nic = netdev_priv(dev); if (nic->iftype == AP_MODE || nic->iftype == GO_MODE) { - memcpy(strStaParams.au8BSSID, mac, ETH_ALEN); + memcpy(strStaParams.bssid, mac, ETH_ALEN); strStaParams.u16AssocID = params->aid; strStaParams.u8NumRates = params->supported_rates_len; strStaParams.pu8Rates = params->supported_rates; - PRINT_D(HOSTAPD_DBG, "BSSID = %x%x%x%x%x%x\n", strStaParams.au8BSSID[0], strStaParams.au8BSSID[1], strStaParams.au8BSSID[2], strStaParams.au8BSSID[3], strStaParams.au8BSSID[4], - strStaParams.au8BSSID[5]); + PRINT_D(HOSTAPD_DBG, "BSSID = %x%x%x%x%x%x\n", + strStaParams.bssid[0], strStaParams.bssid[1], + strStaParams.bssid[2], strStaParams.bssid[3], + strStaParams.bssid[4], strStaParams.bssid[5]); PRINT_D(HOSTAPD_DBG, "ASSOC ID = %d\n", strStaParams.u16AssocID); PRINT_D(HOSTAPD_DBG, "Number of supported rates = %d\n", strStaParams.u8NumRates); From 4101eb8a0cd4ec53ead18d49314271e83f18bcab Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:42 +0900 Subject: [PATCH 163/843] staging: wilc1000: rename u16AssocID of struct add_sta_param This patch renames u16AssocID of struct add_sta_param to aid to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 2cf3ed5bd1cc..512000e986a8 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2311,8 +2311,8 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, memcpy(pu8CurrByte, pstrStationParam->bssid, ETH_ALEN); pu8CurrByte += ETH_ALEN; - *pu8CurrByte++ = pstrStationParam->u16AssocID & 0xFF; - *pu8CurrByte++ = (pstrStationParam->u16AssocID >> 8) & 0xFF; + *pu8CurrByte++ = pstrStationParam->aid & 0xFF; + *pu8CurrByte++ = (pstrStationParam->aid >> 8) & 0xFF; *pu8CurrByte++ = pstrStationParam->u8NumRates; if (pstrStationParam->u8NumRates > 0) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 58e4f920504a..7d8a16630763 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -289,7 +289,7 @@ struct host_if_drv { struct add_sta_param { u8 bssid[ETH_ALEN]; - u16 u16AssocID; + u16 aid; u8 u8NumRates; const u8 *pu8Rates; bool bIsHTSupported; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 2ec85f037a7a..00fa41133f03 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -2997,7 +2997,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, if (nic->iftype == AP_MODE || nic->iftype == GO_MODE) { memcpy(strStaParams.bssid, mac, ETH_ALEN); memcpy(priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid], mac, ETH_ALEN); - strStaParams.u16AssocID = params->aid; + strStaParams.aid = params->aid; strStaParams.u8NumRates = params->supported_rates_len; strStaParams.pu8Rates = params->supported_rates; @@ -3005,7 +3005,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, PRINT_D(CFG80211_DBG, "BSSID = %x%x%x%x%x%x\n", priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][0], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][1], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][2], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][3], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][4], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][5]); - PRINT_D(HOSTAPD_DBG, "ASSOC ID = %d\n", strStaParams.u16AssocID); + PRINT_D(HOSTAPD_DBG, "ASSOC ID = %d\n", strStaParams.aid); PRINT_D(HOSTAPD_DBG, "Number of supported rates = %d\n", strStaParams.u8NumRates); if (params->ht_capa == NULL) { @@ -3110,7 +3110,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, if (nic->iftype == AP_MODE || nic->iftype == GO_MODE) { memcpy(strStaParams.bssid, mac, ETH_ALEN); - strStaParams.u16AssocID = params->aid; + strStaParams.aid = params->aid; strStaParams.u8NumRates = params->supported_rates_len; strStaParams.pu8Rates = params->supported_rates; @@ -3118,7 +3118,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.bssid[0], strStaParams.bssid[1], strStaParams.bssid[2], strStaParams.bssid[3], strStaParams.bssid[4], strStaParams.bssid[5]); - PRINT_D(HOSTAPD_DBG, "ASSOC ID = %d\n", strStaParams.u16AssocID); + PRINT_D(HOSTAPD_DBG, "ASSOC ID = %d\n", strStaParams.aid); PRINT_D(HOSTAPD_DBG, "Number of supported rates = %d\n", strStaParams.u8NumRates); if (params->ht_capa == NULL) { From e734223cd8819bb07b671afa5a25e0ca6abaa3a9 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:43 +0900 Subject: [PATCH 164/843] staging: wilc1000: rename u8NumRates of struct add_sta_param This patch renames u8NumRates of struct add_sta_param to rates_len to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 27 ++++++++++--------- drivers/staging/wilc1000/host_interface.h | 2 +- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 10 ++++--- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 512000e986a8..9b76acd6f011 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2314,10 +2314,11 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, *pu8CurrByte++ = pstrStationParam->aid & 0xFF; *pu8CurrByte++ = (pstrStationParam->aid >> 8) & 0xFF; - *pu8CurrByte++ = pstrStationParam->u8NumRates; - if (pstrStationParam->u8NumRates > 0) - memcpy(pu8CurrByte, pstrStationParam->pu8Rates, pstrStationParam->u8NumRates); - pu8CurrByte += pstrStationParam->u8NumRates; + *pu8CurrByte++ = pstrStationParam->rates_len; + if (pstrStationParam->rates_len > 0) + memcpy(pu8CurrByte, pstrStationParam->pu8Rates, + pstrStationParam->rates_len); + pu8CurrByte += pstrStationParam->rates_len; *pu8CurrByte++ = pstrStationParam->bIsHTSupported; *pu8CurrByte++ = pstrStationParam->u16HTCapInfo & 0xFF; @@ -2356,7 +2357,7 @@ static void Handle_AddStation(struct host_if_drv *hif_drv, PRINT_D(HOSTINF_DBG, "Handling add station\n"); wid.id = (u16)WID_ADD_STA; wid.type = WID_BIN; - wid.size = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; + wid.size = WILC_ADD_STA_LENGTH + pstrStationParam->rates_len; wid.val = kmalloc(wid.size, GFP_KERNEL); if (!wid.val) @@ -2457,7 +2458,7 @@ static void Handle_EditStation(struct host_if_drv *hif_drv, wid.id = (u16)WID_EDIT_STA; wid.type = WID_BIN; - wid.size = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; + wid.size = WILC_ADD_STA_LENGTH + pstrStationParam->rates_len; PRINT_D(HOSTINF_DBG, "Handling edit station\n"); wid.val = kmalloc(wid.size, GFP_KERNEL); @@ -4545,13 +4546,14 @@ s32 host_int_add_station(struct host_if_drv *hif_drv, msg.drv = hif_drv; memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param)); - if (pstrAddStationMsg->u8NumRates > 0) { - u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); + if (pstrAddStationMsg->rates_len > 0) { + u8 *rates = kmalloc(pstrAddStationMsg->rates_len, GFP_KERNEL); if (!rates) return -ENOMEM; - memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); + memcpy(rates, pstrStaParams->pu8Rates, + pstrAddStationMsg->rates_len); pstrAddStationMsg->pu8Rates = rates; } @@ -4661,13 +4663,14 @@ s32 host_int_edit_station(struct host_if_drv *hif_drv, msg.drv = hif_drv; memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param)); - if (pstrAddStationMsg->u8NumRates > 0) { - u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); + if (pstrAddStationMsg->rates_len > 0) { + u8 *rates = kmalloc(pstrAddStationMsg->rates_len, GFP_KERNEL); if (!rates) return -ENOMEM; - memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); + memcpy(rates, pstrStaParams->pu8Rates, + pstrAddStationMsg->rates_len); pstrAddStationMsg->pu8Rates = rates; } diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 7d8a16630763..b13c76ed7fe1 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -290,7 +290,7 @@ struct host_if_drv { struct add_sta_param { u8 bssid[ETH_ALEN]; u16 aid; - u8 u8NumRates; + u8 rates_len; const u8 *pu8Rates; bool bIsHTSupported; u16 u16HTCapInfo; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 00fa41133f03..715499aeebe6 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -2998,7 +2998,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, memcpy(strStaParams.bssid, mac, ETH_ALEN); memcpy(priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid], mac, ETH_ALEN); strStaParams.aid = params->aid; - strStaParams.u8NumRates = params->supported_rates_len; + strStaParams.rates_len = params->supported_rates_len; strStaParams.pu8Rates = params->supported_rates; PRINT_D(CFG80211_DBG, "Adding station parameters %d\n", params->aid); @@ -3006,7 +3006,8 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, PRINT_D(CFG80211_DBG, "BSSID = %x%x%x%x%x%x\n", priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][0], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][1], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][2], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][3], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][4], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][5]); PRINT_D(HOSTAPD_DBG, "ASSOC ID = %d\n", strStaParams.aid); - PRINT_D(HOSTAPD_DBG, "Number of supported rates = %d\n", strStaParams.u8NumRates); + PRINT_D(HOSTAPD_DBG, "Number of supported rates = %d\n", + strStaParams.rates_len); if (params->ht_capa == NULL) { strStaParams.bIsHTSupported = false; @@ -3111,7 +3112,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, if (nic->iftype == AP_MODE || nic->iftype == GO_MODE) { memcpy(strStaParams.bssid, mac, ETH_ALEN); strStaParams.aid = params->aid; - strStaParams.u8NumRates = params->supported_rates_len; + strStaParams.rates_len = params->supported_rates_len; strStaParams.pu8Rates = params->supported_rates; PRINT_D(HOSTAPD_DBG, "BSSID = %x%x%x%x%x%x\n", @@ -3119,7 +3120,8 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.bssid[2], strStaParams.bssid[3], strStaParams.bssid[4], strStaParams.bssid[5]); PRINT_D(HOSTAPD_DBG, "ASSOC ID = %d\n", strStaParams.aid); - PRINT_D(HOSTAPD_DBG, "Number of supported rates = %d\n", strStaParams.u8NumRates); + PRINT_D(HOSTAPD_DBG, "Number of supported rates = %d\n", + strStaParams.rates_len); if (params->ht_capa == NULL) { strStaParams.bIsHTSupported = false; From a622e01645f650f217bbb0248b741fa83b3e5027 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:44 +0900 Subject: [PATCH 165/843] staging: wilc1000: rename pu8Rates of struct add_sta_param This patch renames pu8Rates of struct add_sta_param to rates to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 14 +++++++------- drivers/staging/wilc1000/host_interface.h | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 9b76acd6f011..910462af0f38 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2316,7 +2316,7 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, *pu8CurrByte++ = pstrStationParam->rates_len; if (pstrStationParam->rates_len > 0) - memcpy(pu8CurrByte, pstrStationParam->pu8Rates, + memcpy(pu8CurrByte, pstrStationParam->rates, pstrStationParam->rates_len); pu8CurrByte += pstrStationParam->rates_len; @@ -2372,7 +2372,7 @@ static void Handle_AddStation(struct host_if_drv *hif_drv, PRINT_ER("Failed to send add station config packet\n"); ERRORHANDLER: - kfree(pstrStationParam->pu8Rates); + kfree(pstrStationParam->rates); kfree(wid.val); } @@ -2474,7 +2474,7 @@ static void Handle_EditStation(struct host_if_drv *hif_drv, PRINT_ER("Failed to send edit station config packet\n"); ERRORHANDLER: - kfree(pstrStationParam->pu8Rates); + kfree(pstrStationParam->rates); kfree(wid.val); } @@ -4552,9 +4552,9 @@ s32 host_int_add_station(struct host_if_drv *hif_drv, if (!rates) return -ENOMEM; - memcpy(rates, pstrStaParams->pu8Rates, + memcpy(rates, pstrStaParams->rates, pstrAddStationMsg->rates_len); - pstrAddStationMsg->pu8Rates = rates; + pstrAddStationMsg->rates = rates; } result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -4669,9 +4669,9 @@ s32 host_int_edit_station(struct host_if_drv *hif_drv, if (!rates) return -ENOMEM; - memcpy(rates, pstrStaParams->pu8Rates, + memcpy(rates, pstrStaParams->rates, pstrAddStationMsg->rates_len); - pstrAddStationMsg->pu8Rates = rates; + pstrAddStationMsg->rates = rates; } result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index b13c76ed7fe1..5fba44f8f335 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -291,7 +291,7 @@ struct add_sta_param { u8 bssid[ETH_ALEN]; u16 aid; u8 rates_len; - const u8 *pu8Rates; + const u8 *rates; bool bIsHTSupported; u16 u16HTCapInfo; u8 u8AmpduParams; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 715499aeebe6..019364a794a7 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -2999,7 +2999,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, memcpy(priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid], mac, ETH_ALEN); strStaParams.aid = params->aid; strStaParams.rates_len = params->supported_rates_len; - strStaParams.pu8Rates = params->supported_rates; + strStaParams.rates = params->supported_rates; PRINT_D(CFG80211_DBG, "Adding station parameters %d\n", params->aid); @@ -3113,7 +3113,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, memcpy(strStaParams.bssid, mac, ETH_ALEN); strStaParams.aid = params->aid; strStaParams.rates_len = params->supported_rates_len; - strStaParams.pu8Rates = params->supported_rates; + strStaParams.rates = params->supported_rates; PRINT_D(HOSTAPD_DBG, "BSSID = %x%x%x%x%x%x\n", strStaParams.bssid[0], strStaParams.bssid[1], From 2252012081cf155e31c82bd901032b17f6705c90 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:45 +0900 Subject: [PATCH 166/843] staging: wilc1000: rename bIsHTSupported of struct add_sta_param This patch renames bIsHTSupported of struct add_sta_param to ht_supported to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 2 +- drivers/staging/wilc1000/host_interface.h | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 14 ++++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 910462af0f38..fbfaf12b3731 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2320,7 +2320,7 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, pstrStationParam->rates_len); pu8CurrByte += pstrStationParam->rates_len; - *pu8CurrByte++ = pstrStationParam->bIsHTSupported; + *pu8CurrByte++ = pstrStationParam->ht_supported; *pu8CurrByte++ = pstrStationParam->u16HTCapInfo & 0xFF; *pu8CurrByte++ = (pstrStationParam->u16HTCapInfo >> 8) & 0xFF; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 5fba44f8f335..2d9d8086bcd6 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -292,7 +292,7 @@ struct add_sta_param { u16 aid; u8 rates_len; const u8 *rates; - bool bIsHTSupported; + bool ht_supported; u16 u16HTCapInfo; u8 u8AmpduParams; u8 au8SuppMCsSet[16]; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 019364a794a7..d5b5158b5f7e 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -3010,9 +3010,9 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.rates_len); if (params->ht_capa == NULL) { - strStaParams.bIsHTSupported = false; + strStaParams.ht_supported = false; } else { - strStaParams.bIsHTSupported = true; + strStaParams.ht_supported = true; strStaParams.u16HTCapInfo = params->ht_capa->cap_info; strStaParams.u8AmpduParams = params->ht_capa->ampdu_params_info; memcpy(strStaParams.au8SuppMCsSet, ¶ms->ht_capa->mcs, WILC_SUPP_MCS_SET_SIZE); @@ -3024,7 +3024,8 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.u16FlagsMask = params->sta_flags_mask; strStaParams.u16FlagsSet = params->sta_flags_set; - PRINT_D(HOSTAPD_DBG, "IS HT supported = %d\n", strStaParams.bIsHTSupported); + PRINT_D(HOSTAPD_DBG, "IS HT supported = %d\n", + strStaParams.ht_supported); PRINT_D(HOSTAPD_DBG, "Capability Info = %d\n", strStaParams.u16HTCapInfo); PRINT_D(HOSTAPD_DBG, "AMPDU Params = %d\n", strStaParams.u8AmpduParams); PRINT_D(HOSTAPD_DBG, "HT Extended params = %d\n", strStaParams.u16HTExtParams); @@ -3124,9 +3125,9 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.rates_len); if (params->ht_capa == NULL) { - strStaParams.bIsHTSupported = false; + strStaParams.ht_supported = false; } else { - strStaParams.bIsHTSupported = true; + strStaParams.ht_supported = true; strStaParams.u16HTCapInfo = params->ht_capa->cap_info; strStaParams.u8AmpduParams = params->ht_capa->ampdu_params_info; memcpy(strStaParams.au8SuppMCsSet, ¶ms->ht_capa->mcs, WILC_SUPP_MCS_SET_SIZE); @@ -3139,7 +3140,8 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.u16FlagsMask = params->sta_flags_mask; strStaParams.u16FlagsSet = params->sta_flags_set; - PRINT_D(HOSTAPD_DBG, "IS HT supported = %d\n", strStaParams.bIsHTSupported); + PRINT_D(HOSTAPD_DBG, "IS HT supported = %d\n", + strStaParams.ht_supported); PRINT_D(HOSTAPD_DBG, "Capability Info = %d\n", strStaParams.u16HTCapInfo); PRINT_D(HOSTAPD_DBG, "AMPDU Params = %d\n", strStaParams.u8AmpduParams); PRINT_D(HOSTAPD_DBG, "HT Extended params = %d\n", strStaParams.u16HTExtParams); From 0d073f69b1823e7f0f8252bcbfffe25fffdb6723 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:46 +0900 Subject: [PATCH 167/843] staging: wilc1000: rename u16HTCapInfo of struct add_sta_param This patch renames u16HTCapInfo of struct add_sta_param to ht_capa_info to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 10 ++++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index fbfaf12b3731..e6388ffae6d2 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2321,8 +2321,8 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, pu8CurrByte += pstrStationParam->rates_len; *pu8CurrByte++ = pstrStationParam->ht_supported; - *pu8CurrByte++ = pstrStationParam->u16HTCapInfo & 0xFF; - *pu8CurrByte++ = (pstrStationParam->u16HTCapInfo >> 8) & 0xFF; + *pu8CurrByte++ = pstrStationParam->ht_capa_info & 0xFF; + *pu8CurrByte++ = (pstrStationParam->ht_capa_info >> 8) & 0xFF; *pu8CurrByte++ = pstrStationParam->u8AmpduParams; memcpy(pu8CurrByte, pstrStationParam->au8SuppMCsSet, WILC_SUPP_MCS_SET_SIZE); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 2d9d8086bcd6..782088fadc0e 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -293,7 +293,7 @@ struct add_sta_param { u8 rates_len; const u8 *rates; bool ht_supported; - u16 u16HTCapInfo; + u16 ht_capa_info; u8 u8AmpduParams; u8 au8SuppMCsSet[16]; u16 u16HTExtParams; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index d5b5158b5f7e..0d465c1119bc 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -3013,7 +3013,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.ht_supported = false; } else { strStaParams.ht_supported = true; - strStaParams.u16HTCapInfo = params->ht_capa->cap_info; + strStaParams.ht_capa_info = params->ht_capa->cap_info; strStaParams.u8AmpduParams = params->ht_capa->ampdu_params_info; memcpy(strStaParams.au8SuppMCsSet, ¶ms->ht_capa->mcs, WILC_SUPP_MCS_SET_SIZE); strStaParams.u16HTExtParams = params->ht_capa->extended_ht_cap_info; @@ -3026,7 +3026,8 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, PRINT_D(HOSTAPD_DBG, "IS HT supported = %d\n", strStaParams.ht_supported); - PRINT_D(HOSTAPD_DBG, "Capability Info = %d\n", strStaParams.u16HTCapInfo); + PRINT_D(HOSTAPD_DBG, "Capability Info = %d\n", + strStaParams.ht_capa_info); PRINT_D(HOSTAPD_DBG, "AMPDU Params = %d\n", strStaParams.u8AmpduParams); PRINT_D(HOSTAPD_DBG, "HT Extended params = %d\n", strStaParams.u16HTExtParams); PRINT_D(HOSTAPD_DBG, "Tx Beamforming Cap = %d\n", strStaParams.u32TxBeamformingCap); @@ -3128,7 +3129,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.ht_supported = false; } else { strStaParams.ht_supported = true; - strStaParams.u16HTCapInfo = params->ht_capa->cap_info; + strStaParams.ht_capa_info = params->ht_capa->cap_info; strStaParams.u8AmpduParams = params->ht_capa->ampdu_params_info; memcpy(strStaParams.au8SuppMCsSet, ¶ms->ht_capa->mcs, WILC_SUPP_MCS_SET_SIZE); strStaParams.u16HTExtParams = params->ht_capa->extended_ht_cap_info; @@ -3142,7 +3143,8 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, PRINT_D(HOSTAPD_DBG, "IS HT supported = %d\n", strStaParams.ht_supported); - PRINT_D(HOSTAPD_DBG, "Capability Info = %d\n", strStaParams.u16HTCapInfo); + PRINT_D(HOSTAPD_DBG, "Capability Info = %d\n", + strStaParams.ht_capa_info); PRINT_D(HOSTAPD_DBG, "AMPDU Params = %d\n", strStaParams.u8AmpduParams); PRINT_D(HOSTAPD_DBG, "HT Extended params = %d\n", strStaParams.u16HTExtParams); PRINT_D(HOSTAPD_DBG, "Tx Beamforming Cap = %d\n", strStaParams.u32TxBeamformingCap); From fba1f2d221b806b8e0e31939c595f05a87e3bf36 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:47 +0900 Subject: [PATCH 168/843] staging: wilc1000: rename u8AmpduParams of struct add_sta_param This patch renames u8AmpduParams of struct add_sta_param to ht_ampdu_params to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 2 +- drivers/staging/wilc1000/host_interface.h | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index e6388ffae6d2..8f7d3027ba1c 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2324,7 +2324,7 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, *pu8CurrByte++ = pstrStationParam->ht_capa_info & 0xFF; *pu8CurrByte++ = (pstrStationParam->ht_capa_info >> 8) & 0xFF; - *pu8CurrByte++ = pstrStationParam->u8AmpduParams; + *pu8CurrByte++ = pstrStationParam->ht_ampdu_params; memcpy(pu8CurrByte, pstrStationParam->au8SuppMCsSet, WILC_SUPP_MCS_SET_SIZE); pu8CurrByte += WILC_SUPP_MCS_SET_SIZE; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 782088fadc0e..bb3bf077e9ce 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -294,7 +294,7 @@ struct add_sta_param { const u8 *rates; bool ht_supported; u16 ht_capa_info; - u8 u8AmpduParams; + u8 ht_ampdu_params; u8 au8SuppMCsSet[16]; u16 u16HTExtParams; u32 u32TxBeamformingCap; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 0d465c1119bc..5ea7bd2ededb 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -3014,7 +3014,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, } else { strStaParams.ht_supported = true; strStaParams.ht_capa_info = params->ht_capa->cap_info; - strStaParams.u8AmpduParams = params->ht_capa->ampdu_params_info; + strStaParams.ht_ampdu_params = params->ht_capa->ampdu_params_info; memcpy(strStaParams.au8SuppMCsSet, ¶ms->ht_capa->mcs, WILC_SUPP_MCS_SET_SIZE); strStaParams.u16HTExtParams = params->ht_capa->extended_ht_cap_info; strStaParams.u32TxBeamformingCap = params->ht_capa->tx_BF_cap_info; @@ -3028,7 +3028,8 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.ht_supported); PRINT_D(HOSTAPD_DBG, "Capability Info = %d\n", strStaParams.ht_capa_info); - PRINT_D(HOSTAPD_DBG, "AMPDU Params = %d\n", strStaParams.u8AmpduParams); + PRINT_D(HOSTAPD_DBG, "AMPDU Params = %d\n", + strStaParams.ht_ampdu_params); PRINT_D(HOSTAPD_DBG, "HT Extended params = %d\n", strStaParams.u16HTExtParams); PRINT_D(HOSTAPD_DBG, "Tx Beamforming Cap = %d\n", strStaParams.u32TxBeamformingCap); PRINT_D(HOSTAPD_DBG, "Antenna selection info = %d\n", strStaParams.u8ASELCap); @@ -3130,7 +3131,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, } else { strStaParams.ht_supported = true; strStaParams.ht_capa_info = params->ht_capa->cap_info; - strStaParams.u8AmpduParams = params->ht_capa->ampdu_params_info; + strStaParams.ht_ampdu_params = params->ht_capa->ampdu_params_info; memcpy(strStaParams.au8SuppMCsSet, ¶ms->ht_capa->mcs, WILC_SUPP_MCS_SET_SIZE); strStaParams.u16HTExtParams = params->ht_capa->extended_ht_cap_info; strStaParams.u32TxBeamformingCap = params->ht_capa->tx_BF_cap_info; @@ -3145,7 +3146,8 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.ht_supported); PRINT_D(HOSTAPD_DBG, "Capability Info = %d\n", strStaParams.ht_capa_info); - PRINT_D(HOSTAPD_DBG, "AMPDU Params = %d\n", strStaParams.u8AmpduParams); + PRINT_D(HOSTAPD_DBG, "AMPDU Params = %d\n", + strStaParams.ht_ampdu_params); PRINT_D(HOSTAPD_DBG, "HT Extended params = %d\n", strStaParams.u16HTExtParams); PRINT_D(HOSTAPD_DBG, "Tx Beamforming Cap = %d\n", strStaParams.u32TxBeamformingCap); PRINT_D(HOSTAPD_DBG, "Antenna selection info = %d\n", strStaParams.u8ASELCap); From 5ebbf4f74888f8ef9ee07864de6251dd81d1a359 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:48 +0900 Subject: [PATCH 169/843] staging: wilc1000: rename au8SuppMCsSet of struct add_sta_param This patch renames au8SuppMCsSet of struct add_sta_param to ht_supp_mcs_set to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 3 ++- drivers/staging/wilc1000/host_interface.h | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 ++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 8f7d3027ba1c..d0a65c79ee88 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2325,7 +2325,8 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, *pu8CurrByte++ = (pstrStationParam->ht_capa_info >> 8) & 0xFF; *pu8CurrByte++ = pstrStationParam->ht_ampdu_params; - memcpy(pu8CurrByte, pstrStationParam->au8SuppMCsSet, WILC_SUPP_MCS_SET_SIZE); + memcpy(pu8CurrByte, pstrStationParam->ht_supp_mcs_set, + WILC_SUPP_MCS_SET_SIZE); pu8CurrByte += WILC_SUPP_MCS_SET_SIZE; *pu8CurrByte++ = pstrStationParam->u16HTExtParams & 0xFF; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index bb3bf077e9ce..798adcf078dd 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -295,7 +295,7 @@ struct add_sta_param { bool ht_supported; u16 ht_capa_info; u8 ht_ampdu_params; - u8 au8SuppMCsSet[16]; + u8 ht_supp_mcs_set[16]; u16 u16HTExtParams; u32 u32TxBeamformingCap; u8 u8ASELCap; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 5ea7bd2ededb..ef308da53b40 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -3015,7 +3015,9 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.ht_supported = true; strStaParams.ht_capa_info = params->ht_capa->cap_info; strStaParams.ht_ampdu_params = params->ht_capa->ampdu_params_info; - memcpy(strStaParams.au8SuppMCsSet, ¶ms->ht_capa->mcs, WILC_SUPP_MCS_SET_SIZE); + memcpy(strStaParams.ht_supp_mcs_set, + ¶ms->ht_capa->mcs, + WILC_SUPP_MCS_SET_SIZE); strStaParams.u16HTExtParams = params->ht_capa->extended_ht_cap_info; strStaParams.u32TxBeamformingCap = params->ht_capa->tx_BF_cap_info; strStaParams.u8ASELCap = params->ht_capa->antenna_selection_info; @@ -3132,7 +3134,9 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.ht_supported = true; strStaParams.ht_capa_info = params->ht_capa->cap_info; strStaParams.ht_ampdu_params = params->ht_capa->ampdu_params_info; - memcpy(strStaParams.au8SuppMCsSet, ¶ms->ht_capa->mcs, WILC_SUPP_MCS_SET_SIZE); + memcpy(strStaParams.ht_supp_mcs_set, + ¶ms->ht_capa->mcs, + WILC_SUPP_MCS_SET_SIZE); strStaParams.u16HTExtParams = params->ht_capa->extended_ht_cap_info; strStaParams.u32TxBeamformingCap = params->ht_capa->tx_BF_cap_info; strStaParams.u8ASELCap = params->ht_capa->antenna_selection_info; From 223741d71ee66e311a34176f154d979a62b32a70 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:49 +0900 Subject: [PATCH 170/843] staging: wilc1000: rename u16HTExtParams of struct add_sta_param This patch renames u16HTExtParams of struct add_sta_param to ht_ext_params to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 10 ++++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index d0a65c79ee88..be1fcbd37eec 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2329,8 +2329,8 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, WILC_SUPP_MCS_SET_SIZE); pu8CurrByte += WILC_SUPP_MCS_SET_SIZE; - *pu8CurrByte++ = pstrStationParam->u16HTExtParams & 0xFF; - *pu8CurrByte++ = (pstrStationParam->u16HTExtParams >> 8) & 0xFF; + *pu8CurrByte++ = pstrStationParam->ht_ext_params & 0xFF; + *pu8CurrByte++ = (pstrStationParam->ht_ext_params >> 8) & 0xFF; *pu8CurrByte++ = pstrStationParam->u32TxBeamformingCap & 0xFF; *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 8) & 0xFF; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 798adcf078dd..c8e2d3fea6f8 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -296,7 +296,7 @@ struct add_sta_param { u16 ht_capa_info; u8 ht_ampdu_params; u8 ht_supp_mcs_set[16]; - u16 u16HTExtParams; + u16 ht_ext_params; u32 u32TxBeamformingCap; u8 u8ASELCap; u16 u16FlagsMask; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index ef308da53b40..e41778587e64 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -3018,7 +3018,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, memcpy(strStaParams.ht_supp_mcs_set, ¶ms->ht_capa->mcs, WILC_SUPP_MCS_SET_SIZE); - strStaParams.u16HTExtParams = params->ht_capa->extended_ht_cap_info; + strStaParams.ht_ext_params = params->ht_capa->extended_ht_cap_info; strStaParams.u32TxBeamformingCap = params->ht_capa->tx_BF_cap_info; strStaParams.u8ASELCap = params->ht_capa->antenna_selection_info; } @@ -3032,7 +3032,8 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.ht_capa_info); PRINT_D(HOSTAPD_DBG, "AMPDU Params = %d\n", strStaParams.ht_ampdu_params); - PRINT_D(HOSTAPD_DBG, "HT Extended params = %d\n", strStaParams.u16HTExtParams); + PRINT_D(HOSTAPD_DBG, "HT Extended params = %d\n", + strStaParams.ht_ext_params); PRINT_D(HOSTAPD_DBG, "Tx Beamforming Cap = %d\n", strStaParams.u32TxBeamformingCap); PRINT_D(HOSTAPD_DBG, "Antenna selection info = %d\n", strStaParams.u8ASELCap); PRINT_D(HOSTAPD_DBG, "Flag Mask = %d\n", strStaParams.u16FlagsMask); @@ -3137,7 +3138,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, memcpy(strStaParams.ht_supp_mcs_set, ¶ms->ht_capa->mcs, WILC_SUPP_MCS_SET_SIZE); - strStaParams.u16HTExtParams = params->ht_capa->extended_ht_cap_info; + strStaParams.ht_ext_params = params->ht_capa->extended_ht_cap_info; strStaParams.u32TxBeamformingCap = params->ht_capa->tx_BF_cap_info; strStaParams.u8ASELCap = params->ht_capa->antenna_selection_info; @@ -3152,7 +3153,8 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.ht_capa_info); PRINT_D(HOSTAPD_DBG, "AMPDU Params = %d\n", strStaParams.ht_ampdu_params); - PRINT_D(HOSTAPD_DBG, "HT Extended params = %d\n", strStaParams.u16HTExtParams); + PRINT_D(HOSTAPD_DBG, "HT Extended params = %d\n", + strStaParams.ht_ext_params); PRINT_D(HOSTAPD_DBG, "Tx Beamforming Cap = %d\n", strStaParams.u32TxBeamformingCap); PRINT_D(HOSTAPD_DBG, "Antenna selection info = %d\n", strStaParams.u8ASELCap); PRINT_D(HOSTAPD_DBG, "Flag Mask = %d\n", strStaParams.u16FlagsMask); From 74fe73cf081f98b90aa7914fa3f879bf77e31f78 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:50 +0900 Subject: [PATCH 171/843] staging: wilc1000: rename u32TxBeamformingCap of struct add_sta_param This patch renames u32TxBeamformingCap of struct add_sta_param to ht_tx_bf_cap to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 8 ++++---- drivers/staging/wilc1000/host_interface.h | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 10 ++++++---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index be1fcbd37eec..41ccd80b3d84 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2332,10 +2332,10 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, *pu8CurrByte++ = pstrStationParam->ht_ext_params & 0xFF; *pu8CurrByte++ = (pstrStationParam->ht_ext_params >> 8) & 0xFF; - *pu8CurrByte++ = pstrStationParam->u32TxBeamformingCap & 0xFF; - *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 8) & 0xFF; - *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 16) & 0xFF; - *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 24) & 0xFF; + *pu8CurrByte++ = pstrStationParam->ht_tx_bf_cap & 0xFF; + *pu8CurrByte++ = (pstrStationParam->ht_tx_bf_cap >> 8) & 0xFF; + *pu8CurrByte++ = (pstrStationParam->ht_tx_bf_cap >> 16) & 0xFF; + *pu8CurrByte++ = (pstrStationParam->ht_tx_bf_cap >> 24) & 0xFF; *pu8CurrByte++ = pstrStationParam->u8ASELCap; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index c8e2d3fea6f8..3311d2faf59d 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -297,7 +297,7 @@ struct add_sta_param { u8 ht_ampdu_params; u8 ht_supp_mcs_set[16]; u16 ht_ext_params; - u32 u32TxBeamformingCap; + u32 ht_tx_bf_cap; u8 u8ASELCap; u16 u16FlagsMask; u16 u16FlagsSet; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index e41778587e64..abd90963e5ad 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -3019,7 +3019,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, ¶ms->ht_capa->mcs, WILC_SUPP_MCS_SET_SIZE); strStaParams.ht_ext_params = params->ht_capa->extended_ht_cap_info; - strStaParams.u32TxBeamformingCap = params->ht_capa->tx_BF_cap_info; + strStaParams.ht_tx_bf_cap = params->ht_capa->tx_BF_cap_info; strStaParams.u8ASELCap = params->ht_capa->antenna_selection_info; } @@ -3034,7 +3034,8 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.ht_ampdu_params); PRINT_D(HOSTAPD_DBG, "HT Extended params = %d\n", strStaParams.ht_ext_params); - PRINT_D(HOSTAPD_DBG, "Tx Beamforming Cap = %d\n", strStaParams.u32TxBeamformingCap); + PRINT_D(HOSTAPD_DBG, "Tx Beamforming Cap = %d\n", + strStaParams.ht_tx_bf_cap); PRINT_D(HOSTAPD_DBG, "Antenna selection info = %d\n", strStaParams.u8ASELCap); PRINT_D(HOSTAPD_DBG, "Flag Mask = %d\n", strStaParams.u16FlagsMask); PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n", strStaParams.u16FlagsSet); @@ -3139,7 +3140,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, ¶ms->ht_capa->mcs, WILC_SUPP_MCS_SET_SIZE); strStaParams.ht_ext_params = params->ht_capa->extended_ht_cap_info; - strStaParams.u32TxBeamformingCap = params->ht_capa->tx_BF_cap_info; + strStaParams.ht_tx_bf_cap = params->ht_capa->tx_BF_cap_info; strStaParams.u8ASELCap = params->ht_capa->antenna_selection_info; } @@ -3155,7 +3156,8 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.ht_ampdu_params); PRINT_D(HOSTAPD_DBG, "HT Extended params = %d\n", strStaParams.ht_ext_params); - PRINT_D(HOSTAPD_DBG, "Tx Beamforming Cap = %d\n", strStaParams.u32TxBeamformingCap); + PRINT_D(HOSTAPD_DBG, "Tx Beamforming Cap = %d\n", + strStaParams.ht_tx_bf_cap); PRINT_D(HOSTAPD_DBG, "Antenna selection info = %d\n", strStaParams.u8ASELCap); PRINT_D(HOSTAPD_DBG, "Flag Mask = %d\n", strStaParams.u16FlagsMask); PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n", strStaParams.u16FlagsSet); From a486baff710b4f761749ca16e3ff6b1cb0fe63dd Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:51 +0900 Subject: [PATCH 172/843] staging: wilc1000: rename u8ASELCap of struct add_sta_param This patch renames u8ASELCap of struct add_sta_param to ht_ante_sel to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 2 +- drivers/staging/wilc1000/host_interface.h | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 11 ++++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 41ccd80b3d84..5a2e874d4d71 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2337,7 +2337,7 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, *pu8CurrByte++ = (pstrStationParam->ht_tx_bf_cap >> 16) & 0xFF; *pu8CurrByte++ = (pstrStationParam->ht_tx_bf_cap >> 24) & 0xFF; - *pu8CurrByte++ = pstrStationParam->u8ASELCap; + *pu8CurrByte++ = pstrStationParam->ht_ante_sel; *pu8CurrByte++ = pstrStationParam->u16FlagsMask & 0xFF; *pu8CurrByte++ = (pstrStationParam->u16FlagsMask >> 8) & 0xFF; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 3311d2faf59d..5ad0bfa84f00 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -298,7 +298,7 @@ struct add_sta_param { u8 ht_supp_mcs_set[16]; u16 ht_ext_params; u32 ht_tx_bf_cap; - u8 u8ASELCap; + u8 ht_ante_sel; u16 u16FlagsMask; u16 u16FlagsSet; }; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index abd90963e5ad..a2c08783f405 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -3020,7 +3020,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, WILC_SUPP_MCS_SET_SIZE); strStaParams.ht_ext_params = params->ht_capa->extended_ht_cap_info; strStaParams.ht_tx_bf_cap = params->ht_capa->tx_BF_cap_info; - strStaParams.u8ASELCap = params->ht_capa->antenna_selection_info; + strStaParams.ht_ante_sel = params->ht_capa->antenna_selection_info; } strStaParams.u16FlagsMask = params->sta_flags_mask; @@ -3036,7 +3036,8 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.ht_ext_params); PRINT_D(HOSTAPD_DBG, "Tx Beamforming Cap = %d\n", strStaParams.ht_tx_bf_cap); - PRINT_D(HOSTAPD_DBG, "Antenna selection info = %d\n", strStaParams.u8ASELCap); + PRINT_D(HOSTAPD_DBG, "Antenna selection info = %d\n", + strStaParams.ht_ante_sel); PRINT_D(HOSTAPD_DBG, "Flag Mask = %d\n", strStaParams.u16FlagsMask); PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n", strStaParams.u16FlagsSet); @@ -3141,8 +3142,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, WILC_SUPP_MCS_SET_SIZE); strStaParams.ht_ext_params = params->ht_capa->extended_ht_cap_info; strStaParams.ht_tx_bf_cap = params->ht_capa->tx_BF_cap_info; - strStaParams.u8ASELCap = params->ht_capa->antenna_selection_info; - + strStaParams.ht_ante_sel = params->ht_capa->antenna_selection_info; } strStaParams.u16FlagsMask = params->sta_flags_mask; @@ -3158,7 +3158,8 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.ht_ext_params); PRINT_D(HOSTAPD_DBG, "Tx Beamforming Cap = %d\n", strStaParams.ht_tx_bf_cap); - PRINT_D(HOSTAPD_DBG, "Antenna selection info = %d\n", strStaParams.u8ASELCap); + PRINT_D(HOSTAPD_DBG, "Antenna selection info = %d\n", + strStaParams.ht_ante_sel); PRINT_D(HOSTAPD_DBG, "Flag Mask = %d\n", strStaParams.u16FlagsMask); PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n", strStaParams.u16FlagsSet); From f676e17a716d109b853a6237ffe6c9137c9e3b92 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:52 +0900 Subject: [PATCH 173/843] staging: wilc1000: rename u16FlagsMask of struct add_sta_param This patch renames u16FlagsMask of struct add_sta_param to flags_mask to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 10 ++++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 5a2e874d4d71..258dabd24dd7 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2339,8 +2339,8 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, *pu8CurrByte++ = pstrStationParam->ht_ante_sel; - *pu8CurrByte++ = pstrStationParam->u16FlagsMask & 0xFF; - *pu8CurrByte++ = (pstrStationParam->u16FlagsMask >> 8) & 0xFF; + *pu8CurrByte++ = pstrStationParam->flags_mask & 0xFF; + *pu8CurrByte++ = (pstrStationParam->flags_mask >> 8) & 0xFF; *pu8CurrByte++ = pstrStationParam->u16FlagsSet & 0xFF; *pu8CurrByte++ = (pstrStationParam->u16FlagsSet >> 8) & 0xFF; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 5ad0bfa84f00..1422b90b3173 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -299,7 +299,7 @@ struct add_sta_param { u16 ht_ext_params; u32 ht_tx_bf_cap; u8 ht_ante_sel; - u16 u16FlagsMask; + u16 flags_mask; u16 u16FlagsSet; }; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index a2c08783f405..0ae47c5c3a16 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -3023,7 +3023,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.ht_ante_sel = params->ht_capa->antenna_selection_info; } - strStaParams.u16FlagsMask = params->sta_flags_mask; + strStaParams.flags_mask = params->sta_flags_mask; strStaParams.u16FlagsSet = params->sta_flags_set; PRINT_D(HOSTAPD_DBG, "IS HT supported = %d\n", @@ -3038,7 +3038,8 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.ht_tx_bf_cap); PRINT_D(HOSTAPD_DBG, "Antenna selection info = %d\n", strStaParams.ht_ante_sel); - PRINT_D(HOSTAPD_DBG, "Flag Mask = %d\n", strStaParams.u16FlagsMask); + PRINT_D(HOSTAPD_DBG, "Flag Mask = %d\n", + strStaParams.flags_mask); PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n", strStaParams.u16FlagsSet); s32Error = host_int_add_station(priv->hWILCWFIDrv, &strStaParams); @@ -3145,7 +3146,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.ht_ante_sel = params->ht_capa->antenna_selection_info; } - strStaParams.u16FlagsMask = params->sta_flags_mask; + strStaParams.flags_mask = params->sta_flags_mask; strStaParams.u16FlagsSet = params->sta_flags_set; PRINT_D(HOSTAPD_DBG, "IS HT supported = %d\n", @@ -3160,7 +3161,8 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.ht_tx_bf_cap); PRINT_D(HOSTAPD_DBG, "Antenna selection info = %d\n", strStaParams.ht_ante_sel); - PRINT_D(HOSTAPD_DBG, "Flag Mask = %d\n", strStaParams.u16FlagsMask); + PRINT_D(HOSTAPD_DBG, "Flag Mask = %d\n", + strStaParams.flags_mask); PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n", strStaParams.u16FlagsSet); s32Error = host_int_edit_station(priv->hWILCWFIDrv, &strStaParams); From 67ab64e44c4658e99d11835913ec30fdb0dba634 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:53 +0900 Subject: [PATCH 174/843] staging: wilc1000: rename u16FlagsSet of struct add_sta_param This patch renames u16FlagsSet of struct add_sta_param to flags_set to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 10 ++++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 258dabd24dd7..34b345516a92 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2342,8 +2342,8 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, *pu8CurrByte++ = pstrStationParam->flags_mask & 0xFF; *pu8CurrByte++ = (pstrStationParam->flags_mask >> 8) & 0xFF; - *pu8CurrByte++ = pstrStationParam->u16FlagsSet & 0xFF; - *pu8CurrByte++ = (pstrStationParam->u16FlagsSet >> 8) & 0xFF; + *pu8CurrByte++ = pstrStationParam->flags_set & 0xFF; + *pu8CurrByte++ = (pstrStationParam->flags_set >> 8) & 0xFF; return pu8CurrByte - pu8Buffer; } diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 1422b90b3173..72c47974d2d8 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -300,7 +300,7 @@ struct add_sta_param { u32 ht_tx_bf_cap; u8 ht_ante_sel; u16 flags_mask; - u16 u16FlagsSet; + u16 flags_set; }; s32 host_int_remove_key(struct host_if_drv *hWFIDrv, const u8 *pu8StaAddress); diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 0ae47c5c3a16..4de27ef5b6e4 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -3024,7 +3024,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, } strStaParams.flags_mask = params->sta_flags_mask; - strStaParams.u16FlagsSet = params->sta_flags_set; + strStaParams.flags_set = params->sta_flags_set; PRINT_D(HOSTAPD_DBG, "IS HT supported = %d\n", strStaParams.ht_supported); @@ -3040,7 +3040,8 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.ht_ante_sel); PRINT_D(HOSTAPD_DBG, "Flag Mask = %d\n", strStaParams.flags_mask); - PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n", strStaParams.u16FlagsSet); + PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n", + strStaParams.flags_set); s32Error = host_int_add_station(priv->hWILCWFIDrv, &strStaParams); if (s32Error) @@ -3147,7 +3148,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, } strStaParams.flags_mask = params->sta_flags_mask; - strStaParams.u16FlagsSet = params->sta_flags_set; + strStaParams.flags_set = params->sta_flags_set; PRINT_D(HOSTAPD_DBG, "IS HT supported = %d\n", strStaParams.ht_supported); @@ -3163,7 +3164,8 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.ht_ante_sel); PRINT_D(HOSTAPD_DBG, "Flag Mask = %d\n", strStaParams.flags_mask); - PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n", strStaParams.u16FlagsSet); + PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n", + strStaParams.flags_set); s32Error = host_int_edit_station(priv->hWILCWFIDrv, &strStaParams); if (s32Error) From 9cf7878c20f9fc7311cbf6f5a34599f769c70882 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:54 +0900 Subject: [PATCH 175/843] staging: wilc1000: rename pstrHostIFSetChan of fuction Handle_SetChannel This patch renames pstrHostIFSetChan of fuction Handle_SetChannel to hif_set_ch to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 34b345516a92..819306b7e9b6 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -325,14 +325,14 @@ static struct host_if_drv *get_handler_from_id(int id) } static s32 Handle_SetChannel(struct host_if_drv *hif_drv, - struct channel_attr *pstrHostIFSetChan) + struct channel_attr *hif_set_ch) { s32 result = 0; struct wid wid; wid.id = (u16)WID_CURRENT_CHANNEL; wid.type = WID_CHAR; - wid.val = (char *)&pstrHostIFSetChan->set_ch; + wid.val = (char *)&hif_set_ch->set_ch; wid.size = sizeof(char); PRINT_D(HOSTINF_DBG, "Setting channel\n"); From 6b73c7442597ceb664dc02514798c4d5184bd702 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:55 +0900 Subject: [PATCH 176/843] staging: wilc1000: rename pstrHostIfSetDrvHandler of fuction Handle_SetWfiDrvHandler This patch renames pstrHostIfSetDrvHandler of fuction Handle_SetWfiDrvHandler to hif_drv_handler to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 819306b7e9b6..96c6d4a96024 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -349,18 +349,17 @@ static s32 Handle_SetChannel(struct host_if_drv *hif_drv, } static s32 Handle_SetWfiDrvHandler(struct host_if_drv *hif_drv, - struct drv_handler *pstrHostIfSetDrvHandler) + struct drv_handler *hif_drv_handler) { s32 result = 0; struct wid wid; wid.id = (u16)WID_SET_DRV_HANDLER; wid.type = WID_INT; - wid.val = (s8 *)&pstrHostIfSetDrvHandler->handler; + wid.val = (s8 *)&hif_drv_handler->handler; wid.size = sizeof(u32); - result = send_config_pkt(SET_CFG, &wid, 1, - pstrHostIfSetDrvHandler->handler); + result = send_config_pkt(SET_CFG, &wid, 1, hif_drv_handler->handler); if (!hif_drv) up(&hif_sema_driver); From acff1d71f722f00ef1929df1d3b55bb65322f754 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 29 Oct 2015 12:05:56 +0900 Subject: [PATCH 177/843] staging: wilc1000: rename pstrHostIfSetOperationMode of fuction Handle_SetOperationMode This patch renames pstrHostIfSetOperationMode of fuction Handle_SetOperationMode to hif_op_mode to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 96c6d4a96024..17826f3d4407 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -373,20 +373,20 @@ static s32 Handle_SetWfiDrvHandler(struct host_if_drv *hif_drv, } static s32 Handle_SetOperationMode(struct host_if_drv *hif_drv, - struct op_mode *pstrHostIfSetOperationMode) + struct op_mode *hif_op_mode) { s32 result = 0; struct wid wid; wid.id = (u16)WID_SET_OPERATION_MODE; wid.type = WID_INT; - wid.val = (s8 *)&pstrHostIfSetOperationMode->mode; + wid.val = (s8 *)&hif_op_mode->mode; wid.size = sizeof(u32); result = send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); - if ((pstrHostIfSetOperationMode->mode) == IDLE_MODE) + if ((hif_op_mode->mode) == IDLE_MODE) up(&hif_sema_driver); if (result) { From 7af0522c99cf9b12f156267fa4185208e90cf4c6 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Thu, 29 Oct 2015 12:18:41 +0900 Subject: [PATCH 178/843] staging: wilc1000: wilc_wlan_txq_get_first: add argument struct wilc This patch adds new argument struct wilc and use it instead of g_linux_wlan. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index c02665747705..6c7cbd1125b5 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -563,17 +563,17 @@ int wilc_wlan_txq_add_mgmt_pkt(void *priv, u8 *buffer, u32 buffer_size, wilc_tx_ return 1; } -static struct txq_entry_t *wilc_wlan_txq_get_first(void) +static struct txq_entry_t *wilc_wlan_txq_get_first(struct wilc *wilc) { wilc_wlan_dev_t *p = &g_wlan; struct txq_entry_t *tqe; unsigned long flags; - spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags); + spin_lock_irqsave(&wilc->txq_spinlock, flags); tqe = p->txq_head; - spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags); + spin_unlock_irqrestore(&wilc->txq_spinlock, flags); return tqe; @@ -855,7 +855,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) * build the vmm list **/ PRINT_D(TX_DBG, "Getting the head of the TxQ\n"); - tqe = wilc_wlan_txq_get_first(); + tqe = wilc_wlan_txq_get_first(wilc); i = 0; sum = 0; do { From ed760b67f283756cca401085519f0ff1a0996624 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Thu, 29 Oct 2015 12:18:42 +0900 Subject: [PATCH 179/843] staging: wilc1000: linux_wlan_firmware_download: change argument This patch changes argument p_nic with wilc and use it instead of g_linux_wlan. Pass argument dev to the function. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 034cfed653b0..79e59babc306 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -597,12 +597,16 @@ static int linux_wlan_start_firmware(perInterface_wlan_t *nic) _fail_: return ret; } -static int linux_wlan_firmware_download(struct wilc *p_nic) +static int linux_wlan_firmware_download(struct net_device *dev) { - + perInterface_wlan_t *nic; + struct wilc *wilc; int ret = 0; - if (!g_linux_wlan->firmware) { + nic = netdev_priv(dev); + wilc = nic->wilc; + + if (!wilc->firmware) { PRINT_ER("Firmware buffer is NULL\n"); ret = -ENOBUFS; goto _FAIL_; @@ -611,15 +615,15 @@ static int linux_wlan_firmware_download(struct wilc *p_nic) * do the firmware download **/ PRINT_D(INIT_DBG, "Downloading Firmware ...\n"); - ret = wilc_wlan_firmware_download(g_linux_wlan->firmware->data, - g_linux_wlan->firmware->size); + ret = wilc_wlan_firmware_download(wilc->firmware->data, + wilc->firmware->size); if (ret < 0) goto _FAIL_; /* Freeing FW buffer */ PRINT_D(INIT_DBG, "Freeing FW buffer ...\n"); PRINT_D(INIT_DBG, "Releasing firmware\n"); - release_firmware(g_linux_wlan->firmware); + release_firmware(wilc->firmware); PRINT_D(INIT_DBG, "Download Succeeded\n"); @@ -1123,7 +1127,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) } /*Download firmware*/ - ret = linux_wlan_firmware_download(wl); + ret = linux_wlan_firmware_download(dev); if (ret < 0) { PRINT_ER("Failed to download firmware\n"); ret = -EIO; From 718fc2c9d4145ade7c97bbeb4f0a5c0e7e800cdd Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Thu, 29 Oct 2015 12:18:43 +0900 Subject: [PATCH 180/843] staging: wilc1000: wilc_wlan_txq_remove_from_head: add new argument dev Add new argument dev and use it instead of g_linux_wlan, and pass argument dev to the function as well. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 6c7cbd1125b5..5dcc4d21fa31 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -159,13 +159,19 @@ static void wilc_wlan_txq_remove(struct txq_entry_t *tqe) } -static struct txq_entry_t *wilc_wlan_txq_remove_from_head(void) +static struct txq_entry_t * +wilc_wlan_txq_remove_from_head(struct net_device *dev) { struct txq_entry_t *tqe; wilc_wlan_dev_t *p = &g_wlan; unsigned long flags; + perInterface_wlan_t *nic; + struct wilc *wilc; - spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags); + nic = netdev_priv(dev); + wilc = nic->wilc; + + spin_lock_irqsave(&wilc->txq_spinlock, flags); if (p->txq_head) { tqe = p->txq_head; p->txq_head = tqe->next; @@ -180,7 +186,7 @@ static struct txq_entry_t *wilc_wlan_txq_remove_from_head(void) } else { tqe = NULL; } - spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags); + spin_unlock_irqrestore(&wilc->txq_spinlock, flags); return tqe; } @@ -1035,7 +1041,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) offset = 0; i = 0; do { - tqe = wilc_wlan_txq_remove_from_head(); + tqe = wilc_wlan_txq_remove_from_head(dev); if (tqe != NULL && (vmm_table[i] != 0)) { u32 header, buffer_offset; @@ -1668,7 +1674,7 @@ void wilc_wlan_cleanup(struct net_device *dev) p->quit = 1; do { - tqe = wilc_wlan_txq_remove_from_head(); + tqe = wilc_wlan_txq_remove_from_head(dev); if (tqe == NULL) break; if (tqe->tx_complete_func) From 829c477fd4811f7f1b90d8d4fa132d66e193689c Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Thu, 29 Oct 2015 12:18:44 +0900 Subject: [PATCH 181/843] staging: wilc1000: wilc_wlan_txq_add_mgmt_pkt: add new argument dev This patch adds new argument struct net_device *dev and pass argument struct net_device to the function. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_mon.c | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ++-- drivers/staging/wilc1000/wilc_wlan.c | 3 ++- drivers/staging/wilc1000/wilc_wlan.h | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c index 450af1b77f99..589a11fd977c 100644 --- a/drivers/staging/wilc1000/linux_mon.c +++ b/drivers/staging/wilc1000/linux_mon.c @@ -195,7 +195,7 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len) mgmt_tx->size = len; memcpy(mgmt_tx->buff, buf, len); - wilc_wlan_txq_add_mgmt_pkt(mgmt_tx, mgmt_tx->buff, mgmt_tx->size, + wilc_wlan_txq_add_mgmt_pkt(dev, mgmt_tx, mgmt_tx->buff, mgmt_tx->size, mgmt_tx_complete); netif_wake_queue(dev); diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 4de27ef5b6e4..cdcf134c314a 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -2337,8 +2337,8 @@ static int mgmt_tx(struct wiphy *wiphy, jiffies, pstrWFIDrv->p2p_timeout); } - wilc_wlan_txq_add_mgmt_pkt(mgmt_tx, mgmt_tx->buff, - mgmt_tx->size, + wilc_wlan_txq_add_mgmt_pkt(wdev->netdev, mgmt_tx, + mgmt_tx->buff, mgmt_tx->size, WILC_WFI_mgmt_tx_complete); } else { PRINT_D(GENERIC_DBG, "This function transmits only management frames\n"); diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 5dcc4d21fa31..3dc0a80275ba 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -543,7 +543,8 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, return p->txq_entries; } -int wilc_wlan_txq_add_mgmt_pkt(void *priv, u8 *buffer, u32 buffer_size, wilc_tx_complete_func_t func) +int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, + u32 buffer_size, wilc_tx_complete_func_t func) { wilc_wlan_dev_t *p = &g_wlan; diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 57e1d5174050..2eb7e207b3ab 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -307,6 +307,6 @@ int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, int commit, u32 drvHandler); int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler); int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size); -int wilc_wlan_txq_add_mgmt_pkt(void *priv, u8 *buffer, u32 buffer_size, - wilc_tx_complete_func_t func); +int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, + u32 buffer_size, wilc_tx_complete_func_t func); #endif From 32f033287bdf1420b86fd459cbd19c060053037c Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Thu, 29 Oct 2015 12:18:45 +0900 Subject: [PATCH 182/843] staging: wilc1000: wilc_wlan_txq_add_to_tail: add argument net_device This patch adds new argument dev and use netdev private data member wilc instead of g_linux_wlan, pass the function dev also. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 3dc0a80275ba..03593b7e50e2 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -190,11 +190,18 @@ wilc_wlan_txq_remove_from_head(struct net_device *dev) return tqe; } -static void wilc_wlan_txq_add_to_tail(struct txq_entry_t *tqe) +static void wilc_wlan_txq_add_to_tail(struct net_device *dev, + struct txq_entry_t *tqe) { wilc_wlan_dev_t *p = &g_wlan; unsigned long flags; - spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags); + perInterface_wlan_t *nic; + struct wilc *wilc; + + nic = netdev_priv(dev); + wilc = nic->wilc; + + spin_lock_irqsave(&wilc->txq_spinlock, flags); if (p->txq_head == NULL) { tqe->next = NULL; @@ -210,14 +217,14 @@ static void wilc_wlan_txq_add_to_tail(struct txq_entry_t *tqe) p->txq_entries += 1; PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", p->txq_entries); - spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags); + spin_unlock_irqrestore(&wilc->txq_spinlock, flags); /** * wake up TX queue **/ PRINT_D(TX_DBG, "Wake the txq_handling\n"); - up(&g_linux_wlan->txq_event); + up(&wilc->txq_event); } static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe) @@ -538,7 +545,7 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, if (is_TCP_ACK_Filter_Enabled()) tcp_process(dev, tqe); #endif - wilc_wlan_txq_add_to_tail(tqe); + wilc_wlan_txq_add_to_tail(dev, tqe); /*return number of itemes in the queue*/ return p->txq_entries; } @@ -566,7 +573,7 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, tqe->tcp_PendingAck_index = NOT_TCP_ACK; #endif PRINT_D(TX_DBG, "Adding Network packet at the Queue tail\n"); - wilc_wlan_txq_add_to_tail(tqe); + wilc_wlan_txq_add_to_tail(dev, tqe); return 1; } From 9bf3d7274516debe31e710a209e7d59ffc49d9c0 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Thu, 29 Oct 2015 12:18:46 +0900 Subject: [PATCH 183/843] staging: wilc1000: linux_wlan_start_firmware: change argument with dev This patch changes argument nic with dev and use netdev private data member wilc instead of g_linux_wlan, and pass dev to the function as well. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 79e59babc306..c9a64c14188a 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -569,10 +569,15 @@ _fail_: } -static int linux_wlan_start_firmware(perInterface_wlan_t *nic) +static int linux_wlan_start_firmware(struct net_device *dev) { - + perInterface_wlan_t *nic; + struct wilc *wilc; int ret = 0; + + nic = netdev_priv(dev); + wilc = nic->wilc; + /* start firmware */ PRINT_D(INIT_DBG, "Starting Firmware ...\n"); ret = wilc_wlan_start(); @@ -583,7 +588,7 @@ static int linux_wlan_start_firmware(perInterface_wlan_t *nic) /* wait for mac ready */ PRINT_D(INIT_DBG, "Waiting for Firmware to get ready ...\n"); - ret = linux_wlan_lock_timeout(&g_linux_wlan->sync_event, 5000); + ret = linux_wlan_lock_timeout(&wilc->sync_event, 5000); if (ret) { PRINT_D(INIT_DBG, "Firmware start timed out"); goto _fail_; @@ -1135,7 +1140,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) } /* Start firmware*/ - ret = linux_wlan_start_firmware(nic); + ret = linux_wlan_start_firmware(dev); if (ret < 0) { PRINT_ER("Failed to start firmware\n"); ret = -EIO; From 47a466f1d8569b7122bf782b19ee7ba35b2c8873 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Thu, 29 Oct 2015 12:18:47 +0900 Subject: [PATCH 184/843] staging: wilc1000: wilc_wlan_init: add argument struct net_device This patch adds an argument dev and pass dev to the function. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 2 +- drivers/staging/wilc1000/wilc_wlan.c | 2 +- drivers/staging/wilc1000/wilc_wlan_if.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index c9a64c14188a..fee8c61385b2 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1095,7 +1095,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) linux_to_wlan(&nwi, wl); - ret = wilc_wlan_init(&nwi); + ret = wilc_wlan_init(dev, &nwi); if (ret < 0) { PRINT_ER("Initializing WILC_Wlan FAILED\n"); ret = -EIO; diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 03593b7e50e2..5a480a123acd 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1951,7 +1951,7 @@ _fail_: return chipid; } -int wilc_wlan_init(wilc_wlan_inp_t *inp) +int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) { int ret = 0; diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index be972afe6e62..139cc6d38894 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -937,7 +937,7 @@ typedef enum { WID_MAX = 0xFFFF } WID_T; -int wilc_wlan_init(wilc_wlan_inp_t *inp); +int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp); void wilc_bus_set_max_speed(void); void wilc_bus_set_default_speed(void); From ae6f772ddf715599d5d23d498f368e389735aac5 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Thu, 29 Oct 2015 12:18:48 +0900 Subject: [PATCH 185/843] staging: wilc1000: wilc_wlan_init: add argument net_device This patch adds new argument struct net_device and pass the function dev. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 5a480a123acd..16224cefea79 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1870,7 +1870,7 @@ void wilc_bus_set_default_speed(void) /* Restore bus speed to default. */ g_wlan.hif_func.hif_set_default_bus_speed(); } -u32 init_chip(void) +u32 init_chip(struct net_device *dev) { u32 chipid; u32 reg, ret = 0; @@ -2028,7 +2028,7 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) } #endif - if (!init_chip()) { + if (!init_chip(dev)) { /* EIO 5 */ ret = -5; goto _fail_; From 65c8adcfd8740976eb471272741278989e4441fd Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Thu, 29 Oct 2015 12:18:49 +0900 Subject: [PATCH 186/843] staging: wilc1000: linux_wlan_get_firmware: change argument p_nic with dev This patch changes argument perInterface_wlan_t *p_nic with struct net_device *dev and use netdev private data nic and it's member wilc instead of g_linux_wlan. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 17 ++++++++++------- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 4 +--- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 + 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index fee8c61385b2..2103e8c0d6f9 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -517,14 +517,17 @@ void linux_wlan_rx_complete(void) PRINT_D(RX_DBG, "RX completed\n"); } -int linux_wlan_get_firmware(perInterface_wlan_t *p_nic) +int linux_wlan_get_firmware(struct net_device *dev) { - - perInterface_wlan_t *nic = p_nic; + perInterface_wlan_t *nic; + struct wilc *wilc; int ret = 0; const struct firmware *wilc_firmware; char *firmware; + nic = netdev_priv(dev); + wilc = nic->wilc; + if (nic->iftype == AP_MODE) firmware = AP_FIRMWARE; else if (nic->iftype == STATION_MODE) @@ -549,19 +552,19 @@ int linux_wlan_get_firmware(perInterface_wlan_t *p_nic) * root file system with the name specified above */ #ifdef WILC_SDIO - if (request_firmware(&wilc_firmware, firmware, &g_linux_wlan->wilc_sdio_func->dev) != 0) { + if (request_firmware(&wilc_firmware, firmware, &wilc->wilc_sdio_func->dev) != 0) { PRINT_ER("%s - firmare not available\n", firmware); ret = -1; goto _fail_; } #else - if (request_firmware(&wilc_firmware, firmware, &g_linux_wlan->wilc_spidev->dev) != 0) { + if (request_firmware(&wilc_firmware, firmware, &wilc->wilc_spidev->dev) != 0) { PRINT_ER("%s - firmare not available\n", firmware); ret = -1; goto _fail_; } #endif - g_linux_wlan->firmware = wilc_firmware; + wilc->firmware = wilc_firmware; _fail_: @@ -1125,7 +1128,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) } #endif - if (linux_wlan_get_firmware(nic)) { + if (linux_wlan_get_firmware(dev)) { PRINT_ER("Can't get firmware\n"); ret = -EIO; goto _fail_irq_enable_; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index cdcf134c314a..32b93d3f806d 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -21,8 +21,6 @@ #define IS_MGMT_STATUS_SUCCES 0x040 #define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff) -extern int linux_wlan_get_firmware(perInterface_wlan_t *p_nic); - extern int mac_open(struct net_device *ndev); extern int mac_close(struct net_device *ndev); @@ -2737,7 +2735,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, PRINT_D(CORECONFIG_DBG, "priv->hWILCWFIDrv[%p]\n", priv->hWILCWFIDrv); PRINT_D(HOSTAPD_DBG, "Downloading AP firmware\n"); - linux_wlan_get_firmware(nic); + linux_wlan_get_firmware(dev); /*If wilc is running, then close-open to actually get new firmware running (serves P2P)*/ if (wl->initialized) { nic->iftype = AP_MODE; diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 0bfe7626ad2d..0435cb571227 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -218,4 +218,5 @@ int wilc_netdev_init(struct wilc **wilc); void wilc1000_wlan_deinit(struct net_device *dev); void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size); u16 Set_machw_change_vir_if(struct net_device *dev, bool bValue); +int linux_wlan_get_firmware(struct net_device *dev); #endif From 90b984c8558ba6af99ca32931be5c1bb21c34271 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Thu, 29 Oct 2015 12:18:50 +0900 Subject: [PATCH 187/843] staging: wilc1000: wl_wlan_cleanup: add argument struct wilc This patch adds new argument struct wilc and use it instead of g_linux_wlan. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 28 +++++++++---------- drivers/staging/wilc1000/linux_wlan_sdio.c | 2 +- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 2103e8c0d6f9..09ddba2fb53a 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1651,39 +1651,39 @@ void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size) WILC_WFI_p2p_rx(wilc->vif[1].ndev, buff, size); } -void wl_wlan_cleanup(void) +void wl_wlan_cleanup(struct wilc *wilc) { int i = 0; perInterface_wlan_t *nic[NUM_CONCURRENT_IFC]; - if (g_linux_wlan && - (g_linux_wlan->vif[0].ndev || g_linux_wlan->vif[1].ndev)) { + if (wilc && + (wilc->vif[0].ndev || wilc->vif[1].ndev)) { unregister_inetaddr_notifier(&g_dev_notifier); for (i = 0; i < NUM_CONCURRENT_IFC; i++) - nic[i] = netdev_priv(g_linux_wlan->vif[i].ndev); + nic[i] = netdev_priv(wilc->vif[i].ndev); } - if (g_linux_wlan && g_linux_wlan->firmware) - release_firmware(g_linux_wlan->firmware); + if (wilc && wilc->firmware) + release_firmware(wilc->firmware); - if (g_linux_wlan && - (g_linux_wlan->vif[0].ndev || g_linux_wlan->vif[1].ndev)) { + if (wilc&& + (wilc->vif[0].ndev || wilc->vif[1].ndev)) { linux_wlan_lock_timeout(&close_exit_sync, 12 * 1000); for (i = 0; i < NUM_CONCURRENT_IFC; i++) - if (g_linux_wlan->vif[i].ndev) + if (wilc->vif[i].ndev) if (nic[i]->mac_opened) - mac_close(g_linux_wlan->vif[i].ndev); + mac_close(wilc->vif[i].ndev); for (i = 0; i < NUM_CONCURRENT_IFC; i++) { - unregister_netdev(g_linux_wlan->vif[i].ndev); - wilc_free_wiphy(g_linux_wlan->vif[i].ndev); - free_netdev(g_linux_wlan->vif[i].ndev); + unregister_netdev(wilc->vif[i].ndev); + wilc_free_wiphy(wilc->vif[i].ndev); + free_netdev(wilc->vif[i].ndev); } } - kfree(g_linux_wlan); + kfree(wilc); #if defined(WILC_DEBUGFS) wilc_debugfs_remove(); diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index 4aff953a88f1..bf05e227778c 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -146,7 +146,7 @@ static void linux_sdio_remove(struct sdio_func *func) struct wilc_sdio *wl_sdio; wl_sdio = sdio_get_drvdata(func); - wl_wlan_cleanup(); + wl_wlan_cleanup(wl_sdio->wilc); kfree(wl_sdio); } diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 0435cb571227..07917ea105b6 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -213,7 +213,7 @@ void linux_wlan_mac_indicate(struct wilc *wilc, int flag); void linux_wlan_rx_complete(void); void linux_wlan_dbg(u8 *buff); int linux_wlan_lock_timeout(void *vp, u32 timeout); -void wl_wlan_cleanup(void); +void wl_wlan_cleanup(struct wilc *wilc); int wilc_netdev_init(struct wilc **wilc); void wilc1000_wlan_deinit(struct net_device *dev); void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size); From 50327db7175a6109b8d35475c7735a30645751b0 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Tue, 3 Nov 2015 16:20:58 +0900 Subject: [PATCH 188/843] staging: wilc1000: change enum variable name with lower case This patch changes WID_TYPE with wid_type which is preferred style. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.h | 2 +- drivers/staging/wilc1000/wilc_wlan_if.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h index 6294d929a800..3253f6f1393a 100644 --- a/drivers/staging/wilc1000/coreconfigurator.h +++ b/drivers/staging/wilc1000/coreconfigurator.h @@ -72,7 +72,7 @@ typedef enum { struct wid { u16 id; - enum WID_TYPE type; + enum wid_type type; s32 size; s8 *val; }; diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index 139cc6d38894..f11003d14486 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -315,7 +315,7 @@ typedef enum { SW_TRIGGER_ABORT, } TX_ABORT_OPTION_T; -enum WID_TYPE { +enum wid_type { WID_CHAR = 0, WID_SHORT = 1, WID_INT = 2, From 30cbaa7f17e5c55b4e28274c9896d6fb4fec3f90 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Tue, 3 Nov 2015 16:21:01 +0900 Subject: [PATCH 189/843] staging: wilc1000: send_config_pkt: remove unnecessary blank line This patch remove unnecessary blank line which is reported by checkpatch.pl Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index e10c6ffa698a..fd7240c9da3e 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -609,7 +609,6 @@ s32 send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv) wids[counter].id, wids[counter].val, wids[counter].size); - } } else if (mode == SET_CFG) { for (counter = 0; counter < count; counter++) { From a6527c3b36957d180f4ae2594bbae8ea3ef02bca Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:02 +0900 Subject: [PATCH 190/843] staging: wilc1000: rename pu8IPAddr of fuction Handle_set_IPAddress This patch renames pu8IPAddr of fuction Handle_set_IPAddress to ip_addr to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 17826f3d4407..b1d8b17fc461 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -397,22 +397,23 @@ static s32 Handle_SetOperationMode(struct host_if_drv *hif_drv, return result; } -s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx) +s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *ip_addr, u8 idx) { s32 result = 0; struct wid wid; char firmwareIPAddress[4] = {0}; - if (pu8IPAddr[0] < 192) - pu8IPAddr[0] = 0; + if (ip_addr[0] < 192) + ip_addr[0] = 0; - PRINT_INFO(HOSTINF_DBG, "Indx = %d, Handling set IP = %pI4\n", idx, pu8IPAddr); + PRINT_INFO(HOSTINF_DBG, "Indx = %d, Handling set IP = %pI4\n", + idx, ip_addr); - memcpy(set_ip[idx], pu8IPAddr, IP_ALEN); + memcpy(set_ip[idx], ip_addr, IP_ALEN); wid.id = (u16)WID_IP_ADDRESS; wid.type = WID_STR; - wid.val = (u8 *)pu8IPAddr; + wid.val = (u8 *)ip_addr; wid.size = IP_ALEN; result = send_config_pkt(SET_CFG, &wid, 1, From ebc57d194fc7aca973055b0b38a3b7f52df6ad78 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:03 +0900 Subject: [PATCH 191/843] staging: wilc1000: rename firmwareIPAddress of fuction Handle_set_IPAddress This patch renames firmwareIPAddress of fuction Handle_set_IPAddress to firmware_ip_addr to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index b1d8b17fc461..4ad0dd088922 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -401,7 +401,7 @@ s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *ip_addr, u8 idx) { s32 result = 0; struct wid wid; - char firmwareIPAddress[4] = {0}; + char firmware_ip_addr[4] = {0}; if (ip_addr[0] < 192) ip_addr[0] = 0; @@ -419,7 +419,7 @@ s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *ip_addr, u8 idx) result = send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); - host_int_get_ipaddress(hif_drv, firmwareIPAddress, idx); + host_int_get_ipaddress(hif_drv, firmware_ip_addr, idx); if (result) { PRINT_ER("Failed to set IP address\n"); From c033cdafb73286fdce714a69daace81ec5ff8558 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:04 +0900 Subject: [PATCH 192/843] staging: wilc1000: remove unused parameter of fuction Handle_get_IPAddress This patch removes parameter pu8IPAddr of fuction Handle_get_IPAddress because it is not used in the function. Remove argument in the function call also. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 4ad0dd088922..463b86f4bfc6 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -431,7 +431,7 @@ s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *ip_addr, u8 idx) return result; } -s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx) +s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 idx) { s32 result = 0; struct wid wid; @@ -2974,7 +2974,7 @@ static int hostIFthread(void *pvArg) case HOST_IF_MSG_GET_IPADDRESS: PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); - Handle_get_IPAddress(msg.drv, msg.body.ip_info.ip_addr, msg.body.ip_info.idx); + Handle_get_IPAddress(msg.drv, msg.body.ip_info.idx); break; case HOST_IF_MSG_SET_MAC_ADDRESS: From 090dbb10149b17869b7a7740e59a0d5c4832348c Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:05 +0900 Subject: [PATCH 193/843] staging: wilc1000: rename pstrHostIfSetMacAddress of fuction Handle_SetMacAddress This patch renames pstrHostIfSetMacAddress of fuction Handle_SetMacAddress to set_mac_addr to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 463b86f4bfc6..35e94609e6cf 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -466,7 +466,7 @@ s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 idx) } static s32 Handle_SetMacAddress(struct host_if_drv *hif_drv, - struct set_mac_addr *pstrHostIfSetMacAddress) + struct set_mac_addr *set_mac_addr) { s32 result = 0; struct wid wid; @@ -476,7 +476,7 @@ static s32 Handle_SetMacAddress(struct host_if_drv *hif_drv, PRINT_ER("No buffer to send mac address\n"); return -EFAULT; } - memcpy(mac_buf, pstrHostIfSetMacAddress->mac_addr, ETH_ALEN); + memcpy(mac_buf, set_mac_addr->mac_addr, ETH_ALEN); wid.id = (u16)WID_MAC_ADDR; wid.type = WID_STR; From 7f0ee9a69ef207ba0a0bd381620eb89bd92d9fe5 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:06 +0900 Subject: [PATCH 194/843] staging: wilc1000: rename pstrHostIfGetMacAddress of fuction Handle_GetMacAddress This patch renames pstrHostIfGetMacAddress of fuction Handle_GetMacAddress to get_mac_addr to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 35e94609e6cf..06994fb91d15 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -496,14 +496,14 @@ static s32 Handle_SetMacAddress(struct host_if_drv *hif_drv, } static s32 Handle_GetMacAddress(struct host_if_drv *hif_drv, - struct get_mac_addr *pstrHostIfGetMacAddress) + struct get_mac_addr *get_mac_addr) { s32 result = 0; struct wid wid; wid.id = (u16)WID_MAC_ADDR; wid.type = WID_STR; - wid.val = pstrHostIfGetMacAddress->mac_addr; + wid.val = get_mac_addr->mac_addr; wid.size = ETH_ALEN; result = send_config_pkt(GET_CFG, &wid, 1, From 02ae2bdfe1400b00586f0dc439b318b17119027d Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:07 +0900 Subject: [PATCH 195/843] staging: wilc1000: rename strHostIFCfgParamAttr of fuction Handle_CfgParam This patch renames strHostIFCfgParamAttr of fuction Handle_CfgParam to cfg_param_attr to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 154 ++++++++++++---------- 1 file changed, 83 insertions(+), 71 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 06994fb91d15..9b986bb0f16c 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -519,7 +519,7 @@ static s32 Handle_GetMacAddress(struct host_if_drv *hif_drv, } static s32 Handle_CfgParam(struct host_if_drv *hif_drv, - struct cfg_param_attr *strHostIFCfgParamAttr) + struct cfg_param_attr *cfg_param_attr) { s32 result = 0; struct wid strWIDList[32]; @@ -529,13 +529,13 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, PRINT_D(HOSTINF_DBG, "Setting CFG params\n"); - if (strHostIFCfgParamAttr->cfg_attr_info.flag & BSS_TYPE) { - if (strHostIFCfgParamAttr->cfg_attr_info.bss_type < 6) { + if (cfg_param_attr->cfg_attr_info.flag & BSS_TYPE) { + if (cfg_param_attr->cfg_attr_info.bss_type < 6) { strWIDList[u8WidCnt].id = WID_BSS_TYPE; - strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.bss_type; + strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.bss_type; strWIDList[u8WidCnt].type = WID_CHAR; strWIDList[u8WidCnt].size = sizeof(char); - hif_drv->cfg_values.bss_type = (u8)strHostIFCfgParamAttr->cfg_attr_info.bss_type; + hif_drv->cfg_values.bss_type = (u8)cfg_param_attr->cfg_attr_info.bss_type; } else { PRINT_ER("check value 6 over\n"); result = -EINVAL; @@ -543,13 +543,15 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, } u8WidCnt++; } - if (strHostIFCfgParamAttr->cfg_attr_info.flag & AUTH_TYPE) { - if ((strHostIFCfgParamAttr->cfg_attr_info.auth_type) == 1 || (strHostIFCfgParamAttr->cfg_attr_info.auth_type) == 2 || (strHostIFCfgParamAttr->cfg_attr_info.auth_type) == 5) { + if (cfg_param_attr->cfg_attr_info.flag & AUTH_TYPE) { + if (cfg_param_attr->cfg_attr_info.auth_type == 1 || + cfg_param_attr->cfg_attr_info.auth_type == 2 || + cfg_param_attr->cfg_attr_info.auth_type == 5) { strWIDList[u8WidCnt].id = WID_AUTH_TYPE; - strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.auth_type; + strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.auth_type; strWIDList[u8WidCnt].type = WID_CHAR; strWIDList[u8WidCnt].size = sizeof(char); - hif_drv->cfg_values.auth_type = (u8)strHostIFCfgParamAttr->cfg_attr_info.auth_type; + hif_drv->cfg_values.auth_type = (u8)cfg_param_attr->cfg_attr_info.auth_type; } else { PRINT_ER("Impossible value \n"); result = -EINVAL; @@ -557,13 +559,14 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, } u8WidCnt++; } - if (strHostIFCfgParamAttr->cfg_attr_info.flag & AUTHEN_TIMEOUT) { - if (strHostIFCfgParamAttr->cfg_attr_info.auth_timeout > 0 && strHostIFCfgParamAttr->cfg_attr_info.auth_timeout < 65536) { + if (cfg_param_attr->cfg_attr_info.flag & AUTHEN_TIMEOUT) { + if (cfg_param_attr->cfg_attr_info.auth_timeout > 0 && + cfg_param_attr->cfg_attr_info.auth_timeout < 65536) { strWIDList[u8WidCnt].id = WID_AUTH_TIMEOUT; - strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.auth_timeout; + strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.auth_timeout; strWIDList[u8WidCnt].type = WID_SHORT; strWIDList[u8WidCnt].size = sizeof(u16); - hif_drv->cfg_values.auth_timeout = strHostIFCfgParamAttr->cfg_attr_info.auth_timeout; + hif_drv->cfg_values.auth_timeout = cfg_param_attr->cfg_attr_info.auth_timeout; } else { PRINT_ER("Range(1 ~ 65535) over\n"); result = -EINVAL; @@ -571,13 +574,13 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, } u8WidCnt++; } - if (strHostIFCfgParamAttr->cfg_attr_info.flag & POWER_MANAGEMENT) { - if (strHostIFCfgParamAttr->cfg_attr_info.power_mgmt_mode < 5) { + if (cfg_param_attr->cfg_attr_info.flag & POWER_MANAGEMENT) { + if (cfg_param_attr->cfg_attr_info.power_mgmt_mode < 5) { strWIDList[u8WidCnt].id = WID_POWER_MANAGEMENT; - strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.power_mgmt_mode; + strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.power_mgmt_mode; strWIDList[u8WidCnt].type = WID_CHAR; strWIDList[u8WidCnt].size = sizeof(char); - hif_drv->cfg_values.power_mgmt_mode = (u8)strHostIFCfgParamAttr->cfg_attr_info.power_mgmt_mode; + hif_drv->cfg_values.power_mgmt_mode = (u8)cfg_param_attr->cfg_attr_info.power_mgmt_mode; } else { PRINT_ER("Invalide power mode\n"); result = -EINVAL; @@ -585,13 +588,14 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, } u8WidCnt++; } - if (strHostIFCfgParamAttr->cfg_attr_info.flag & RETRY_SHORT) { - if ((strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit > 0) && (strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit < 256)) { + if (cfg_param_attr->cfg_attr_info.flag & RETRY_SHORT) { + if (cfg_param_attr->cfg_attr_info.short_retry_limit > 0 && + cfg_param_attr->cfg_attr_info.short_retry_limit < 256) { strWIDList[u8WidCnt].id = WID_SHORT_RETRY_LIMIT; - strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit; + strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.short_retry_limit; strWIDList[u8WidCnt].type = WID_SHORT; strWIDList[u8WidCnt].size = sizeof(u16); - hif_drv->cfg_values.short_retry_limit = strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit; + hif_drv->cfg_values.short_retry_limit = cfg_param_attr->cfg_attr_info.short_retry_limit; } else { PRINT_ER("Range(1~256) over\n"); result = -EINVAL; @@ -599,14 +603,15 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, } u8WidCnt++; } - if (strHostIFCfgParamAttr->cfg_attr_info.flag & RETRY_LONG) { - if ((strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit > 0) && (strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit < 256)) { + if (cfg_param_attr->cfg_attr_info.flag & RETRY_LONG) { + if (cfg_param_attr->cfg_attr_info.long_retry_limit > 0 && + cfg_param_attr->cfg_attr_info.long_retry_limit < 256) { strWIDList[u8WidCnt].id = WID_LONG_RETRY_LIMIT; - strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit; + strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.long_retry_limit; strWIDList[u8WidCnt].type = WID_SHORT; strWIDList[u8WidCnt].size = sizeof(u16); - hif_drv->cfg_values.long_retry_limit = strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit; + hif_drv->cfg_values.long_retry_limit = cfg_param_attr->cfg_attr_info.long_retry_limit; } else { PRINT_ER("Range(1~256) over\n"); result = -EINVAL; @@ -614,13 +619,14 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, } u8WidCnt++; } - if (strHostIFCfgParamAttr->cfg_attr_info.flag & FRAG_THRESHOLD) { - if (strHostIFCfgParamAttr->cfg_attr_info.frag_threshold > 255 && strHostIFCfgParamAttr->cfg_attr_info.frag_threshold < 7937) { + if (cfg_param_attr->cfg_attr_info.flag & FRAG_THRESHOLD) { + if (cfg_param_attr->cfg_attr_info.frag_threshold > 255 && + cfg_param_attr->cfg_attr_info.frag_threshold < 7937) { strWIDList[u8WidCnt].id = WID_FRAG_THRESHOLD; - strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.frag_threshold; + strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.frag_threshold; strWIDList[u8WidCnt].type = WID_SHORT; strWIDList[u8WidCnt].size = sizeof(u16); - hif_drv->cfg_values.frag_threshold = strHostIFCfgParamAttr->cfg_attr_info.frag_threshold; + hif_drv->cfg_values.frag_threshold = cfg_param_attr->cfg_attr_info.frag_threshold; } else { PRINT_ER("Threshold Range fail\n"); result = -EINVAL; @@ -628,13 +634,14 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, } u8WidCnt++; } - if (strHostIFCfgParamAttr->cfg_attr_info.flag & RTS_THRESHOLD) { - if (strHostIFCfgParamAttr->cfg_attr_info.rts_threshold > 255 && strHostIFCfgParamAttr->cfg_attr_info.rts_threshold < 65536) { + if (cfg_param_attr->cfg_attr_info.flag & RTS_THRESHOLD) { + if (cfg_param_attr->cfg_attr_info.rts_threshold > 255 && + cfg_param_attr->cfg_attr_info.rts_threshold < 65536) { strWIDList[u8WidCnt].id = WID_RTS_THRESHOLD; - strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.rts_threshold; + strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.rts_threshold; strWIDList[u8WidCnt].type = WID_SHORT; strWIDList[u8WidCnt].size = sizeof(u16); - hif_drv->cfg_values.rts_threshold = strHostIFCfgParamAttr->cfg_attr_info.rts_threshold; + hif_drv->cfg_values.rts_threshold = cfg_param_attr->cfg_attr_info.rts_threshold; } else { PRINT_ER("Threshold Range fail\n"); result = -EINVAL; @@ -642,13 +649,13 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, } u8WidCnt++; } - if (strHostIFCfgParamAttr->cfg_attr_info.flag & PREAMBLE) { - if (strHostIFCfgParamAttr->cfg_attr_info.preamble_type < 3) { + if (cfg_param_attr->cfg_attr_info.flag & PREAMBLE) { + if (cfg_param_attr->cfg_attr_info.preamble_type < 3) { strWIDList[u8WidCnt].id = WID_PREAMBLE; - strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.preamble_type; + strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.preamble_type; strWIDList[u8WidCnt].type = WID_CHAR; strWIDList[u8WidCnt].size = sizeof(char); - hif_drv->cfg_values.preamble_type = strHostIFCfgParamAttr->cfg_attr_info.preamble_type; + hif_drv->cfg_values.preamble_type = cfg_param_attr->cfg_attr_info.preamble_type; } else { PRINT_ER("Preamle Range(0~2) over\n"); result = -EINVAL; @@ -656,13 +663,13 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, } u8WidCnt++; } - if (strHostIFCfgParamAttr->cfg_attr_info.flag & SHORT_SLOT_ALLOWED) { - if (strHostIFCfgParamAttr->cfg_attr_info.short_slot_allowed < 2) { + if (cfg_param_attr->cfg_attr_info.flag & SHORT_SLOT_ALLOWED) { + if (cfg_param_attr->cfg_attr_info.short_slot_allowed < 2) { strWIDList[u8WidCnt].id = WID_SHORT_SLOT_ALLOWED; - strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.short_slot_allowed; + strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.short_slot_allowed; strWIDList[u8WidCnt].type = WID_CHAR; strWIDList[u8WidCnt].size = sizeof(char); - hif_drv->cfg_values.short_slot_allowed = (u8)strHostIFCfgParamAttr->cfg_attr_info.short_slot_allowed; + hif_drv->cfg_values.short_slot_allowed = (u8)cfg_param_attr->cfg_attr_info.short_slot_allowed; } else { PRINT_ER("Short slot(2) over\n"); result = -EINVAL; @@ -670,13 +677,13 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, } u8WidCnt++; } - if (strHostIFCfgParamAttr->cfg_attr_info.flag & TXOP_PROT_DISABLE) { - if (strHostIFCfgParamAttr->cfg_attr_info.txop_prot_disabled < 2) { + if (cfg_param_attr->cfg_attr_info.flag & TXOP_PROT_DISABLE) { + if (cfg_param_attr->cfg_attr_info.txop_prot_disabled < 2) { strWIDList[u8WidCnt].id = WID_11N_TXOP_PROT_DISABLE; - strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.txop_prot_disabled; + strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.txop_prot_disabled; strWIDList[u8WidCnt].type = WID_CHAR; strWIDList[u8WidCnt].size = sizeof(char); - hif_drv->cfg_values.txop_prot_disabled = (u8)strHostIFCfgParamAttr->cfg_attr_info.txop_prot_disabled; + hif_drv->cfg_values.txop_prot_disabled = (u8)cfg_param_attr->cfg_attr_info.txop_prot_disabled; } else { PRINT_ER("TXOP prot disable\n"); result = -EINVAL; @@ -684,13 +691,14 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, } u8WidCnt++; } - if (strHostIFCfgParamAttr->cfg_attr_info.flag & BEACON_INTERVAL) { - if (strHostIFCfgParamAttr->cfg_attr_info.beacon_interval > 0 && strHostIFCfgParamAttr->cfg_attr_info.beacon_interval < 65536) { + if (cfg_param_attr->cfg_attr_info.flag & BEACON_INTERVAL) { + if (cfg_param_attr->cfg_attr_info.beacon_interval > 0 && + cfg_param_attr->cfg_attr_info.beacon_interval < 65536) { strWIDList[u8WidCnt].id = WID_BEACON_INTERVAL; - strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.beacon_interval; + strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.beacon_interval; strWIDList[u8WidCnt].type = WID_SHORT; strWIDList[u8WidCnt].size = sizeof(u16); - hif_drv->cfg_values.beacon_interval = strHostIFCfgParamAttr->cfg_attr_info.beacon_interval; + hif_drv->cfg_values.beacon_interval = cfg_param_attr->cfg_attr_info.beacon_interval; } else { PRINT_ER("Beacon interval(1~65535) fail\n"); result = -EINVAL; @@ -698,13 +706,14 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, } u8WidCnt++; } - if (strHostIFCfgParamAttr->cfg_attr_info.flag & DTIM_PERIOD) { - if (strHostIFCfgParamAttr->cfg_attr_info.dtim_period > 0 && strHostIFCfgParamAttr->cfg_attr_info.dtim_period < 256) { + if (cfg_param_attr->cfg_attr_info.flag & DTIM_PERIOD) { + if (cfg_param_attr->cfg_attr_info.dtim_period > 0 && + cfg_param_attr->cfg_attr_info.dtim_period < 256) { strWIDList[u8WidCnt].id = WID_DTIM_PERIOD; - strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.dtim_period; + strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.dtim_period; strWIDList[u8WidCnt].type = WID_CHAR; strWIDList[u8WidCnt].size = sizeof(char); - hif_drv->cfg_values.dtim_period = strHostIFCfgParamAttr->cfg_attr_info.dtim_period; + hif_drv->cfg_values.dtim_period = cfg_param_attr->cfg_attr_info.dtim_period; } else { PRINT_ER("DTIM range(1~255) fail\n"); result = -EINVAL; @@ -712,13 +721,13 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, } u8WidCnt++; } - if (strHostIFCfgParamAttr->cfg_attr_info.flag & SITE_SURVEY) { - if (strHostIFCfgParamAttr->cfg_attr_info.site_survey_enabled < 3) { + if (cfg_param_attr->cfg_attr_info.flag & SITE_SURVEY) { + if (cfg_param_attr->cfg_attr_info.site_survey_enabled < 3) { strWIDList[u8WidCnt].id = WID_SITE_SURVEY; - strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.site_survey_enabled; + strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.site_survey_enabled; strWIDList[u8WidCnt].type = WID_CHAR; strWIDList[u8WidCnt].size = sizeof(char); - hif_drv->cfg_values.site_survey_enabled = (u8)strHostIFCfgParamAttr->cfg_attr_info.site_survey_enabled; + hif_drv->cfg_values.site_survey_enabled = (u8)cfg_param_attr->cfg_attr_info.site_survey_enabled; } else { PRINT_ER("Site survey disable\n"); result = -EINVAL; @@ -726,13 +735,14 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, } u8WidCnt++; } - if (strHostIFCfgParamAttr->cfg_attr_info.flag & SITE_SURVEY_SCAN_TIME) { - if (strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time > 0 && strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time < 65536) { + if (cfg_param_attr->cfg_attr_info.flag & SITE_SURVEY_SCAN_TIME) { + if (cfg_param_attr->cfg_attr_info.site_survey_scan_time > 0 && + cfg_param_attr->cfg_attr_info.site_survey_scan_time < 65536) { strWIDList[u8WidCnt].id = WID_SITE_SURVEY_SCAN_TIME; - strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time; + strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.site_survey_scan_time; strWIDList[u8WidCnt].type = WID_SHORT; strWIDList[u8WidCnt].size = sizeof(u16); - hif_drv->cfg_values.site_survey_scan_time = strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time; + hif_drv->cfg_values.site_survey_scan_time = cfg_param_attr->cfg_attr_info.site_survey_scan_time; } else { PRINT_ER("Site survey scan time(1~65535) over\n"); result = -EINVAL; @@ -740,13 +750,14 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, } u8WidCnt++; } - if (strHostIFCfgParamAttr->cfg_attr_info.flag & ACTIVE_SCANTIME) { - if (strHostIFCfgParamAttr->cfg_attr_info.active_scan_time > 0 && strHostIFCfgParamAttr->cfg_attr_info.active_scan_time < 65536) { + if (cfg_param_attr->cfg_attr_info.flag & ACTIVE_SCANTIME) { + if (cfg_param_attr->cfg_attr_info.active_scan_time > 0 && + cfg_param_attr->cfg_attr_info.active_scan_time < 65536) { strWIDList[u8WidCnt].id = WID_ACTIVE_SCAN_TIME; - strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.active_scan_time; + strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.active_scan_time; strWIDList[u8WidCnt].type = WID_SHORT; strWIDList[u8WidCnt].size = sizeof(u16); - hif_drv->cfg_values.active_scan_time = strHostIFCfgParamAttr->cfg_attr_info.active_scan_time; + hif_drv->cfg_values.active_scan_time = cfg_param_attr->cfg_attr_info.active_scan_time; } else { PRINT_ER("Active scan time(1~65535) over\n"); result = -EINVAL; @@ -754,13 +765,14 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, } u8WidCnt++; } - if (strHostIFCfgParamAttr->cfg_attr_info.flag & PASSIVE_SCANTIME) { - if (strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time > 0 && strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time < 65536) { + if (cfg_param_attr->cfg_attr_info.flag & PASSIVE_SCANTIME) { + if (cfg_param_attr->cfg_attr_info.passive_scan_time > 0 && + cfg_param_attr->cfg_attr_info.passive_scan_time < 65536) { strWIDList[u8WidCnt].id = WID_PASSIVE_SCAN_TIME; - strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time; + strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.passive_scan_time; strWIDList[u8WidCnt].type = WID_SHORT; strWIDList[u8WidCnt].size = sizeof(u16); - hif_drv->cfg_values.passive_scan_time = strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time; + hif_drv->cfg_values.passive_scan_time = cfg_param_attr->cfg_attr_info.passive_scan_time; } else { PRINT_ER("Passive scan time(1~65535) over\n"); result = -EINVAL; @@ -768,8 +780,8 @@ static s32 Handle_CfgParam(struct host_if_drv *hif_drv, } u8WidCnt++; } - if (strHostIFCfgParamAttr->cfg_attr_info.flag & CURRENT_TX_RATE) { - enum CURRENT_TXRATE curr_tx_rate = strHostIFCfgParamAttr->cfg_attr_info.curr_tx_rate; + if (cfg_param_attr->cfg_attr_info.flag & CURRENT_TX_RATE) { + enum CURRENT_TXRATE curr_tx_rate = cfg_param_attr->cfg_attr_info.curr_tx_rate; if (curr_tx_rate == AUTORATE || curr_tx_rate == MBPS_1 || curr_tx_rate == MBPS_2 || curr_tx_rate == MBPS_5_5 From 3b840e494910df8150beea57d0c56a9720eb4eac Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:08 +0900 Subject: [PATCH 196/843] staging: wilc1000: remove return type of Handle_wait_msg_q_empty This patch changes return type of Handle_wait_msg_q_empty from s32 with void because return value is not used. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 9b986bb0f16c..8494a032eb72 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -813,11 +813,10 @@ ERRORHANDLER: return result; } -static s32 Handle_wait_msg_q_empty(void) +static void Handle_wait_msg_q_empty(void) { g_wilc_initialized = 0; up(&hif_sema_wait_response); - return 0; } static s32 Handle_Scan(struct host_if_drv *hif_drv, From fb70e9f5bd4b9d00e6a3e3946a9ed46bb4babd8c Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:09 +0900 Subject: [PATCH 197/843] staging: wilc1000: rename gau8MulticastMacAddrList variable This patch renames gau8MulticastMacAddrList variable to multicast_mac_addr_list to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 5 +++-- drivers/staging/wilc1000/linux_wlan.c | 11 ++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 8494a032eb72..d0e4039e6ed1 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -243,7 +243,7 @@ static struct semaphore hif_sema_wait_response; static struct semaphore hif_sema_deinit; static struct timer_list periodic_rssi; -u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; +u8 multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; static u8 rcv_assoc_resp[MAX_ASSOC_RESP_FRAME_SIZE]; @@ -2713,7 +2713,8 @@ static void Handle_SetMulticastFilter(struct host_if_drv *hif_drv, *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 24) & 0xFF); if ((strHostIfSetMulti->cnt) > 0) - memcpy(pu8CurrByte, gau8MulticastMacAddrList, ((strHostIfSetMulti->cnt) * ETH_ALEN)); + memcpy(pu8CurrByte, multicast_mac_addr_list, + ((strHostIfSetMulti->cnt) * ETH_ALEN)); result = send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 09ddba2fb53a..1e14e97f6cba 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -46,7 +46,7 @@ extern bool g_obtainingIP; extern void resolve_disconnect_aberration(void *drvHandler); -extern u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; +extern u8 multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; extern struct timer_list hDuringIpTimer; static int linux_wlan_device_power(int on_off) @@ -1343,9 +1343,14 @@ static void wilc_set_multicast_list(struct net_device *dev) /* Store all of the multicast addresses in the hardware filter */ netdev_for_each_mc_addr(ha, dev) { - memcpy(gau8MulticastMacAddrList[i], ha->addr, ETH_ALEN); + memcpy(multicast_mac_addr_list[i], ha->addr, ETH_ALEN); PRINT_D(INIT_DBG, "Entry[%d]: %x:%x:%x:%x:%x:%x\n", i, - gau8MulticastMacAddrList[i][0], gau8MulticastMacAddrList[i][1], gau8MulticastMacAddrList[i][2], gau8MulticastMacAddrList[i][3], gau8MulticastMacAddrList[i][4], gau8MulticastMacAddrList[i][5]); + multicast_mac_addr_list[i][0], + multicast_mac_addr_list[i][1], + multicast_mac_addr_list[i][2], + multicast_mac_addr_list[i][3], + multicast_mac_addr_list[i][4], + multicast_mac_addr_list[i][5]); i++; } From 3a147c07ca4c2048eb9861def7253cd21bf21d77 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:10 +0900 Subject: [PATCH 198/843] staging: wilc1000: replace explicit NULL comparisons with ! This patch replace explicit NULL comparison with ! or unmark operator to simplify code. Reported by checkpatch.pl for comparison to NULL could be written "!XXX" or "XXX". Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 45 ++++++++++++++------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 1e14e97f6cba..d50f0d6a15cd 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -136,7 +136,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event u8 null_ip[4] = {0}; char wlan_dev_name[5] = "wlan0"; - if (dev_iface == NULL || dev_iface->ifa_dev == NULL || dev_iface->ifa_dev->dev == NULL) { + if (!dev_iface || !dev_iface->ifa_dev || !dev_iface->ifa_dev->dev) { PRINT_D(GENERIC_DBG, "dev_iface = NULL\n"); return NOTIFY_DONE; } @@ -147,18 +147,18 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event } dev = (struct net_device *)dev_iface->ifa_dev->dev; - if (dev->ieee80211_ptr == NULL || dev->ieee80211_ptr->wiphy == NULL) { + if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy) { PRINT_D(GENERIC_DBG, "No Wireless registerd\n"); return NOTIFY_DONE; } priv = wiphy_priv(dev->ieee80211_ptr->wiphy); - if (priv == NULL) { + if (!priv) { PRINT_D(GENERIC_DBG, "No Wireless Priv\n"); return NOTIFY_DONE; } pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv; nic = netdev_priv(dev); - if (nic == NULL || pstrWFIDrv == NULL) { + if (!nic || !pstrWFIDrv) { PRINT_D(GENERIC_DBG, "No Wireless Priv\n"); return NOTIFY_DONE; } @@ -339,7 +339,7 @@ int linux_wlan_lock_timeout(void *vp, u32 timeout) int error = -1; PRINT_D(LOCK_DBG, "Locking %p\n", vp); - if (vp != NULL) + if (vp) error = down_timeout((struct semaphore *)vp, msecs_to_jiffies(timeout)); else PRINT_ER("Failed, mutex is NULL\n"); @@ -538,12 +538,12 @@ int linux_wlan_get_firmware(struct net_device *dev) firmware = P2P_CONCURRENCY_FIRMWARE; } - if (nic == NULL) { + if (!nic) { PRINT_ER("NIC is NULL\n"); goto _fail_; } - if (&nic->wilc_netdev->dev == NULL) { + if (!(&nic->wilc_netdev->dev)) { PRINT_ER("&nic->wilc_netdev->dev is NULL\n"); goto _fail_; } @@ -925,7 +925,7 @@ void wilc1000_wlan_deinit(struct net_device *dev) disable_sdio_interrupt(); mutex_unlock(&wl->hif_cs); #endif - if (&wl->txq_event != NULL) + if (&wl->txq_event) up(&wl->txq_event); PRINT_D(INIT_DBG, "Deinitializing Threads\n"); @@ -998,10 +998,10 @@ static int wlan_deinit_locks(struct net_device *dev) PRINT_D(INIT_DBG, "De-Initializing Locks\n"); - if (&wilc->hif_cs != NULL) + if (&wilc->hif_cs) mutex_destroy(&wilc->hif_cs); - if (&wilc->rxq_cs != NULL) + if (&wilc->rxq_cs) mutex_destroy(&wilc->rxq_cs); return 0; @@ -1074,10 +1074,10 @@ static void wlan_deinitialize_threads(struct net_device *dev) wl->close = 1; PRINT_D(INIT_DBG, "Deinitializing Threads\n"); - if (&wl->txq_event != NULL) + if (&wl->txq_event) up(&wl->txq_event); - if (wl->txq_thread != NULL) { + if (wl->txq_thread) { kthread_stop(wl->txq_thread); wl->txq_thread = NULL; } @@ -1396,7 +1396,7 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev) } tx_data = kmalloc(sizeof(struct tx_complete_data), GFP_ATOMIC); - if (tx_data == NULL) { + if (!tx_data) { PRINT_ER("Failed to allocate memory for tx_data structure\n"); dev_kfree_skb(skb); netif_wake_queue(ndev); @@ -1450,7 +1450,8 @@ int mac_close(struct net_device *ndev) nic = netdev_priv(ndev); - if ((nic == NULL) || (nic->wilc_netdev == NULL) || (nic->wilc_netdev->ieee80211_ptr == NULL) || (nic->wilc_netdev->ieee80211_ptr->wiphy == NULL)) { + if (!nic || !nic->wilc_netdev || !nic->wilc_netdev->ieee80211_ptr || + !nic->wilc_netdev->ieee80211_ptr->wiphy) { PRINT_ER("nic = NULL\n"); return 0; } @@ -1458,7 +1459,7 @@ int mac_close(struct net_device *ndev) priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy); wl = nic->wilc; - if (priv == NULL) { + if (!priv) { PRINT_ER("priv = NULL\n"); return 0; } @@ -1472,7 +1473,7 @@ int mac_close(struct net_device *ndev) return 0; } - if (pstrWFIDrv == NULL) { + if (!pstrWFIDrv) { PRINT_ER("pstrWFIDrv = NULL\n"); return 0; } @@ -1484,7 +1485,7 @@ int mac_close(struct net_device *ndev) return 0; } - if (nic->wilc_netdev != NULL) { + if (nic->wilc_netdev) { /* Stop the network interface queue */ netif_stop_queue(nic->wilc_netdev); @@ -1585,7 +1586,7 @@ void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset) perInterface_wlan_t *nic; wilc_netdev = GetIfHandler(wilc, buff); - if (wilc_netdev == NULL) + if (!wilc_netdev) return; buff += pkt_offset; @@ -1598,16 +1599,16 @@ void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset) /* Need to send the packet up to the host, allocate a skb buffer */ skb = dev_alloc_skb(frame_len); - if (skb == NULL) { + if (!skb) { PRINT_ER("Low memory - packet droped\n"); return; } - if (wilc == NULL || wilc_netdev == NULL) + if (!wilc || !wilc_netdev) PRINT_ER("wilc_netdev in wilc is NULL"); skb->dev = wilc_netdev; - if (skb->dev == NULL) + if (!skb->dev) PRINT_ER("skb->dev is NULL\n"); /* @@ -1754,7 +1755,7 @@ int wilc_netdev_init(struct wilc **wilc) SET_NETDEV_DEV(ndev, &local_sdio_func->dev); #endif - if (wdev == NULL) { + if (!wdev) { PRINT_ER("Can't register WILC Wiphy\n"); return -1; } From 682d7c95f8cff2f03839e0d0e66f93af3b621f67 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:11 +0900 Subject: [PATCH 199/843] staging: wilc1000: linux_wlan: remove unused define CUSTOMER_PLATFORM This patch remove unused define CUSTOMER_PLATFORM from linux_wlan.c. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index d50f0d6a15cd..a9052ed01339 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -31,18 +31,11 @@ #include "linux_wlan_spi.h" #endif -#if defined(CUSTOMER_PLATFORM) -/* - TODO : Write power control functions as customer platform. - */ -#else - #define _linux_wlan_device_power_on() {} #define _linux_wlan_device_power_off() {} #define _linux_wlan_device_detection() {} #define _linux_wlan_device_removal() {} -#endif extern bool g_obtainingIP; extern void resolve_disconnect_aberration(void *drvHandler); @@ -278,15 +271,7 @@ static int init_irq(struct net_device *dev) /*GPIO request*/ if ((gpio_request(GPIO_NUM, "WILC_INTR") == 0) && (gpio_direction_input(GPIO_NUM) == 0)) { -#if defined(CUSTOMER_PLATFORM) -/* - TODO : save the registerd irq number to the private wilc context in kernel. - * - * ex) nic->dev_irq_num = gpio_to_irq(GPIO_NUM); - */ -#else wl->dev_irq_num = gpio_to_irq(GPIO_NUM); -#endif } else { ret = -1; PRINT_ER("could not obtain gpio for WILC_INTR\n"); From f24374aa02bb9b4b38d5ca4db0ced3caf2982313 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:12 +0900 Subject: [PATCH 200/843] staging: wilc1000: rename pstrWFIDrv of function dev_state_ev_handler This patch renames pstrWFIDrv of function dev_state_ev_handler to hif_drv to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index a9052ed01339..88cf6999b024 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -122,7 +122,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event { struct in_ifaddr *dev_iface = (struct in_ifaddr *)ptr; struct wilc_priv *priv; - struct host_if_drv *pstrWFIDrv; + struct host_if_drv *hif_drv; struct net_device *dev; u8 *pIP_Add_buff; perInterface_wlan_t *nic; @@ -149,9 +149,9 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event PRINT_D(GENERIC_DBG, "No Wireless Priv\n"); return NOTIFY_DONE; } - pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv; + hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv; nic = netdev_priv(dev); - if (!nic || !pstrWFIDrv) { + if (!nic || !hif_drv) { PRINT_D(GENERIC_DBG, "No Wireless Priv\n"); return NOTIFY_DONE; } @@ -166,20 +166,20 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event /*If we are in station mode or client mode*/ if (nic->iftype == STATION_MODE || nic->iftype == CLIENT_MODE) { - pstrWFIDrv->IFC_UP = 1; + hif_drv->IFC_UP = 1; g_obtainingIP = false; del_timer(&hDuringIpTimer); PRINT_D(GENERIC_DBG, "IP obtained , enable scan\n"); } if (bEnablePS) - host_int_set_power_mgmt(pstrWFIDrv, 1, 0); + host_int_set_power_mgmt(hif_drv, 1, 0); PRINT_D(GENERIC_DBG, "[%s] Up IP\n", dev_iface->ifa_label); pIP_Add_buff = (char *) (&(dev_iface->ifa_address)); PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n", pIP_Add_buff[0], pIP_Add_buff[1], pIP_Add_buff[2], pIP_Add_buff[3]); - host_int_setup_ipaddress(pstrWFIDrv, pIP_Add_buff, nic->u8IfIdx); + host_int_setup_ipaddress(hif_drv, pIP_Add_buff, nic->u8IfIdx); break; @@ -188,21 +188,21 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event PRINT_INFO(GENERIC_DBG, "\n ============== IP Address Released ===============\n\n"); if (nic->iftype == STATION_MODE || nic->iftype == CLIENT_MODE) { - pstrWFIDrv->IFC_UP = 0; + hif_drv->IFC_UP = 0; g_obtainingIP = false; } if (memcmp(dev_iface->ifa_label, wlan_dev_name, 5) == 0) - host_int_set_power_mgmt(pstrWFIDrv, 0, 0); + host_int_set_power_mgmt(hif_drv, 0, 0); - resolve_disconnect_aberration(pstrWFIDrv); + resolve_disconnect_aberration(hif_drv); PRINT_D(GENERIC_DBG, "[%s] Down IP\n", dev_iface->ifa_label); pIP_Add_buff = null_ip; PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n", pIP_Add_buff[0], pIP_Add_buff[1], pIP_Add_buff[2], pIP_Add_buff[3]); - host_int_setup_ipaddress(pstrWFIDrv, pIP_Add_buff, nic->u8IfIdx); + host_int_setup_ipaddress(hif_drv, pIP_Add_buff, nic->u8IfIdx); break; From 0fa66c7143a367964fd4afb0c3c58b8f76d76544 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:13 +0900 Subject: [PATCH 201/843] staging: wilc1000: rename pstrWFIDrv of function linux_wlan_init_test_config This patch renames pstrWFIDrv of function linux_wlan_init_test_config to hif_drv to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 88cf6999b024..75edfa39d905 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -632,14 +632,14 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni unsigned char mac_add[] = {0x00, 0x80, 0xC2, 0x5E, 0xa2, 0xff}; struct wilc_priv *priv; - struct host_if_drv *pstrWFIDrv; + struct host_if_drv *hif_drv; PRINT_D(TX_DBG, "Start configuring Firmware\n"); get_random_bytes(&mac_add[5], 1); get_random_bytes(&mac_add[4], 1); priv = wiphy_priv(dev->ieee80211_ptr->wiphy); - pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv; - PRINT_D(INIT_DBG, "Host = %p\n", pstrWFIDrv); + hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv; + PRINT_D(INIT_DBG, "Host = %p\n", hif_drv); PRINT_D(INIT_DBG, "MAC address is : %02x-%02x-%02x-%02x-%02x-%02x\n", mac_add[0], mac_add[1], mac_add[2], mac_add[3], mac_add[4], mac_add[5]); wilc_get_chipid(0); From ef7606c5c3b3563970ddd3780b44bbe0144f10f4 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:14 +0900 Subject: [PATCH 202/843] staging: wilc1000: rename pstrWFIDrv of function wilc_set_multicast_list This patch renames pstrWFIDrv of function wilc_set_multicast_list to hif_drv to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 75edfa39d905..6250abbdb8d5 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1290,11 +1290,11 @@ static void wilc_set_multicast_list(struct net_device *dev) struct netdev_hw_addr *ha; struct wilc_priv *priv; - struct host_if_drv *pstrWFIDrv; + struct host_if_drv *hif_drv; int i = 0; priv = wiphy_priv(dev->ieee80211_ptr->wiphy); - pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv; + hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv; if (!dev) return; @@ -1314,14 +1314,14 @@ static void wilc_set_multicast_list(struct net_device *dev) if ((dev->flags & IFF_ALLMULTI) || (dev->mc.count) > WILC_MULTICAST_TABLE_SIZE) { PRINT_D(INIT_DBG, "Disable multicast filter, retrive all multicast packets\n"); /* get all multicast packets */ - host_int_setup_multicast_filter(pstrWFIDrv, false, 0); + host_int_setup_multicast_filter(hif_drv, false, 0); return; } /* No multicast? Just get our own stuff */ if ((dev->mc.count) == 0) { PRINT_D(INIT_DBG, "Enable multicast filter, retrive directed packets only.\n"); - host_int_setup_multicast_filter(pstrWFIDrv, true, 0); + host_int_setup_multicast_filter(hif_drv, true, 0); return; } @@ -1339,7 +1339,7 @@ static void wilc_set_multicast_list(struct net_device *dev) i++; } - host_int_setup_multicast_filter(pstrWFIDrv, true, (dev->mc.count)); + host_int_setup_multicast_filter(hif_drv, true, (dev->mc.count)); return; From 2db2c8a71b9c121e8ec23809605d18e708b7af09 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:15 +0900 Subject: [PATCH 203/843] staging: wilc1000: rename pstrWFIDrv of function mac_close This patch renames pstrWFIDrv of function mac_close to hif_drv to avoid CamelCase naming convention. And, some debug print modification that has been included name 'pstrWFIDrv'. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 6250abbdb8d5..a8d9bcd9ddcd 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1430,7 +1430,7 @@ int mac_close(struct net_device *ndev) { struct wilc_priv *priv; perInterface_wlan_t *nic; - struct host_if_drv *pstrWFIDrv; + struct host_if_drv *hif_drv; struct wilc *wl; nic = netdev_priv(ndev); @@ -1449,7 +1449,7 @@ int mac_close(struct net_device *ndev) return 0; } - pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv; + hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv; PRINT_D(GENERIC_DBG, "Mac close\n"); @@ -1458,8 +1458,8 @@ int mac_close(struct net_device *ndev) return 0; } - if (!pstrWFIDrv) { - PRINT_ER("pstrWFIDrv = NULL\n"); + if (!hif_drv) { + PRINT_ER("hif_drv = NULL\n"); return 0; } From eac3e8f6b86064da961f4874a052713ac0ab4824 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:16 +0900 Subject: [PATCH 204/843] staging: wilc1000: rename pIP_Add_buff of function dev_state_ev_handler This patch renames pIP_Add_buff of function dev_state_ev_handler to ip_addr_buf to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index a8d9bcd9ddcd..2900ea7e59ca 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -124,7 +124,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event struct wilc_priv *priv; struct host_if_drv *hif_drv; struct net_device *dev; - u8 *pIP_Add_buff; + u8 *ip_addr_buf; perInterface_wlan_t *nic; u8 null_ip[4] = {0}; char wlan_dev_name[5] = "wlan0"; @@ -177,9 +177,11 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event PRINT_D(GENERIC_DBG, "[%s] Up IP\n", dev_iface->ifa_label); - pIP_Add_buff = (char *) (&(dev_iface->ifa_address)); - PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n", pIP_Add_buff[0], pIP_Add_buff[1], pIP_Add_buff[2], pIP_Add_buff[3]); - host_int_setup_ipaddress(hif_drv, pIP_Add_buff, nic->u8IfIdx); + ip_addr_buf = (char *)&dev_iface->ifa_address; + PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n", + ip_addr_buf[0], ip_addr_buf[1], + ip_addr_buf[2], ip_addr_buf[3]); + host_int_setup_ipaddress(hif_drv, ip_addr_buf, nic->u8IfIdx); break; @@ -199,10 +201,12 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event PRINT_D(GENERIC_DBG, "[%s] Down IP\n", dev_iface->ifa_label); - pIP_Add_buff = null_ip; - PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n", pIP_Add_buff[0], pIP_Add_buff[1], pIP_Add_buff[2], pIP_Add_buff[3]); + ip_addr_buf = null_ip; + PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n", + ip_addr_buf[0], ip_addr_buf[1], + ip_addr_buf[2], ip_addr_buf[3]); - host_int_setup_ipaddress(hif_drv, pIP_Add_buff, nic->u8IfIdx); + host_int_setup_ipaddress(hif_drv, ip_addr_buf, nic->u8IfIdx); break; From 20fa54e44326bbff3632a3a5800d3f10fdd1e760 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:17 +0900 Subject: [PATCH 205/843] staging: wilc1000: fixes blank lines aren't necessary brace This patch fixes the checks reported by checkpatch.pl for Blank lines aren't necessary after an open brace '{' and Blank lines aren't necessary before a close brace '}'. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 2900ea7e59ca..4fbc344ac15f 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -218,7 +218,6 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event } return NOTIFY_DONE; - } #if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO) @@ -284,11 +283,9 @@ static int init_irq(struct net_device *dev) if ((ret != -1) && (request_threaded_irq(wl->dev_irq_num, isr_uh_routine, isr_bh_routine, IRQF_TRIGGER_LOW | IRQF_ONESHOT, /*Without IRQF_ONESHOT the uh will remain kicked in and dont gave a chance to bh*/ "WILC_IRQ", dev)) < 0) { - PRINT_ER("Failed to request IRQ for GPIO: %d\n", GPIO_NUM); ret = -1; } else { - PRINT_D(INIT_DBG, "IRQ request succeeded IRQ-NUM= %d on GPIO: %d\n", wl->dev_irq_num, GPIO_NUM); } @@ -353,12 +350,9 @@ void linux_wlan_mac_indicate(struct wilc *wilc, int flag) if (wilc->mac_status == WILC_MAC_STATUS_CONNECT) { /* Connect */ } - } else if (flag == WILC_MAC_INDICATE_SCAN) { PRINT_D(GENERIC_DBG, "Scanning ...\n"); - } - } struct net_device *GetIfHandler(struct wilc *wilc, u8 *pMacHeader) @@ -445,7 +439,6 @@ static int linux_wlan_txq_task(void *vp) /* inform wilc1000_wlan_init that TXQ task is started. */ up(&wl->txq_thread_started); while (1) { - PRINT_D(TX_DBG, "txq_task Taking a nap :)\n"); down(&wl->txq_event); /* wait_for_completion(&pd->txq_event); */ @@ -558,7 +551,6 @@ int linux_wlan_get_firmware(struct net_device *dev) _fail_: return ret; - } static int linux_wlan_start_firmware(struct net_device *dev) @@ -631,7 +623,6 @@ _FAIL_: /* startup configuration - could be changed later using iconfig*/ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_nic) { - unsigned char c_val[64]; unsigned char mac_add[] = {0x00, 0x80, 0xC2, 0x5E, 0xa2, 0xff}; @@ -997,7 +988,6 @@ static int wlan_deinit_locks(struct net_device *dev) } void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic) { - PRINT_D(INIT_DBG, "Linux to Wlan services ...\n"); nwi->os_context.os_private = (void *)nic; @@ -1193,7 +1183,6 @@ _fail_locks_: int mac_init_fn(struct net_device *ndev) { - /*Why we do this !!!*/ netif_start_queue(ndev); /* ma */ netif_stop_queue(ndev); /* ma */ @@ -1291,7 +1280,6 @@ struct net_device_stats *mac_stats(struct net_device *dev) /* Setup the multicast filter */ static void wilc_set_multicast_list(struct net_device *dev) { - struct netdev_hw_addr *ha; struct wilc_priv *priv; struct host_if_drv *hif_drv; @@ -1346,12 +1334,10 @@ static void wilc_set_multicast_list(struct net_device *dev) host_int_setup_multicast_filter(hif_drv, true, (dev->mc.count)); return; - } static void linux_wlan_tx_complete(void *priv, int status) { - struct tx_complete_data *pv_data = (struct tx_complete_data *)priv; if (status == 1) @@ -1496,7 +1482,6 @@ int mac_close(struct net_device *ndev) int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) { - u8 *buff = NULL; s8 rssi; u32 size = 0, length = 0; @@ -1513,7 +1498,6 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) return 0; switch (cmd) { - /* ]] 2013-06-24 */ case SIOCSIWPRIV: { @@ -1522,7 +1506,6 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) size = wrq->u.data.length; if (size && wrq->u.data.pointer) { - buff = memdup_user(wrq->u.data.pointer, wrq->u.data.length); if (IS_ERR(buff)) return PTR_ERR(buff); @@ -1566,7 +1549,6 @@ done: void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset) { - unsigned int frame_len = 0; int stats; unsigned char *buff_to_send = NULL; @@ -1582,7 +1564,6 @@ void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset) nic = netdev_priv(wilc_netdev); if (size > 0) { - frame_len = size; buff_to_send = buff; @@ -1757,7 +1738,6 @@ int wilc_netdev_init(struct wilc **wilc) nic->netstats.tx_packets = 0; nic->netstats.rx_bytes = 0; nic->netstats.tx_bytes = 0; - } if (register_netdev(ndev)) { @@ -1767,7 +1747,6 @@ int wilc_netdev_init(struct wilc **wilc) nic->iftype = STATION_MODE; nic->mac_opened = 0; - } #ifndef WILC_SDIO From 98b8984794803a59587840d5261d5e5ec8e0d031 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:18 +0900 Subject: [PATCH 206/843] staging: wilc1000: linux_wlan.c: clean up comments There are over-commenting in the linux_wlan.c file and most of them are not helpful to explain what the code does and generate 80 ending line over warnings. So, all of comments and commented codes are removed in this patch. Comment will be added if necessary with the preferred Linux style. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 219 +++----------------------- 1 file changed, 26 insertions(+), 193 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 4fbc344ac15f..105dbc809a5c 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -78,12 +78,6 @@ static struct notifier_block g_dev_notifier = { #define IRQ_WAIT 1 #define IRQ_NO_WAIT 0 -/* - * to sync between mac_close and module exit. - * don't initialize or de-initialize from init/deinitlocks - * to be initialized from module wilc_netdev_init and - * deinitialized from mdoule_exit - */ static struct semaphore close_exit_sync; static int wlan_deinit_locks(struct net_device *dev); @@ -99,11 +93,6 @@ int mac_close(struct net_device *ndev); static struct net_device_stats *mac_stats(struct net_device *dev); static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd); static void wilc_set_multicast_list(struct net_device *dev); - -/* - * for now - in frmw_to_linux there should be private data to be passed to it - * and this data should be pointer to net device - */ struct wilc *g_linux_wlan; bool bEnablePS = true; @@ -156,15 +145,14 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event return NOTIFY_DONE; } - PRINT_INFO(GENERIC_DBG, "dev_state_ev_handler +++\n"); /* tony */ + PRINT_INFO(GENERIC_DBG, "dev_state_ev_handler +++\n"); switch (event) { case NETDEV_UP: - PRINT_D(GENERIC_DBG, "dev_state_ev_handler event=NETDEV_UP %p\n", dev); /* tony */ + PRINT_D(GENERIC_DBG, "dev_state_ev_handler event=NETDEV_UP %p\n", dev); PRINT_INFO(GENERIC_DBG, "\n ============== IP Address Obtained ===============\n\n"); - /*If we are in station mode or client mode*/ if (nic->iftype == STATION_MODE || nic->iftype == CLIENT_MODE) { hif_drv->IFC_UP = 1; g_obtainingIP = false; @@ -186,7 +174,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event break; case NETDEV_DOWN: - PRINT_D(GENERIC_DBG, "dev_state_ev_handler event=NETDEV_DOWN %p\n", dev); /* tony */ + PRINT_D(GENERIC_DBG, "dev_state_ev_handler event=NETDEV_DOWN %p\n", dev); PRINT_INFO(GENERIC_DBG, "\n ============== IP Address Released ===============\n\n"); if (nic->iftype == STATION_MODE || nic->iftype == CLIENT_MODE) { @@ -211,7 +199,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event break; default: - PRINT_INFO(GENERIC_DBG, "dev_state_ev_handler event=default\n"); /* tony */ + PRINT_INFO(GENERIC_DBG, "dev_state_ev_handler event=default\n"); PRINT_INFO(GENERIC_DBG, "[%s] unknown dev event: %lu\n", dev_iface->ifa_label, event); break; @@ -231,7 +219,6 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data) wilc = nic->wilc; PRINT_D(INT_DBG, "Interrupt received UH\n"); - /*While mac is closing cacncel the handling of any interrupts received*/ if (wilc->close) { PRINT_ER("Driver is CLOSING: Can't handle UH interrupt\n"); return IRQ_HANDLED; @@ -248,7 +235,6 @@ irqreturn_t isr_bh_routine(int irq, void *userdata) nic = netdev_priv(userdata); wilc = nic->wilc; - /*While mac is closing cacncel the handling of any interrupts received*/ if (wilc->close) { PRINT_ER("Driver is CLOSING: Can't handle BH interrupt\n"); return IRQ_HANDLED; @@ -270,8 +256,6 @@ static int init_irq(struct net_device *dev) nic = netdev_priv(dev); wl = nic->wilc; - /*initialize GPIO and register IRQ num*/ - /*GPIO request*/ if ((gpio_request(GPIO_NUM, "WILC_INTR") == 0) && (gpio_direction_input(GPIO_NUM) == 0)) { wl->dev_irq_num = gpio_to_irq(GPIO_NUM); @@ -281,7 +265,7 @@ static int init_irq(struct net_device *dev) } if ((ret != -1) && (request_threaded_irq(wl->dev_irq_num, isr_uh_routine, isr_bh_routine, - IRQF_TRIGGER_LOW | IRQF_ONESHOT, /*Without IRQF_ONESHOT the uh will remain kicked in and dont gave a chance to bh*/ + IRQF_TRIGGER_LOW | IRQF_ONESHOT, "WILC_IRQ", dev)) < 0) { PRINT_ER("Failed to request IRQ for GPIO: %d\n", GPIO_NUM); ret = -1; @@ -303,7 +287,6 @@ static void deinit_irq(struct net_device *dev) wilc = nic->wilc; #if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO) - /* Deintialize IRQ */ if (&wilc->dev_irq_num != 0) { free_irq(wilc->dev_irq_num, wilc); @@ -312,9 +295,6 @@ static void deinit_irq(struct net_device *dev) #endif } -/* - * OS functions - */ void linux_wlan_dbg(u8 *buff) { PRINT_D(INIT_DBG, "%d\n", *buff); @@ -334,9 +314,6 @@ int linux_wlan_lock_timeout(void *vp, u32 timeout) void linux_wlan_mac_indicate(struct wilc *wilc, int flag) { - /*I have to do it that way becuase there is no mean to encapsulate device pointer - * as a parameter - */ int status; if (flag == WILC_MAC_INDICATE_STATUS) { @@ -348,7 +325,7 @@ void linux_wlan_mac_indicate(struct wilc *wilc, int flag) wilc->mac_status = status; } - if (wilc->mac_status == WILC_MAC_STATUS_CONNECT) { /* Connect */ + if (wilc->mac_status == WILC_MAC_STATUS_CONNECT) { } } else if (flag == WILC_MAC_INDICATE_SCAN) { PRINT_D(GENERIC_DBG, "Scanning ...\n"); @@ -402,7 +379,6 @@ int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID) return ret; } -/*Function to get number of connected interfaces*/ int linux_wlan_get_num_conn_ifcs(void) { u8 i = 0; @@ -436,16 +412,13 @@ static int linux_wlan_txq_task(void *vp) nic = netdev_priv(dev); wl = nic->wilc; - /* inform wilc1000_wlan_init that TXQ task is started. */ up(&wl->txq_thread_started); while (1) { PRINT_D(TX_DBG, "txq_task Taking a nap :)\n"); down(&wl->txq_event); - /* wait_for_completion(&pd->txq_event); */ PRINT_D(TX_DBG, "txq_task Who waked me up :$\n"); if (wl->close) { - /*Unlock the mutex in the mac_close function to indicate the exiting of the TX thread */ up(&wl->txq_thread_started); while (!kthread_should_stop()) @@ -460,23 +433,19 @@ static int linux_wlan_txq_task(void *vp) #else do { ret = wilc_wlan_handle_txq(dev, &txq_count); - if (txq_count < FLOW_CONTROL_LOWER_THRESHOLD /* && netif_queue_stopped(pd->wilc_netdev)*/) { + if (txq_count < FLOW_CONTROL_LOWER_THRESHOLD) { PRINT_D(TX_DBG, "Waking up queue\n"); - /* netif_wake_queue(pd->wilc_netdev); */ + if (netif_queue_stopped(wl->vif[0].ndev)) netif_wake_queue(wl->vif[0].ndev); if (netif_queue_stopped(wl->vif[1].ndev)) netif_wake_queue(wl->vif[1].ndev); } - if (ret == WILC_TX_ERR_NO_BUF) { /* failed to allocate buffers in chip. */ + if (ret == WILC_TX_ERR_NO_BUF) { do { - /* Back off from sending packets for some time. */ - /* schedule_timeout will allow RX task to run and free buffers.*/ - /* set_current_state(TASK_UNINTERRUPTIBLE); */ - /* timeout = schedule_timeout(timeout); */ msleep(TX_BACKOFF_WEIGHT_UNIT_MS << backoff_weight); - } while (/*timeout*/ 0); + } while (0); backoff_weight += TX_BACKOFF_WEIGHT_INCR_STEP; if (backoff_weight > TX_BACKOFF_WEIGHT_MAX) backoff_weight = TX_BACKOFF_WEIGHT_MAX; @@ -487,8 +456,7 @@ static int linux_wlan_txq_task(void *vp) backoff_weight = TX_BACKOFF_WEIGHT_MIN; } } - /*TODO: drop packets after a certain time/number of retry count. */ - } while (ret == WILC_TX_ERR_NO_BUF && !wl->close); /* retry sending packets if no more buffers in chip. */ + } while (ret == WILC_TX_ERR_NO_BUF && !wl->close); #endif } return 0; @@ -530,9 +498,6 @@ int linux_wlan_get_firmware(struct net_device *dev) goto _fail_; } - /* the firmare should be located in /lib/firmware in - * root file system with the name specified above */ - #ifdef WILC_SDIO if (request_firmware(&wilc_firmware, firmware, &wilc->wilc_sdio_func->dev) != 0) { PRINT_ER("%s - firmare not available\n", firmware); @@ -562,7 +527,6 @@ static int linux_wlan_start_firmware(struct net_device *dev) nic = netdev_priv(dev); wilc = nic->wilc; - /* start firmware */ PRINT_D(INIT_DBG, "Starting Firmware ...\n"); ret = wilc_wlan_start(); if (ret < 0) { @@ -570,17 +534,12 @@ static int linux_wlan_start_firmware(struct net_device *dev) goto _fail_; } - /* wait for mac ready */ PRINT_D(INIT_DBG, "Waiting for Firmware to get ready ...\n"); ret = linux_wlan_lock_timeout(&wilc->sync_event, 5000); if (ret) { PRINT_D(INIT_DBG, "Firmware start timed out"); goto _fail_; } - /* - * TODO: Driver shouoldn't wait forever for firmware to get started - - * in case of timeout this should be handled properly - */ PRINT_D(INIT_DBG, "Firmware successfully started\n"); _fail_: @@ -600,16 +559,12 @@ static int linux_wlan_firmware_download(struct net_device *dev) ret = -ENOBUFS; goto _FAIL_; } - /** - * do the firmware download - **/ PRINT_D(INIT_DBG, "Downloading Firmware ...\n"); ret = wilc_wlan_firmware_download(wilc->firmware->data, wilc->firmware->size); if (ret < 0) goto _FAIL_; - /* Freeing FW buffer */ PRINT_D(INIT_DBG, "Freeing FW buffer ...\n"); PRINT_D(INIT_DBG, "Releasing firmware\n"); release_firmware(wilc->firmware); @@ -620,7 +575,6 @@ _FAIL_: return ret; } -/* startup configuration - could be changed later using iconfig*/ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_nic) { unsigned char c_val[64]; @@ -644,7 +598,6 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni if (!wilc_wlan_cfg_set(1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0)) goto _fail_; - /*to tell fw that we are going to use PC test - WILC specific*/ c_val[0] = 0; if (!wilc_wlan_cfg_set(0, WID_PC_TEST_MODE, c_val, 1, 0, 0)) goto _fail_; @@ -653,7 +606,6 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni if (!wilc_wlan_cfg_set(0, WID_BSS_TYPE, c_val, 1, 0, 0)) goto _fail_; - /* c_val[0] = RATE_AUTO; */ c_val[0] = RATE_AUTO; if (!wilc_wlan_cfg_set(0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0)) goto _fail_; @@ -682,7 +634,7 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni if (!wilc_wlan_cfg_set(0, WID_SITE_SURVEY, c_val, 1, 0, 0)) goto _fail_; - *((int *)c_val) = 0xffff; /* Never use RTS-CTS */ + *((int *)c_val) = 0xffff; if (!wilc_wlan_cfg_set(0, WID_RTS_THRESHOLD, c_val, 2, 0, 0)) goto _fail_; @@ -690,13 +642,6 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni if (!wilc_wlan_cfg_set(0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0)) goto _fail_; - /* SSID */ - /* -------------------------------------------------------------- */ - /* Configuration : String with length less than 32 bytes */ - /* Values to set : Any string with length less than 32 bytes */ - /* ( In BSS Station Set SSID to "" (null string) */ - /* to enable Broadcast SSID suppport ) */ - /* -------------------------------------------------------------- */ c_val[0] = 0; if (!wilc_wlan_cfg_set(0, WID_BCAST_SSID, c_val, 1, 0, 0)) goto _fail_; @@ -709,7 +654,7 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni if (!wilc_wlan_cfg_set(0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0)) goto _fail_; - c_val[0] = NO_ENCRYPT; /* NO_ENCRYPT, 0x79 */ + c_val[0] = NO_ENCRYPT; if (!wilc_wlan_cfg_set(0, WID_11I_MODE, c_val, 1, 0, 0)) goto _fail_; @@ -717,43 +662,18 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni if (!wilc_wlan_cfg_set(0, WID_AUTH_TYPE, c_val, 1, 0, 0)) goto _fail_; - /* WEP/802 11I Configuration */ - /* ------------------------------------------------------------------ */ - /* Configuration : WEP Key */ - /* Values (0x) : 5 byte for WEP40 and 13 bytes for WEP104 */ - /* In case more than 5 bytes are passed on for WEP 40 */ - /* only first 5 bytes will be used as the key */ - /* ------------------------------------------------------------------ */ - strcpy(c_val, "123456790abcdef1234567890"); if (!wilc_wlan_cfg_set(0, WID_WEP_KEY_VALUE, c_val, (strlen(c_val) + 1), 0, 0)) goto _fail_; - /* WEP/802 11I Configuration */ - /* ------------------------------------------------------------------ */ - /* Configuration : AES/TKIP WPA/RSNA Pre-Shared Key */ - /* Values to set : Any string with length greater than equal to 8 bytes */ - /* and less than 64 bytes */ - /* ------------------------------------------------------------------ */ strcpy(c_val, "12345678"); if (!wilc_wlan_cfg_set(0, WID_11I_PSK, c_val, (strlen(c_val)), 0, 0)) goto _fail_; - /* IEEE802.1X Key Configuration */ - /* ------------------------------------------------------------------ */ - /* Configuration : Radius Server Access Secret Key */ - /* Values to set : Any string with length greater than equal to 8 bytes */ - /* and less than 65 bytes */ - /* ------------------------------------------------------------------ */ strcpy(c_val, "password"); if (!wilc_wlan_cfg_set(0, WID_1X_KEY, c_val, (strlen(c_val) + 1), 0, 0)) goto _fail_; - /* IEEE802.1X Server Address Configuration */ - /* ------------------------------------------------------------------ */ - /* Configuration : Radius Server IP Address */ - /* Values to set : Any valid IP Address */ - /* ------------------------------------------------------------------ */ c_val[0] = 192; c_val[1] = 168; c_val[2] = 1; @@ -785,12 +705,6 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni if (!wilc_wlan_cfg_set(0, WID_TX_POWER_LEVEL_11B, c_val, 1, 0, 0)) goto _fail_; - /* Beacon Interval */ - /* -------------------------------------------------------------------- */ - /* Configuration : Sets the beacon interval value */ - /* Values to set : Any 16-bit value */ - /* -------------------------------------------------------------------- */ - *((int *)c_val) = 100; if (!wilc_wlan_cfg_set(0, WID_BEACON_INTERVAL, c_val, 2, 0, 0)) goto _fail_; @@ -799,20 +713,10 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni if (!wilc_wlan_cfg_set(0, WID_REKEY_POLICY, c_val, 1, 0, 0)) goto _fail_; - /* Rekey Time (s) (Used only when the Rekey policy is 2 or 4) */ - /* -------------------------------------------------------------------- */ - /* Configuration : Sets the Rekey Time (s) */ - /* Values to set : 32-bit value */ - /* -------------------------------------------------------------------- */ *((int *)c_val) = 84600; if (!wilc_wlan_cfg_set(0, WID_REKEY_PERIOD, c_val, 4, 0, 0)) goto _fail_; - /* Rekey Packet Count (in 1000s; used when Rekey Policy is 3) */ - /* -------------------------------------------------------------------- */ - /* Configuration : Sets Rekey Group Packet count */ - /* Values to set : 32-bit Value */ - /* -------------------------------------------------------------------- */ *((int *)c_val) = 500; if (!wilc_wlan_cfg_set(0, WID_REKEY_PACKET_COUNT, c_val, 4, 0, 0)) goto _fail_; @@ -825,7 +729,7 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni if (!wilc_wlan_cfg_set(0, WID_11N_ERP_PROT_TYPE, c_val, 1, 0, 0)) goto _fail_; - c_val[0] = 1; /* Enable N */ + c_val[0] = 1; if (!wilc_wlan_cfg_set(0, WID_11N_ENABLE, c_val, 1, 0, 0)) goto _fail_; @@ -833,7 +737,7 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni if (!wilc_wlan_cfg_set(0, WID_11N_OPERATING_MODE, c_val, 1, 0, 0)) goto _fail_; - c_val[0] = 1; /* TXOP Prot disable in N mode: No RTS-CTS on TX A-MPDUs to save air-time. */ + c_val[0] = 1; if (!wilc_wlan_cfg_set(0, WID_11N_TXOP_PROT_DISABLE, c_val, 1, 0, 0)) goto _fail_; @@ -842,9 +746,6 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni if (!wilc_wlan_cfg_set(0, WID_MAC_ADDR, c_val, 6, 0, 0)) goto _fail_; - /** - * AP only - **/ c_val[0] = DETECT_PROTECT_REPORT; if (!wilc_wlan_cfg_set(0, WID_11N_OBSS_NONHT_DETECTION, c_val, 1, 0, 0)) goto _fail_; @@ -865,7 +766,7 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni if (!wilc_wlan_cfg_set(0, WID_11N_CURRENT_TX_MCS, c_val, 1, 0, 0)) goto _fail_; - c_val[0] = 1; /* Enable N with immediate block ack. */ + c_val[0] = 1; if (!wilc_wlan_cfg_set(0, WID_11N_IMMEDIATE_BA_ENABLED, c_val, 1, 1, 1)) goto _fail_; @@ -875,7 +776,6 @@ _fail_: return -1; } -/**************************/ void wilc1000_wlan_deinit(struct net_device *dev) { perInterface_wlan_t *nic; @@ -893,7 +793,6 @@ void wilc1000_wlan_deinit(struct net_device *dev) netdev_info(dev, "Deinitializing wilc1000...\n"); #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31) - /* johnny : remove */ PRINT_D(INIT_DBG, "skip wilc_bus_set_default_speed\n"); #else wilc_bus_set_default_speed(); @@ -928,11 +827,9 @@ void wilc1000_wlan_deinit(struct net_device *dev) #endif #endif - /*De-Initialize locks*/ PRINT_D(INIT_DBG, "Deinitializing Locks\n"); wlan_deinit_locks(dev); - /* announce that wilc1000 is not initialized */ wl->initialized = false; PRINT_D(INIT_DBG, "wilc1000 deinitialization Done\n"); @@ -1021,8 +918,6 @@ int wlan_initialize_threads(struct net_device *dev) wilc = nic->wilc; PRINT_D(INIT_DBG, "Initializing Threads ...\n"); - - /* create tx task */ PRINT_D(INIT_DBG, "Creating kthread for transmission\n"); wilc->txq_thread = kthread_run(linux_wlan_txq_task, (void *)dev, "K_TXQ_TASK"); @@ -1031,13 +926,11 @@ int wlan_initialize_threads(struct net_device *dev) ret = -ENOBUFS; goto _fail_2; } - /* wait for TXQ task to start. */ down(&wilc->txq_thread_started); return 0; _fail_2: - /*De-Initialize 2nd thread*/ wilc->close = 0; return ret; } @@ -1113,7 +1006,6 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) goto _fail_irq_enable_; } - /*Download firmware*/ ret = linux_wlan_firmware_download(dev); if (ret < 0) { PRINT_ER("Failed to download firmware\n"); @@ -1121,7 +1013,6 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) goto _fail_irq_enable_; } - /* Start firmware*/ ret = linux_wlan_start_firmware(dev); if (ret < 0) { PRINT_ER("Failed to start firmware\n"); @@ -1141,7 +1032,6 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) Firmware_ver[size] = '\0'; PRINT_D(INIT_DBG, "***** Firmware Ver = %s *******\n", Firmware_ver); } - /* Initialize firmware with default configuration */ ret = linux_wlan_init_test_config(dev, wl); if (ret < 0) { @@ -1151,7 +1041,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) } wl->initialized = true; - return 0; /*success*/ + return 0; _fail_fw_start_: wilc_wlan_stop(); @@ -1177,26 +1067,18 @@ _fail_locks_: return ret; } -/* - * - this function will be called automatically by OS when module inserted. - */ - int mac_init_fn(struct net_device *ndev) { - /*Why we do this !!!*/ - netif_start_queue(ndev); /* ma */ - netif_stop_queue(ndev); /* ma */ + netif_start_queue(ndev); + netif_stop_queue(ndev); return 0; } -/* This fn is called, when this device is setup using ifconfig */ int mac_open(struct net_device *ndev) { perInterface_wlan_t *nic; - /*No need for setting mac address here anymore,*/ - /*Just set it in init_test_config()*/ unsigned char mac_add[ETH_ALEN] = {0}; int ret = 0; int i = 0; @@ -1223,7 +1105,6 @@ int mac_open(struct net_device *ndev) return ret; } - /*initialize platform*/ PRINT_D(INIT_DBG, "*** re-init ***\n"); ret = wilc1000_wlan_init(ndev, nic); if (ret < 0) { @@ -1237,7 +1118,6 @@ int mac_open(struct net_device *ndev) host_int_get_MacAddress(priv->hWILCWFIDrv, mac_add); PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add); - /* loop through the NUM of supported devices and set the MAC address */ for (i = 0; i < wl->vif_num; i++) { if (ndev == wl->vif[i].ndev) { memcpy(wl->vif[i].src_addr, mac_add, ETH_ALEN); @@ -1246,7 +1126,6 @@ int mac_open(struct net_device *ndev) } } - /* TODO: get MAC address whenever the source is EPROM - hardcoded and copy it to ndev*/ memcpy(ndev->dev_addr, wl->vif[i].src_addr, ETH_ALEN); if (!is_valid_ether_addr(ndev->dev_addr)) { @@ -1277,7 +1156,6 @@ struct net_device_stats *mac_stats(struct net_device *dev) return &nic->netstats; } -/* Setup the multicast filter */ static void wilc_set_multicast_list(struct net_device *dev) { struct netdev_hw_addr *ha; @@ -1294,30 +1172,22 @@ static void wilc_set_multicast_list(struct net_device *dev) PRINT_D(INIT_DBG, "Setting Multicast List with count = %d.\n", dev->mc.count); if (dev->flags & IFF_PROMISC) { - /* Normally, we should configure the chip to retrive all packets - * but we don't wanna support this right now */ - /* TODO: add promiscuous mode support */ PRINT_D(INIT_DBG, "Set promiscuous mode ON, retrive all packets\n"); return; } - /* If there's more addresses than we handle, get all multicast - * packets and sort them out in software. */ if ((dev->flags & IFF_ALLMULTI) || (dev->mc.count) > WILC_MULTICAST_TABLE_SIZE) { PRINT_D(INIT_DBG, "Disable multicast filter, retrive all multicast packets\n"); - /* get all multicast packets */ host_int_setup_multicast_filter(hif_drv, false, 0); return; } - /* No multicast? Just get our own stuff */ if ((dev->mc.count) == 0) { PRINT_D(INIT_DBG, "Enable multicast filter, retrive directed packets only.\n"); host_int_setup_multicast_filter(hif_drv, true, 0); return; } - /* Store all of the multicast addresses in the hardware filter */ netdev_for_each_mc_addr(ha, dev) { memcpy(multicast_mac_addr_list[i], ha->addr, ETH_ALEN); @@ -1344,7 +1214,6 @@ static void linux_wlan_tx_complete(void *priv, int status) PRINT_D(TX_DBG, "Packet sent successfully - Size = %d - Address = %p - SKB = %p\n", pv_data->size, pv_data->buff, pv_data->skb); else PRINT_D(TX_DBG, "Couldn't send packet - Size = %d - Address = %p - SKB = %p\n", pv_data->size, pv_data->buff, pv_data->skb); - /* Free the SK Buffer, its work is done */ dev_kfree_skb(pv_data->skb); kfree(pv_data); } @@ -1364,7 +1233,6 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev) PRINT_D(TX_DBG, "Sending packet just received from TCP/IP\n"); - /* Stop the network interface queue */ if (skb->dev != ndev) { PRINT_ER("Packet not destined to this device\n"); return 0; @@ -1386,7 +1254,6 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev) if (eth_h->h_proto == 0x8e88) PRINT_D(INIT_DBG, "EAPOL transmitted\n"); - /*get source and dest ip addresses*/ ih = (struct iphdr *)(skb->data + sizeof(struct ethhdr)); pu8UdpBuffer = (char *)ih + sizeof(struct iphdr); @@ -1394,12 +1261,6 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev) PRINT_D(GENERIC_DBG, "DHCP Message transmitted, type:%x %x %x\n", pu8UdpBuffer[248], pu8UdpBuffer[249], pu8UdpBuffer[250]); PRINT_D(TX_DBG, "Sending packet - Size = %d - Address = %p - SKB = %p\n", tx_data->size, tx_data->buff, tx_data->skb); - - /* Send packet to MAC HW - for now the tx_complete function will be just status - * indicator. still not sure if I need to suspend host transmission till the tx_complete - * function called or not? - * allocated buffer will be freed in tx_complete function. - */ PRINT_D(TX_DBG, "Adding tx packet to TX Queue\n"); nic->netstats.tx_packets++; nic->netstats.tx_bytes += tx_data->size; @@ -1461,7 +1322,6 @@ int mac_close(struct net_device *ndev) } if (nic->wilc_netdev) { - /* Stop the network interface queue */ netif_stop_queue(nic->wilc_netdev); wilc_deinit_host_int(nic->wilc_netdev); @@ -1490,7 +1350,6 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) s32 s32Error = 0; struct wilc *wilc; - /* struct iwreq *wrq = (struct iwreq *) req; // tony moved to case SIOCSIWPRIV */ nic = netdev_priv(ndev); wilc = nic->wilc; @@ -1498,10 +1357,9 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) return 0; switch (cmd) { - /* ]] 2013-06-24 */ case SIOCSIWPRIV: { - struct iwreq *wrq = (struct iwreq *) req; /* added by tony */ + struct iwreq *wrq = (struct iwreq *) req; size = wrq->u.data.length; @@ -1517,7 +1375,6 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) PRINT_ER("Failed to send get rssi param's message queue "); PRINT_INFO(GENERIC_DBG, "RSSI :%d\n", rssi); - /*Rounding up the rssi negative value*/ rssi += 5; snprintf(buff, size, "rssi %d", rssi); @@ -1567,7 +1424,6 @@ void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset) frame_len = size; buff_to_send = buff; - /* Need to send the packet up to the host, allocate a skb buffer */ skb = dev_alloc_skb(frame_len); if (!skb) { PRINT_ER("Low memory - packet droped\n"); @@ -1581,23 +1437,9 @@ void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset) if (!skb->dev) PRINT_ER("skb->dev is NULL\n"); - /* - * for(i=0;i<40;i++) - * { - * if(iprotocol = eth_type_trans(skb, wilc_netdev); - /* Send the packet to the stack by giving it to the bridge */ nic->netstats.rx_packets++; nic->netstats.rx_bytes += frame_len; skb->ip_summed = CHECKSUM_UNNECESSARY; @@ -1611,8 +1453,6 @@ void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size) int i = 0; perInterface_wlan_t *nic; - /*Pass the frame on the monitor interface, if any.*/ - /*Otherwise, pass it on p2p0 netdev, if registered on it*/ for (i = 0; i < wilc->vif_num; i++) { nic = netdev_priv(wilc->vif[i].ndev); if (nic->monitor_flag) { @@ -1621,7 +1461,7 @@ void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size) } } - nic = netdev_priv(wilc->vif[1].ndev); /* p2p0 */ + nic = netdev_priv(wilc->vif[1].ndev); if ((buff[0] == nic->g_struct_frame_reg[0].frame_type && nic->g_struct_frame_reg[0].reg) || (buff[0] == nic->g_struct_frame_reg[1].frame_type && nic->g_struct_frame_reg[1].reg)) WILC_WFI_p2p_rx(wilc->vif[1].ndev, buff, size); @@ -1676,7 +1516,6 @@ int wilc_netdev_init(struct wilc **wilc) sema_init(&close_exit_sync, 0); - /*create the common structure*/ g_linux_wlan = kzalloc(sizeof(*g_linux_wlan), GFP_KERNEL); if (!g_linux_wlan) return -ENOMEM; @@ -1686,7 +1525,6 @@ int wilc_netdev_init(struct wilc **wilc) register_inetaddr_notifier(&g_dev_notifier); for (i = 0; i < NUM_CONCURRENT_IFC; i++) { - /*allocate first ethernet device with perinterface_wlan_t as its private data*/ ndev = alloc_etherdev(sizeof(perInterface_wlan_t)); if (!ndev) { PRINT_ER("Failed to allocate ethernet dev\n"); @@ -1696,13 +1534,12 @@ int wilc_netdev_init(struct wilc **wilc) nic = netdev_priv(ndev); memset(nic, 0, sizeof(perInterface_wlan_t)); - /*Name the Devices*/ if (i == 0) { - #if defined(NM73131) /* tony, 2012-09-20 */ + #if defined(NM73131) strcpy(ndev->name, "wilc_eth%d"); - #elif defined(PLAT_CLM9722) /* rachel */ + #elif defined(PLAT_CLM9722) strcpy(ndev->name, "eth%d"); - #else /* PANDA_BOARD, PLAT_ALLWINNER_A10, PLAT_ALLWINNER_A20, PLAT_ALLWINNER_A31, PLAT_AML8726_M3 or PLAT_WMS8304 */ + #else strcpy(ndev->name, "wlan%d"); #endif } else @@ -1717,11 +1554,9 @@ int wilc_netdev_init(struct wilc **wilc) { struct wireless_dev *wdev; - /*Register WiFi*/ wdev = wilc_create_wiphy(ndev); #ifdef WILC_SDIO - /* set netdev, tony */ SET_NETDEV_DEV(ndev, &local_sdio_func->dev); #endif @@ -1730,7 +1565,6 @@ int wilc_netdev_init(struct wilc **wilc) return -1; } - /*linking the wireless_dev structure with the netdevice*/ nic->wilc_netdev->ieee80211_ptr = wdev; nic->wilc_netdev->ml_priv = nic; wdev->netdev = nic->wilc_netdev; @@ -1742,7 +1576,7 @@ int wilc_netdev_init(struct wilc **wilc) if (register_netdev(ndev)) { PRINT_ER("Device couldn't be registered - %s\n", ndev->name); - return -1; /* ERROR */ + return -1; } nic->iftype = STATION_MODE; @@ -1752,7 +1586,7 @@ int wilc_netdev_init(struct wilc **wilc) #ifndef WILC_SDIO if (!linux_spi_init(&g_linux_wlan->wilc_spidev)) { PRINT_ER("Can't initialize SPI\n"); - return -1; /* ERROR */ + return -1; } g_linux_wlan->wilc_spidev = wilc_spi_dev; #else @@ -1762,7 +1596,6 @@ int wilc_netdev_init(struct wilc **wilc) return 0; } -/*The 1st function called after module inserted*/ static int __init init_wilc_driver(void) { #ifdef WILC_SPI From 84d3b87e8b0d10088515da69829fc623833661c4 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:19 +0900 Subject: [PATCH 207/843] staging: wilc1000: linux_wlan: remove unused defines This patch removes unused defines from linux_wlan.c file. - NM73131 - PLAT_CLM9722 Two defines are support custom feature that don't used anymore. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 105dbc809a5c..432f0be99cc0 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1534,15 +1534,9 @@ int wilc_netdev_init(struct wilc **wilc) nic = netdev_priv(ndev); memset(nic, 0, sizeof(perInterface_wlan_t)); - if (i == 0) { - #if defined(NM73131) - strcpy(ndev->name, "wilc_eth%d"); - #elif defined(PLAT_CLM9722) - strcpy(ndev->name, "eth%d"); - #else + if (i == 0) strcpy(ndev->name, "wlan%d"); - #endif - } else + else strcpy(ndev->name, "p2p%d"); nic->u8IfIdx = g_linux_wlan->vif_num; From 7df00115f820d66d362820306438e73fcccf16d0 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:20 +0900 Subject: [PATCH 208/843] staging: wilc1000: remove extern function in c file and move it to header file. This patch removes extern resolve_disconnect_aberration in c file and move it to proper header file. Rename argument also to match with declaration. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.h | 2 +- drivers/staging/wilc1000/linux_wlan.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 72c47974d2d8..f73817a4d435 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -420,5 +420,5 @@ void host_int_freeJoinParams(void *pJoinParams); s32 host_int_get_statistics(struct host_if_drv *hWFIDrv, struct rf_info *pstrStatistics); - +void resolve_disconnect_aberration(struct host_if_drv *hif_drv); #endif diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 432f0be99cc0..3aedc288ade1 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -38,7 +38,6 @@ #define _linux_wlan_device_removal() {} extern bool g_obtainingIP; -extern void resolve_disconnect_aberration(void *drvHandler); extern u8 multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; extern struct timer_list hDuringIpTimer; From 582f8a2710f4fc78edfe2b33ebf6598fe02e9688 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:21 +0900 Subject: [PATCH 209/843] staging: wilc1000: remove warnings line over 80 characters This patch removes the warnings reported by checkpatch.pl for line over 80 characters. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 40 ++++++++++++++++++--------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 3aedc288ade1..4b2afa05d176 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -122,7 +122,8 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event return NOTIFY_DONE; } - if ((memcmp(dev_iface->ifa_label, "wlan0", 5)) && (memcmp(dev_iface->ifa_label, "p2p0", 4))) { + if (memcmp(dev_iface->ifa_label, "wlan0", 5) && + memcmp(dev_iface->ifa_label, "p2p0", 4)) { PRINT_D(GENERIC_DBG, "Interface is neither WLAN0 nor P2P0\n"); return NOTIFY_DONE; } @@ -305,7 +306,8 @@ int linux_wlan_lock_timeout(void *vp, u32 timeout) PRINT_D(LOCK_DBG, "Locking %p\n", vp); if (vp) - error = down_timeout((struct semaphore *)vp, msecs_to_jiffies(timeout)); + error = down_timeout((struct semaphore *)vp, + msecs_to_jiffies(timeout)); else PRINT_ER("Failed, mutex is NULL\n"); return error; @@ -316,7 +318,8 @@ void linux_wlan_mac_indicate(struct wilc *wilc, int flag) int status; if (flag == WILC_MAC_INDICATE_STATUS) { - wilc_wlan_cfg_get_val(WID_STATUS, (unsigned char *)&status, 4); + wilc_wlan_cfg_get_val(WID_STATUS, + (unsigned char *)&status, 4); if (wilc->mac_status == WILC_MAC_STATUS_INIT) { wilc->mac_status = status; up(&wilc->sync_event); @@ -589,7 +592,9 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv; PRINT_D(INIT_DBG, "Host = %p\n", hif_drv); - PRINT_D(INIT_DBG, "MAC address is : %02x-%02x-%02x-%02x-%02x-%02x\n", mac_add[0], mac_add[1], mac_add[2], mac_add[3], mac_add[4], mac_add[5]); + PRINT_D(INIT_DBG, "MAC address is : %02x-%02x-%02x-%02x-%02x-%02x\n", + mac_add[0], mac_add[1], mac_add[2], + mac_add[3], mac_add[4], mac_add[5]); wilc_get_chipid(0); *(int *)c_val = 1; @@ -1133,10 +1138,14 @@ int mac_open(struct net_device *ndev) goto _err_; } - wilc_mgmt_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy, nic->wilc_netdev->ieee80211_ptr, - nic->g_struct_frame_reg[0].frame_type, nic->g_struct_frame_reg[0].reg); - wilc_mgmt_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy, nic->wilc_netdev->ieee80211_ptr, - nic->g_struct_frame_reg[1].frame_type, nic->g_struct_frame_reg[1].reg); + wilc_mgmt_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy, + nic->wilc_netdev->ieee80211_ptr, + nic->g_struct_frame_reg[0].frame_type, + nic->g_struct_frame_reg[0].reg); + wilc_mgmt_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy, + nic->wilc_netdev->ieee80211_ptr, + nic->g_struct_frame_reg[1].frame_type, + nic->g_struct_frame_reg[1].reg); netif_wake_queue(ndev); wl->open_ifcs++; nic->mac_opened = 1; @@ -1168,14 +1177,16 @@ static void wilc_set_multicast_list(struct net_device *dev) if (!dev) return; - PRINT_D(INIT_DBG, "Setting Multicast List with count = %d.\n", dev->mc.count); + PRINT_D(INIT_DBG, "Setting Multicast List with count = %d.\n", + dev->mc.count); if (dev->flags & IFF_PROMISC) { PRINT_D(INIT_DBG, "Set promiscuous mode ON, retrive all packets\n"); return; } - if ((dev->flags & IFF_ALLMULTI) || (dev->mc.count) > WILC_MULTICAST_TABLE_SIZE) { + if ((dev->flags & IFF_ALLMULTI) || + (dev->mc.count) > WILC_MULTICAST_TABLE_SIZE) { PRINT_D(INIT_DBG, "Disable multicast filter, retrive all multicast packets\n"); host_int_setup_multicast_filter(hif_drv, false, 0); return; @@ -1256,7 +1267,8 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev) ih = (struct iphdr *)(skb->data + sizeof(struct ethhdr)); pu8UdpBuffer = (char *)ih + sizeof(struct iphdr); - if ((pu8UdpBuffer[1] == 68 && pu8UdpBuffer[3] == 67) || (pu8UdpBuffer[1] == 67 && pu8UdpBuffer[3] == 68)) + if ((pu8UdpBuffer[1] == 68 && pu8UdpBuffer[3] == 67) || + (pu8UdpBuffer[1] == 67 && pu8UdpBuffer[3] == 68)) PRINT_D(GENERIC_DBG, "DHCP Message transmitted, type:%x %x %x\n", pu8UdpBuffer[248], pu8UdpBuffer[249], pu8UdpBuffer[250]); PRINT_D(TX_DBG, "Sending packet - Size = %d - Address = %p - SKB = %p\n", tx_data->size, tx_data->buff, tx_data->skb); @@ -1363,7 +1375,8 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) size = wrq->u.data.length; if (size && wrq->u.data.pointer) { - buff = memdup_user(wrq->u.data.pointer, wrq->u.data.length); + buff = memdup_user(wrq->u.data.pointer, + wrq->u.data.length); if (IS_ERR(buff)) return PTR_ERR(buff); @@ -1568,7 +1581,8 @@ int wilc_netdev_init(struct wilc **wilc) } if (register_netdev(ndev)) { - PRINT_ER("Device couldn't be registered - %s\n", ndev->name); + PRINT_ER("Device couldn't be registered - %s\n", + ndev->name); return -1; } From 5191d771ca3c4e65b338e7d66a457b2341d76ed1 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:22 +0900 Subject: [PATCH 210/843] staging: wilc1000: fixes add spaces required around that '&&' This patch fixes add to spaces around that '&&' or '||'. Reported by checkpatch.pl for spaces required around that '&&' or '||' (ctx:VxE). Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 4b2afa05d176..aecb89d2bc59 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1093,7 +1093,7 @@ int mac_open(struct net_device *ndev) wl = nic->wilc; #ifdef WILC_SPI - if (!wl|| !wl->wilc_spidev) { + if (!wl || !wl->wilc_spidev) { netdev_err(ndev, "wilc1000: SPI device not ready\n"); return -ENODEV; } @@ -1495,8 +1495,7 @@ void wl_wlan_cleanup(struct wilc *wilc) if (wilc && wilc->firmware) release_firmware(wilc->firmware); - if (wilc&& - (wilc->vif[0].ndev || wilc->vif[1].ndev)) { + if (wilc && (wilc->vif[0].ndev || wilc->vif[1].ndev)) { linux_wlan_lock_timeout(&close_exit_sync, 12 * 1000); for (i = 0; i < NUM_CONCURRENT_IFC; i++) From 3d6d8cd890afa9c2bcdc19e5b77e450717f1c7e7 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:23 +0900 Subject: [PATCH 211/843] staging: wilc1000: remove do-nothing if condition case. This patch removes do-nothing if condition case. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index aecb89d2bc59..94efb4a66240 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -326,9 +326,6 @@ void linux_wlan_mac_indicate(struct wilc *wilc, int flag) } else { wilc->mac_status = status; } - - if (wilc->mac_status == WILC_MAC_STATUS_CONNECT) { - } } else if (flag == WILC_MAC_INDICATE_SCAN) { PRINT_D(GENERIC_DBG, "Scanning ...\n"); } From 7e725b474baf922c2c6fe6cdae7bbb81abe55a64 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:24 +0900 Subject: [PATCH 212/843] staging: wilc1000: rename function GetIfHandler This patch renames GetIfHandler function name to get_if_handler to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 94efb4a66240..3da80cd54c4b 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -331,7 +331,7 @@ void linux_wlan_mac_indicate(struct wilc *wilc, int flag) } } -struct net_device *GetIfHandler(struct wilc *wilc, u8 *pMacHeader) +struct net_device *get_if_handler(struct wilc *wilc, u8 *pMacHeader) { u8 *Bssid, *Bssid1; int i = 0; @@ -1422,7 +1422,7 @@ void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset) struct net_device *wilc_netdev; perInterface_wlan_t *nic; - wilc_netdev = GetIfHandler(wilc, buff); + wilc_netdev = get_if_handler(wilc, buff); if (!wilc_netdev) return; From 51456c2a6152130d093d81f1148383aae09cb355 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:25 +0900 Subject: [PATCH 213/843] staging: wilc1000: rename pMacHeader of function get_if_handler This patch renames pMacHeader of function get_if_handler to mac_header to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 3da80cd54c4b..67e89286f13b 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -331,13 +331,13 @@ void linux_wlan_mac_indicate(struct wilc *wilc, int flag) } } -struct net_device *get_if_handler(struct wilc *wilc, u8 *pMacHeader) +struct net_device *get_if_handler(struct wilc *wilc, u8 *mac_header) { u8 *Bssid, *Bssid1; int i = 0; - Bssid = pMacHeader + 10; - Bssid1 = pMacHeader + 4; + Bssid = mac_header + 10; + Bssid1 = mac_header + 4; for (i = 0; i < wilc->vif_num; i++) if (!memcmp(Bssid1, wilc->vif[i].bssid, ETH_ALEN) || @@ -346,9 +346,9 @@ struct net_device *get_if_handler(struct wilc *wilc, u8 *pMacHeader) PRINT_INFO(INIT_DBG, "Invalide handle\n"); for (i = 0; i < 25; i++) - PRINT_D(INIT_DBG, "%02x ", pMacHeader[i]); - Bssid = pMacHeader + 18; - Bssid1 = pMacHeader + 12; + PRINT_D(INIT_DBG, "%02x ", mac_header[i]); + Bssid = mac_header + 18; + Bssid1 = mac_header + 12; for (i = 0; i < wilc->vif_num; i++) if (!memcmp(Bssid1, wilc->vif[i].bssid, ETH_ALEN) || !memcmp(Bssid, wilc->vif[i].bssid, ETH_ALEN)) From d239222e82a209af611840b2a7cd72c26944eb12 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:26 +0900 Subject: [PATCH 214/843] staging: wilc1000: rename Bssid of function get_if_handler This patch renames Bssid of function get_if_handler to bssid to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 67e89286f13b..64b7c4f340a8 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -333,25 +333,25 @@ void linux_wlan_mac_indicate(struct wilc *wilc, int flag) struct net_device *get_if_handler(struct wilc *wilc, u8 *mac_header) { - u8 *Bssid, *Bssid1; + u8 *bssid, *Bssid1; int i = 0; - Bssid = mac_header + 10; + bssid = mac_header + 10; Bssid1 = mac_header + 4; for (i = 0; i < wilc->vif_num; i++) if (!memcmp(Bssid1, wilc->vif[i].bssid, ETH_ALEN) || - !memcmp(Bssid, wilc->vif[i].bssid, ETH_ALEN)) + !memcmp(bssid, wilc->vif[i].bssid, ETH_ALEN)) return wilc->vif[i].ndev; PRINT_INFO(INIT_DBG, "Invalide handle\n"); for (i = 0; i < 25; i++) PRINT_D(INIT_DBG, "%02x ", mac_header[i]); - Bssid = mac_header + 18; + bssid = mac_header + 18; Bssid1 = mac_header + 12; for (i = 0; i < wilc->vif_num; i++) if (!memcmp(Bssid1, wilc->vif[i].bssid, ETH_ALEN) || - !memcmp(Bssid, wilc->vif[i].bssid, ETH_ALEN)) + !memcmp(bssid, wilc->vif[i].bssid, ETH_ALEN)) return wilc->vif[i].ndev; PRINT_INFO(INIT_DBG, "\n"); From 660786eae129346c31f79d73a6ff3c8d3f70fd45 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:27 +0900 Subject: [PATCH 215/843] staging: wilc1000: rename Bssid1 of function get_if_handler This patch renames Bssid1 of function get_if_handler to bssid1 to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 64b7c4f340a8..6758cbc04af9 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -333,14 +333,14 @@ void linux_wlan_mac_indicate(struct wilc *wilc, int flag) struct net_device *get_if_handler(struct wilc *wilc, u8 *mac_header) { - u8 *bssid, *Bssid1; + u8 *bssid, *bssid1; int i = 0; bssid = mac_header + 10; - Bssid1 = mac_header + 4; + bssid1 = mac_header + 4; for (i = 0; i < wilc->vif_num; i++) - if (!memcmp(Bssid1, wilc->vif[i].bssid, ETH_ALEN) || + if (!memcmp(bssid1, wilc->vif[i].bssid, ETH_ALEN) || !memcmp(bssid, wilc->vif[i].bssid, ETH_ALEN)) return wilc->vif[i].ndev; @@ -348,9 +348,9 @@ struct net_device *get_if_handler(struct wilc *wilc, u8 *mac_header) for (i = 0; i < 25; i++) PRINT_D(INIT_DBG, "%02x ", mac_header[i]); bssid = mac_header + 18; - Bssid1 = mac_header + 12; + bssid1 = mac_header + 12; for (i = 0; i < wilc->vif_num; i++) - if (!memcmp(Bssid1, wilc->vif[i].bssid, ETH_ALEN) || + if (!memcmp(bssid1, wilc->vif[i].bssid, ETH_ALEN) || !memcmp(bssid, wilc->vif[i].bssid, ETH_ALEN)) return wilc->vif[i].ndev; From f66dee7bfd5d378351c435ad8d49b7b8c2f1b665 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:28 +0900 Subject: [PATCH 216/843] staging: wilc1000: rename pBSSID of function linux_wlan_set_bssid This patch renames pBSSID of function linux_wlan_set_bssid to bssid to avoid CamelCase naming convention. Also, prototype linux_wlan_set_bssid in wilc_wfi_cfgoperations.c is moved to wilc_wfi_netdevice.h. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 4 ++-- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 -- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 + 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 6758cbc04af9..2fac99d05902 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -358,7 +358,7 @@ struct net_device *get_if_handler(struct wilc *wilc, u8 *mac_header) return NULL; } -int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID) +int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid) { int i = 0; int ret = -1; @@ -370,7 +370,7 @@ int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID) for (i = 0; i < wilc->vif_num; i++) if (wilc->vif[i].ndev == wilc_netdev) { - memcpy(wilc->vif[i].bssid, pBSSID, 6); + memcpy(wilc->vif[i].bssid, bssid, 6); ret = 0; break; } diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 32b93d3f806d..e8c82725d628 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -505,8 +505,6 @@ int WILC_WFI_Set_PMKSA(u8 *bssid, struct wilc_priv *priv) } -int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID); - /** * @brief CfgConnectResult diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 07917ea105b6..9b11b713b8c8 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -219,4 +219,5 @@ void wilc1000_wlan_deinit(struct net_device *dev); void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size); u16 Set_machw_change_vir_if(struct net_device *dev, bool bValue); int linux_wlan_get_firmware(struct net_device *dev); +int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid); #endif From 1b7a93ad9a5ebdef7968d2bf6c5ebd1db2c3e022 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:29 +0900 Subject: [PATCH 217/843] staging: wilc1000: fixes braces {} should be used on all arms of this statement This patch fixes the checks reported by checkpatch.pl for braces {} should be used on all arms of this statement. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 2fac99d05902..893c741794b8 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -477,12 +477,11 @@ int linux_wlan_get_firmware(struct net_device *dev) nic = netdev_priv(dev); wilc = nic->wilc; - if (nic->iftype == AP_MODE) + if (nic->iftype == AP_MODE) { firmware = AP_FIRMWARE; - else if (nic->iftype == STATION_MODE) + } else if (nic->iftype == STATION_MODE) { firmware = STA_FIRMWARE; - - else { + } else { PRINT_D(INIT_DBG, "Get P2P_CONCURRENCY_FIRMWARE\n"); firmware = P2P_CONCURRENCY_FIRMWARE; } From 0aeea1ad2ab342153019b676a2d3cbbb45669c79 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:30 +0900 Subject: [PATCH 218/843] staging: wilc1000: remove goto from linux_wlan_start_firmware This patch remove goto feature from linux_wlan_start_firmware function. Goto feature is return result. So, remove goto functions and it was replaced with the return value directly. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 893c741794b8..fcc811909343 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -529,19 +529,18 @@ static int linux_wlan_start_firmware(struct net_device *dev) ret = wilc_wlan_start(); if (ret < 0) { PRINT_ER("Failed to start Firmware\n"); - goto _fail_; + return ret; } PRINT_D(INIT_DBG, "Waiting for Firmware to get ready ...\n"); ret = linux_wlan_lock_timeout(&wilc->sync_event, 5000); if (ret) { PRINT_D(INIT_DBG, "Firmware start timed out"); - goto _fail_; + return ret; } PRINT_D(INIT_DBG, "Firmware successfully started\n"); -_fail_: - return ret; + return 0; } static int linux_wlan_firmware_download(struct net_device *dev) { From 14b1821dd2ee72ac5ce360c8a420f4e87b0e923a Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:31 +0900 Subject: [PATCH 219/843] staging: wilc1000: remove goto from linux_wlan_firmware_download This patch remove goto feature from linux_wlan_firmware_download function. Goto feature is return result. So, remove goto functions and it was replaced with the return value directly. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index fcc811909343..003165d57cfb 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -553,14 +553,13 @@ static int linux_wlan_firmware_download(struct net_device *dev) if (!wilc->firmware) { PRINT_ER("Firmware buffer is NULL\n"); - ret = -ENOBUFS; - goto _FAIL_; + return -ENOBUFS; } PRINT_D(INIT_DBG, "Downloading Firmware ...\n"); ret = wilc_wlan_firmware_download(wilc->firmware->data, wilc->firmware->size); if (ret < 0) - goto _FAIL_; + return ret; PRINT_D(INIT_DBG, "Freeing FW buffer ...\n"); PRINT_D(INIT_DBG, "Releasing firmware\n"); @@ -568,8 +567,7 @@ static int linux_wlan_firmware_download(struct net_device *dev) PRINT_D(INIT_DBG, "Download Succeeded\n"); -_FAIL_: - return ret; + return 0; } static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_nic) From a40b22c544ce6bd70f14cf8c5fcb07ef5e64e5d5 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:32 +0900 Subject: [PATCH 220/843] staging: wilc1000: fixes missing a blank line after declarations This patch fixes the warnings reported by checkpatch.pl for Missing a blank line after declarations. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 003165d57cfb..c529a1572355 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -542,6 +542,7 @@ static int linux_wlan_start_firmware(struct net_device *dev) return 0; } + static int linux_wlan_firmware_download(struct net_device *dev) { perInterface_wlan_t *nic; @@ -880,6 +881,7 @@ static int wlan_deinit_locks(struct net_device *dev) return 0; } + void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic) { PRINT_D(INIT_DBG, "Linux to Wlan services ...\n"); From 6bc72c5ac7996819961bf65d64693efd3135ea42 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:33 +0900 Subject: [PATCH 221/843] staging: wilc1000: remove goto from wlan_initialize_threads This patch remove goto feature from wlan_initialize_threads function. Goto feature is 'wilc->close=0' & return result. So, remove goto feature and it was replaced with the return value directly, as well as removed unused ret variable. Also, execute 'wilc->close=0' before return. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index c529a1572355..3c8155ec657c 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -911,7 +911,6 @@ int wlan_initialize_threads(struct net_device *dev) { perInterface_wlan_t *nic; struct wilc *wilc; - int ret = 0; nic = netdev_priv(dev); wilc = nic->wilc; @@ -922,16 +921,12 @@ int wlan_initialize_threads(struct net_device *dev) "K_TXQ_TASK"); if (!wilc->txq_thread) { PRINT_ER("couldn't create TXQ thread\n"); - ret = -ENOBUFS; - goto _fail_2; + wilc->close = 0; + return -ENOBUFS; } down(&wilc->txq_thread_started); return 0; - -_fail_2: - wilc->close = 0; - return ret; } static void wlan_deinitialize_threads(struct net_device *dev) From 339d244a124da49ba1100189cf881448a30b8774 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:34 +0900 Subject: [PATCH 222/843] staging: wilc1000: remove goto from mac_open This patch removes goto from mac_open function. If address is invalid, goto handles deinit process and return result. So, just call deinit process and return the error value directly instead of goto statement. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 3c8155ec657c..6492103f6bb1 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1124,8 +1124,9 @@ int mac_open(struct net_device *ndev) if (!is_valid_ether_addr(ndev->dev_addr)) { PRINT_ER("Error: Wrong MAC address\n"); - ret = -EINVAL; - goto _err_; + wilc_deinit_host_int(ndev); + wilc1000_wlan_deinit(ndev); + return -EINVAL; } wilc_mgmt_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy, @@ -1140,11 +1141,6 @@ int mac_open(struct net_device *ndev) wl->open_ifcs++; nic->mac_opened = 1; return 0; - -_err_: - wilc_deinit_host_int(ndev); - wilc1000_wlan_deinit(ndev); - return ret; } struct net_device_stats *mac_stats(struct net_device *dev) From 2ad8c47d5c6c989cd7a1fd3eeb4e3c7c09dd327b Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:35 +0900 Subject: [PATCH 223/843] staging: wilc1000: rename Set_machw_change_vir_if function This patch rename Set_machw_change_vir_if function to set_machw_change_vir_if to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++--- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +- drivers/staging/wilc1000/wilc_wlan.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 6492103f6bb1..79e755c108af 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1107,7 +1107,7 @@ int mac_open(struct net_device *ndev) return ret; } - Set_machw_change_vir_if(ndev, false); + set_machw_change_vir_if(ndev, false); host_int_get_MacAddress(priv->hWILCWFIDrv, mac_add); PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add); diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index e8c82725d628..5291868b7077 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1408,7 +1408,7 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev, g_key_gtk_params.seq = NULL; /*Reset WILC_CHANGING_VIR_IF register to allow adding futrue keys to CE H/W*/ - Set_machw_change_vir_if(netdev, false); + set_machw_change_vir_if(netdev, false); } if (key_index >= 0 && key_index <= 3) { @@ -2548,7 +2548,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, PRINT_D(GENERIC_DBG, "Changing virtual interface, enable scan\n"); /*Set WILC_CHANGING_VIR_IF register to disallow adding futrue keys to CE H/W*/ if (g_ptk_keys_saved && g_gtk_keys_saved) { - Set_machw_change_vir_if(dev, true); + set_machw_change_vir_if(dev, true); } switch (type) { @@ -2710,7 +2710,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, /*Refresh scan, to refresh the scan results to the wpa_supplicant. Set MachHw to false to enable further key installments*/ refresh_scan(priv, 1, true); - Set_machw_change_vir_if(dev, false); + set_machw_change_vir_if(dev, false); if (wl->initialized) { for (i = 0; i < num_reg_frame; i++) { diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 9b11b713b8c8..6f9da09f74c0 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -217,7 +217,7 @@ void wl_wlan_cleanup(struct wilc *wilc); int wilc_netdev_init(struct wilc **wilc); void wilc1000_wlan_deinit(struct net_device *dev); void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size); -u16 Set_machw_change_vir_if(struct net_device *dev, bool bValue); +u16 set_machw_change_vir_if(struct net_device *dev, bool bValue); int linux_wlan_get_firmware(struct net_device *dev); int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid); #endif diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 16224cefea79..0e5535e7c704 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -2052,7 +2052,7 @@ _fail_: } -u16 Set_machw_change_vir_if(struct net_device *dev, bool bValue) +u16 set_machw_change_vir_if(struct net_device *dev, bool bValue) { u16 ret; u32 reg; From e5f352441b5eace23a402b3919e02852505cf6e7 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:36 +0900 Subject: [PATCH 224/843] staging: wilc1000: rename host_int_get_MacAddress function This patch rename host_int_get_MacAddress function to hif_get_mac_address to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 2 +- drivers/staging/wilc1000/host_interface.h | 2 +- drivers/staging/wilc1000/linux_wlan.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index d0e4039e6ed1..84a247960090 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3396,7 +3396,7 @@ s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv, return 0; } -s32 host_int_get_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress) +s32 hif_get_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress) { s32 result = 0; struct host_if_msg msg; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index f73817a4d435..f70da7556a81 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -333,7 +333,7 @@ s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hWFIDrv, u8 u8Psklength); s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hWFIDrv, u8 *pu8PassPhrase, u8 u8Psklength); -s32 host_int_get_MacAddress(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress); +s32 hif_get_mac_address(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress); s32 host_int_set_MacAddress(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress); int host_int_wait_msg_queue_idle(void); s32 host_int_set_start_scan_req(struct host_if_drv *hWFIDrv, u8 scanSource); diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 79e755c108af..f2de20ba2a29 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1109,7 +1109,7 @@ int mac_open(struct net_device *ndev) set_machw_change_vir_if(ndev, false); - host_int_get_MacAddress(priv->hWILCWFIDrv, mac_add); + hif_get_mac_address(priv->hWILCWFIDrv, mac_add); PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add); for (i = 0; i < wl->vif_num; i++) { From 9457b05ec50de47db5144c7747a4d0ca888bcb41 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:37 +0900 Subject: [PATCH 225/843] staging: wilc1000: rename s32Error of mac_ioctl function This patch rename s32Error variable of mac_ioctl function to ret to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index f2de20ba2a29..f1dcdfbe6d66 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1344,7 +1344,7 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) u32 size = 0, length = 0; perInterface_wlan_t *nic; struct wilc_priv *priv; - s32 s32Error = 0; + s32 ret = 0; struct wilc *wilc; nic = netdev_priv(ndev); @@ -1368,8 +1368,9 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) if (strncasecmp(buff, "RSSI", length) == 0) { priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy); - s32Error = host_int_get_rssi(priv->hWILCWFIDrv, &(rssi)); - if (s32Error) + ret = host_int_get_rssi(priv->hWILCWFIDrv, + &rssi); + if (ret) PRINT_ER("Failed to send get rssi param's message queue "); PRINT_INFO(GENERIC_DBG, "RSSI :%d\n", rssi); @@ -1379,7 +1380,7 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) if (copy_to_user(wrq->u.data.pointer, buff, size)) { PRINT_ER("%s: failed to copy data to user buffer\n", __func__); - s32Error = -EFAULT; + ret = -EFAULT; goto done; } } @@ -1390,7 +1391,7 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) default: { PRINT_INFO(GENERIC_DBG, "Command - %d - has been received\n", cmd); - s32Error = -EOPNOTSUPP; + ret = -EOPNOTSUPP; goto done; } } @@ -1399,7 +1400,7 @@ done: kfree(buff); - return s32Error; + return ret; } void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset) From 44ec3b75a68e071fbc4f30387a02f93ba1a3b358 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:38 +0900 Subject: [PATCH 226/843] staging: wilc1000: rename QueueCount of mac_xmit function This patch rename QueueCount variable of mac_xmit function to queue_count to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index f1dcdfbe6d66..7a07e431f731 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1218,7 +1218,7 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev) { perInterface_wlan_t *nic; struct tx_complete_data *tx_data = NULL; - int QueueCount; + int queue_count; char *pu8UdpBuffer; struct iphdr *ih; struct ethhdr *eth_h; @@ -1262,11 +1262,11 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev) nic->netstats.tx_packets++; nic->netstats.tx_bytes += tx_data->size; tx_data->pBssid = wilc->vif[nic->u8IfIdx].bssid; - QueueCount = wilc_wlan_txq_add_net_pkt(ndev, (void *)tx_data, - tx_data->buff, tx_data->size, - linux_wlan_tx_complete); + queue_count = wilc_wlan_txq_add_net_pkt(ndev, (void *)tx_data, + tx_data->buff, tx_data->size, + linux_wlan_tx_complete); - if (QueueCount > FLOW_CONTROL_UPPER_THRESHOLD) { + if (queue_count > FLOW_CONTROL_UPPER_THRESHOLD) { netif_stop_queue(wilc->vif[0].ndev); netif_stop_queue(wilc->vif[1].ndev); } From fd8f03671b991031e4ed0f2840e36a3607aa57b2 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 5 Nov 2015 14:36:39 +0900 Subject: [PATCH 227/843] staging: wilc1000: rename pu8UdpBuffer of mac_xmit function This patch rename pu8UdpBuffer variable of mac_xmit function to udp_buf to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 7a07e431f731..f82ecb99a7a5 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1219,7 +1219,7 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev) perInterface_wlan_t *nic; struct tx_complete_data *tx_data = NULL; int queue_count; - char *pu8UdpBuffer; + char *udp_buf; struct iphdr *ih; struct ethhdr *eth_h; struct wilc *wilc; @@ -1252,10 +1252,11 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev) ih = (struct iphdr *)(skb->data + sizeof(struct ethhdr)); - pu8UdpBuffer = (char *)ih + sizeof(struct iphdr); - if ((pu8UdpBuffer[1] == 68 && pu8UdpBuffer[3] == 67) || - (pu8UdpBuffer[1] == 67 && pu8UdpBuffer[3] == 68)) - PRINT_D(GENERIC_DBG, "DHCP Message transmitted, type:%x %x %x\n", pu8UdpBuffer[248], pu8UdpBuffer[249], pu8UdpBuffer[250]); + udp_buf = (char *)ih + sizeof(struct iphdr); + if ((udp_buf[1] == 68 && udp_buf[3] == 67) || + (udp_buf[1] == 67 && udp_buf[3] == 68)) + PRINT_D(GENERIC_DBG, "DHCP Message transmitted, type:%x %x %x\n", + udp_buf[248], udp_buf[249], udp_buf[250]); PRINT_D(TX_DBG, "Sending packet - Size = %d - Address = %p - SKB = %p\n", tx_data->size, tx_data->buff, tx_data->skb); PRINT_D(TX_DBG, "Adding tx packet to TX Queue\n"); From b22fa80cdbf4ff1056ecddb4efdcc0ede5f5f422 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Thu, 5 Nov 2015 16:12:08 +0900 Subject: [PATCH 228/843] staging: wilc1000: fix kbuild test robot error This patch fixes build warning and error reported by kbuild test robot. It is fixed by including netdevice.h. >> drivers/staging/wilc1000/wilc_wlan_if.h:940:27: warning: 'struct net_device' declared inside parameter list int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp); >> drivers/staging/wilc1000/wilc_wlan_if.h:940:27: warning: its scope is only this definition or declaration, which is probably not what you want >> drivers/staging/wilc1000/wilc_wlan.c:1954:5: error: conflicting types for 'wilc_wlan_init' int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) Fixes: 30135ce ("staging: wilc1000: wilc_wlan_init: add argument struct net_device") Reported-by: kbuild test robot Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan_if.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index f11003d14486..12cbc4bcac90 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -12,6 +12,7 @@ #include #include "linux_wlan_common.h" +#include /******************************************** * From 83231b7233bfc924e7059512f3c497c8e90f2c2b Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:22 +0900 Subject: [PATCH 229/843] staging: wilc1000: fixes alignment should match open parenthesis This patch fixes the checks reported by checkpatch.pl for alignment should match open parenthesis Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index f82ecb99a7a5..976964d57581 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -264,9 +264,11 @@ static int init_irq(struct net_device *dev) PRINT_ER("could not obtain gpio for WILC_INTR\n"); } - if ((ret != -1) && (request_threaded_irq(wl->dev_irq_num, isr_uh_routine, isr_bh_routine, - IRQF_TRIGGER_LOW | IRQF_ONESHOT, - "WILC_IRQ", dev)) < 0) { + if (ret != -1 && request_threaded_irq(wl->dev_irq_num, + isr_uh_routine, + isr_bh_routine, + IRQF_TRIGGER_LOW | IRQF_ONESHOT, + "WILC_IRQ", dev) < 0) { PRINT_ER("Failed to request IRQ for GPIO: %d\n", GPIO_NUM); ret = -1; } else { @@ -1472,8 +1474,7 @@ void wl_wlan_cleanup(struct wilc *wilc) int i = 0; perInterface_wlan_t *nic[NUM_CONCURRENT_IFC]; - if (wilc && - (wilc->vif[0].ndev || wilc->vif[1].ndev)) { + if (wilc && (wilc->vif[0].ndev || wilc->vif[1].ndev)) { unregister_inetaddr_notifier(&g_dev_notifier); for (i = 0; i < NUM_CONCURRENT_IFC; i++) From b38e903090e12503a21183916ec8e5101b3ed610 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:23 +0900 Subject: [PATCH 230/843] staging: wilc1000: fixes a struct allocation to match coding standards This patch fixes the checks reported by checkpatch.pl for prefer kmalloc(sizeof(*tx_data)...) over kmalloc(sizeof(struct tx_complete_data)...) Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 976964d57581..947c9f991600 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1236,7 +1236,7 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev) return 0; } - tx_data = kmalloc(sizeof(struct tx_complete_data), GFP_ATOMIC); + tx_data = kmalloc(sizeof(*tx_data), GFP_ATOMIC); if (!tx_data) { PRINT_ER("Failed to allocate memory for tx_data structure\n"); dev_kfree_skb(skb); From c8537e6dbaaeb259e6e29259cf3fd224a7f480ba Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:24 +0900 Subject: [PATCH 231/843] staging: wilc1000: fixes that open brace { should be on the previous line This patch fixes the error reported by checkpatch.pl for that open brace { should be on the previous line. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 947c9f991600..c94cb1362a55 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1186,8 +1186,7 @@ static void wilc_set_multicast_list(struct net_device *dev) return; } - netdev_for_each_mc_addr(ha, dev) - { + netdev_for_each_mc_addr(ha, dev) { memcpy(multicast_mac_addr_list[i], ha->addr, ETH_ALEN); PRINT_D(INIT_DBG, "Entry[%d]: %x:%x:%x:%x:%x:%x\n", i, multicast_mac_addr_list[i][0], From ac087c82c4ec088c31a117e209a7367dc68ed854 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:25 +0900 Subject: [PATCH 232/843] staging: wilc1000: wilc_wlan.c: remove over-commenting There are over-commenting in the wilc_wlan.c file and most of them are not helpful to explain what the code does and generate 80 ending line over warnings. So, all of comments are removed in this patch and the comments will later be added if necessary with the preferred Linux style. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 330 +++------------------------ 1 file changed, 27 insertions(+), 303 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 0e5535e7c704..7aaad0f3928a 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1,21 +1,7 @@ -/* ////////////////////////////////////////////////////////////////////////// */ -/* */ -/* Copyright (c) Atmel Corporation. All rights reserved. */ -/* */ -/* Module Name: wilc_wlan.c */ -/* */ -/* */ -/* //////////////////////////////////////////////////////////////////////////// */ - #include "wilc_wlan_if.h" #include "wilc_wfi_netdevice.h" #include "wilc_wlan_cfg.h" -/******************************************** - * - * Global - * - ********************************************/ extern wilc_hif_func_t hif_sdio; extern wilc_hif_func_t hif_spi; u32 wilc_get_chipid(u8 update); @@ -24,42 +10,20 @@ u32 wilc_get_chipid(u8 update); typedef struct { int quit; - - /** - * input interface functions - **/ wilc_wlan_io_func_t io_func; - - /** - * host interface functions - **/ wilc_hif_func_t hif_func; - - /** - * configuration interface functions - **/ int cfg_frame_in_use; wilc_cfg_frame_t cfg_frame; u32 cfg_frame_offset; int cfg_seq_no; - /** - * RX buffer - **/ #ifdef MEMORY_STATIC u8 *rx_buffer; u32 rx_buffer_offset; #endif - /** - * TX buffer - **/ u8 *tx_buffer; u32 tx_buffer_offset; - /** - * TX queue - **/ - unsigned long txq_spinlock_flags; struct txq_entry_t *txq_head; @@ -67,9 +31,6 @@ typedef struct { int txq_entries; int txq_exit; - /** - * RX queue - **/ struct rxq_entry_t *rxq_head; struct rxq_entry_t *rxq_tail; int rxq_entries; @@ -82,12 +43,6 @@ static wilc_wlan_dev_t g_wlan; static inline void chip_allow_sleep(void); static inline void chip_wakeup(void); -/******************************************** - * - * Debug - * - ********************************************/ - static u32 dbgflag = N_INIT | N_ERR | N_INTR | N_TXQ | N_RXQ; static void wilc_debug(u32 flag, char *fmt, ...) @@ -106,9 +61,6 @@ static void wilc_debug(u32 flag, char *fmt, ...) static CHIP_PS_STATE_T genuChipPSstate = CHIP_WAKEDUP; -/*acquire_bus() and release_bus() are made static inline functions*/ -/*as a temporary workaround to fix a problem of receiving*/ -/*unknown interrupt from FW*/ static inline void acquire_bus(BUS_ACQUIRE_T acquire) { @@ -130,11 +82,6 @@ static inline void release_bus(BUS_RELEASE_T release) #endif mutex_unlock(&g_linux_wlan->hif_cs); } -/******************************************** - * - * Queue - * - ********************************************/ static void wilc_wlan_txq_remove(struct txq_entry_t *tqe) { @@ -219,9 +166,6 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev, spin_unlock_irqrestore(&wilc->txq_spinlock, flags); - /** - * wake up TX queue - **/ PRINT_D(TX_DBG, "Wake the txq_handling\n"); up(&wilc->txq_event); @@ -253,11 +197,6 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe) spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags); up(&g_linux_wlan->txq_add_to_head_cs); - - - /** - * wake up TX queue - **/ up(&g_linux_wlan->txq_event); PRINT_D(TX_DBG, "Wake up the txq_handler\n"); @@ -281,7 +220,7 @@ typedef struct { u32 ack_num; u32 Session_index; struct txq_entry_t *txqe; -} Pending_Acks_info_t /*Ack_info_t*/; +} Pending_Acks_info_t; @@ -373,7 +312,7 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe) eth_hdr_ptr = &buffer[0]; h_proto = ntohs(*((unsigned short *)ð_hdr_ptr[12])); - if (h_proto == 0x0800) { /* IP */ + if (h_proto == 0x0800) { u8 *ip_hdr_ptr; u8 protocol; @@ -389,7 +328,7 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe) IHL = (ip_hdr_ptr[0] & 0xf) << 2; Total_Length = (((u32)ip_hdr_ptr[2]) << 8) + ((u32)ip_hdr_ptr[3]); Data_offset = (((u32)tcp_hdr_ptr[12] & 0xf0) >> 2); - if (Total_Length == (IHL + Data_offset)) { /*we want to recognize the clear Acks(packet only carry Ack infos not with data) so data size must be equal zero*/ + if (Total_Length == (IHL + Data_offset)) { u32 seq_no, Ack_no; seq_no = (((u32)tcp_hdr_ptr[4]) << 24) + (((u32)tcp_hdr_ptr[5]) << 16) + (((u32)tcp_hdr_ptr[6]) << 8) + ((u32)tcp_hdr_ptr[7]); @@ -443,7 +382,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) if (tqe) { wilc_wlan_txq_remove(tqe); Statisitcs_DroppedAcks++; - tqe->status = 1; /* mark the packet send */ + tqe->status = 1; if (tqe->tx_complete_func) tqe->tx_complete_func(tqe->priv, tqe->status); kfree(tqe); @@ -463,7 +402,6 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) spin_unlock_irqrestore(&wilc->txq_spinlock, p->txq_spinlock_flags); while (Dropped > 0) { - /*consume the semaphore count of the removed packet*/ linux_wlan_lock_timeout(&wilc->txq_event, 1); Dropped--; } @@ -510,9 +448,6 @@ static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 buffer_size) #ifdef TCP_ACK_FILTER tqe->tcp_PendingAck_index = NOT_TCP_ACK; #endif - /** - * Configuration packet always at the front - **/ PRINT_D(TX_DBG, "Adding the config packet at the Queue tail\n"); if (wilc_wlan_txq_add_to_head(tqe)) @@ -546,7 +481,6 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, tcp_process(dev, tqe); #endif wilc_wlan_txq_add_to_tail(dev, tqe); - /*return number of itemes in the queue*/ return p->txq_entries; } @@ -651,22 +585,12 @@ static struct rxq_entry_t *wilc_wlan_rxq_remove(struct wilc *wilc) return NULL; } - -/******************************************** - * - * Power Save handle functions - * - ********************************************/ - - - #ifdef WILC_OPTIMIZE_SLEEP_INT static inline void chip_allow_sleep(void) { u32 reg = 0; - /* Clear bit 1 */ g_wlan.hif_func.hif_read_reg(0xf0, ®); g_wlan.hif_func.hif_write_reg(0xf0, reg & ~BIT(0)); @@ -680,17 +604,11 @@ static inline void chip_wakeup(void) if ((g_wlan.io_func.io_type & 0x1) == HIF_SPI) { do { g_wlan.hif_func.hif_read_reg(1, ®); - /* Set bit 1 */ g_wlan.hif_func.hif_write_reg(1, reg | BIT(1)); - - /* Clear bit 1*/ g_wlan.hif_func.hif_write_reg(1, reg & ~BIT(1)); do { - /* Wait for the chip to stabilize*/ usleep_range(2 * 1000, 2 * 1000); - /* Make sure chip is awake. This is an extra step that can be removed */ - /* later to avoid the bus access overhead */ if ((wilc_get_chipid(true) == 0)) wilc_debug(N_ERR, "Couldn't read chip id. Wake up failed\n"); @@ -700,30 +618,19 @@ static inline void chip_wakeup(void) } else if ((g_wlan.io_func.io_type & 0x1) == HIF_SDIO) { g_wlan.hif_func.hif_read_reg(0xf0, ®); do { - /* Set bit 1 */ g_wlan.hif_func.hif_write_reg(0xf0, reg | BIT(0)); - - /* Check the clock status */ g_wlan.hif_func.hif_read_reg(0xf1, &clk_status_reg); - /* in case of clocks off, wait 2ms, and check it again. */ - /* if still off, wait for another 2ms, for a total wait of 6ms. */ - /* If still off, redo the wake up sequence */ while (((clk_status_reg & 0x1) == 0) && (((++trials) % 3) == 0)) { - /* Wait for the chip to stabilize*/ usleep_range(2 * 1000, 2 * 1000); - /* Make sure chip is awake. This is an extra step that can be removed */ - /* later to avoid the bus access overhead */ g_wlan.hif_func.hif_read_reg(0xf1, &clk_status_reg); if ((clk_status_reg & 0x1) == 0) wilc_debug(N_ERR, "clocks still OFF. Wake up failed\n"); } - /* in case of failure, Reset the wakeup bit to introduce a new edge on the next loop */ if ((clk_status_reg & 0x1) == 0) { - /* Reset bit 0 */ g_wlan.hif_func.hif_write_reg(0xf0, reg & (~BIT(0))); } @@ -737,7 +644,6 @@ static inline void chip_wakeup(void) g_wlan.hif_func.hif_write_reg(0x1C0C, reg); if (wilc_get_chipid(false) >= 0x1002b0) { - /* Enable PALDO back right after wakeup */ u32 val32; g_wlan.hif_func.hif_read_reg(0x1e1c, &val32); @@ -759,28 +665,19 @@ static inline void chip_wakeup(void) do { if ((g_wlan.io_func.io_type & 0x1) == HIF_SPI) { g_wlan.hif_func.hif_read_reg(1, ®); - /* Make sure bit 1 is 0 before we start. */ g_wlan.hif_func.hif_write_reg(1, reg & ~BIT(1)); - /* Set bit 1 */ g_wlan.hif_func.hif_write_reg(1, reg | BIT(1)); - /* Clear bit 1*/ g_wlan.hif_func.hif_write_reg(1, reg & ~BIT(1)); } else if ((g_wlan.io_func.io_type & 0x1) == HIF_SDIO) { - /* Make sure bit 0 is 0 before we start. */ g_wlan.hif_func.hif_read_reg(0xf0, ®); g_wlan.hif_func.hif_write_reg(0xf0, reg & ~BIT(0)); - /* Set bit 1 */ g_wlan.hif_func.hif_write_reg(0xf0, reg | BIT(0)); - /* Clear bit 1 */ g_wlan.hif_func.hif_write_reg(0xf0, reg & ~BIT(0)); } do { - /* Wait for the chip to stabilize*/ mdelay(3); - /* Make sure chip is awake. This is an extra step that can be removed */ - /* later to avoid the bus access overhead */ if ((wilc_get_chipid(true) == 0)) wilc_debug(N_ERR, "Couldn't read chip id. Wake up failed\n"); @@ -794,7 +691,6 @@ static inline void chip_wakeup(void) g_wlan.hif_func.hif_write_reg(0x1C0C, reg); if (wilc_get_chipid(false) >= 0x1002b0) { - /* Enable PALDO back right after wakeup */ u32 val32; g_wlan.hif_func.hif_read_reg(0x1e1c, &val32); @@ -811,17 +707,13 @@ static inline void chip_wakeup(void) #endif void chip_sleep_manually(u32 u32SleepTime) { - if (genuChipPSstate != CHIP_WAKEDUP) { - /* chip is already sleeping. Do nothing */ + if (genuChipPSstate != CHIP_WAKEDUP) return; - } acquire_bus(ACQUIRE_ONLY); #ifdef WILC_OPTIMIZE_SLEEP_INT chip_allow_sleep(); #endif - - /* Trigger the manual sleep interrupt */ g_wlan.hif_func.hif_write_reg(0x10a8, 1); genuChipPSstate = CHIP_SLEEPING_MANUAL; @@ -829,12 +721,6 @@ void chip_sleep_manually(u32 u32SleepTime) } - -/******************************************** - * - * Tx, Rx queue handle functions - * - ********************************************/ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) { wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan; @@ -865,15 +751,12 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) #ifdef TCP_ACK_FILTER wilc_wlan_txq_filter_dup_tcp_ack(dev); #endif - /** - * build the vmm list - **/ PRINT_D(TX_DBG, "Getting the head of the TxQ\n"); tqe = wilc_wlan_txq_get_first(wilc); i = 0; sum = 0; do { - if ((tqe != NULL) && (i < (WILC_VMM_TBL_SIZE - 1)) /* reserve last entry to 0 */) { + if ((tqe != NULL) && (i < (WILC_VMM_TBL_SIZE - 1))) { if (tqe->type == WILC_CFG_PKT) vmm_sz = ETH_CONFIG_PKT_HDR_OFFSET; @@ -886,14 +769,14 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) vmm_sz += tqe->buffer_size; PRINT_D(TX_DBG, "VMM Size before alignment = %d\n", vmm_sz); - if (vmm_sz & 0x3) { /* has to be word aligned */ + if (vmm_sz & 0x3) vmm_sz = (vmm_sz + 4) & ~0x3; - } + if ((sum + vmm_sz) > LINUX_TX_SIZE) break; PRINT_D(TX_DBG, "VMM Size AFTER alignment = %d\n", vmm_sz); - vmm_table[i] = vmm_sz / 4; /* table take the word size */ + vmm_table[i] = vmm_sz / 4; PRINT_D(TX_DBG, "VMMTable entry size = %d\n", vmm_table[i]); if (tqe->type == WILC_CFG_PKT) { @@ -913,12 +796,12 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) } } while (1); - if (i == 0) { /* nothing in the queue */ + if (i == 0) { PRINT_D(TX_DBG, "Nothing in TX-Q\n"); break; } else { PRINT_D(TX_DBG, "Mark the last entry in VMM table - number of previous entries = %d\n", i); - vmm_table[i] = 0x0; /* mark the last element to 0 */ + vmm_table[i] = 0x0; } acquire_bus(ACQUIRE_AND_WAKEUP); counter = 0; @@ -931,9 +814,6 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) } if ((reg & 0x1) == 0) { - /** - * write to vmm table - **/ PRINT_D(TX_DBG, "Writing VMM table ... with Size = %d\n", ((i + 1) * 4)); break; } else { @@ -944,9 +824,6 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) ret = p->hif_func.hif_write_reg(WILC_HOST_TX_CTRL, 0); break; } - /** - * wait for vmm table is ready - **/ PRINT_WRN(GENERIC_DBG, "[wilc txq]: warn, vmm table not clear yet, wait...\n"); release_bus(RELEASE_ALLOW_SLEEP); usleep_range(3000, 3000); @@ -959,30 +836,18 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) timeout = 200; do { - - /** - * write to vmm table - **/ ret = p->hif_func.hif_block_tx(WILC_VMM_TBL_RX_SHADOW_BASE, (u8 *)vmm_table, ((i + 1) * 4)); if (!ret) { wilc_debug(N_ERR, "ERR block TX of VMM table.\n"); break; } - - /** - * interrupt firmware - **/ ret = p->hif_func.hif_write_reg(WILC_HOST_VMM_CTL, 0x2); if (!ret) { wilc_debug(N_ERR, "[wilc txq]: fail can't write reg host_vmm_ctl..\n"); break; } - /** - * wait for confirm... - **/ - do { ret = p->hif_func.hif_read_reg(WILC_HOST_VMM_CTL, ®); if (!ret) { @@ -990,9 +855,6 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) break; } if ((reg >> 2) & 0x1) { - /** - * Get the entries - **/ entries = ((reg >> 3) & 0x3f); break; } else { @@ -1013,7 +875,6 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) if (entries == 0) { PRINT_WRN(GENERIC_DBG, "[wilc txq]: no more buffer in the chip (reg: %08x), retry later [[ %d, %x ]]\n", reg, i, vmm_table[i - 1]); - /* undo the transaction. */ ret = p->hif_func.hif_read_reg(WILC_HOST_TX_CTRL, ®); if (!ret) { wilc_debug(N_ERR, "[wilc txq]: fail can't read reg WILC_HOST_TX_CTRL..\n"); @@ -1039,13 +900,8 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) goto _end_; } - /* since copying data into txb takes some time, then - * allow the bus lock to be released let the RX task go. */ release_bus(RELEASE_ALLOW_SLEEP); - /** - * Copy data to the TX buffer - **/ offset = 0; i = 0; do { @@ -1056,7 +912,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) #ifdef BIG_ENDIAN vmm_table[i] = BYTE_SWAP(vmm_table[i]); #endif - vmm_sz = (vmm_table[i] & 0x3ff); /* in word unit */ + vmm_sz = (vmm_table[i] & 0x3ff); vmm_sz *= 4; header = (tqe->type << 31) | (tqe->buffer_size << 15) | vmm_sz; if (tqe->type == WILC_MGMT_PKT) @@ -1075,7 +931,6 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) char *pBSSID = ((struct tx_complete_data *)(tqe->priv))->pBssid; buffer_offset = ETH_ETHERNET_HDR_OFFSET; - /* copy the bssid at the sart of the buffer */ memcpy(&txb[offset + 4], pBSSID, 6); } else { @@ -1085,7 +940,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) memcpy(&txb[offset + buffer_offset], tqe->buffer, tqe->buffer_size); offset += vmm_sz; i++; - tqe->status = 1; /* mark the packet send */ + tqe->status = 1; if (tqe->tx_complete_func) tqe->tx_complete_func(tqe->priv, tqe->status); #ifdef TCP_ACK_FILTER @@ -1098,9 +953,6 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) } } while (--entries); - /** - * lock the bus - **/ acquire_bus(ACQUIRE_AND_WAKEUP); ret = p->hif_func.hif_clear_int_ext(ENABLE_TX_VMM); @@ -1109,9 +961,6 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) goto _end_; } - /** - * transfer - **/ ret = p->hif_func.hif_block_tx_ext(0, txb, offset); if (!ret) { wilc_debug(N_ERR, "[wilc txq]: fail can't block tx ext...\n"); @@ -1128,7 +977,6 @@ _end_: p->txq_exit = 1; PRINT_D(TX_DBG, "THREAD: Exiting txq\n"); - /* return tx[]q count */ *pu32TxqCount = p->txq_entries; return ret; } @@ -1193,7 +1041,6 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) if (pkt_offset & IS_MANAGMEMENT) { - /* reset mgmt indicator bit, to use pkt_offeset in furthur calculations */ pkt_offset &= ~(IS_MANAGMEMENT | IS_MANAGMEMENT_CALLBACK | IS_MGMT_STATUS_SUCCES); WILC_WFI_mgmt_rx(wilc, &buffer[offset + HOST_HDR_OFFSET], pkt_len); @@ -1216,16 +1063,10 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) wilc_wlan_cfg_indicate_rx(&buffer[pkt_offset + offset], pkt_len, &rsp); if (rsp.type == WILC_CFG_RSP) { - /** - * wake up the waiting task... - **/ PRINT_D(RX_DBG, "p->cfg_seq_no = %d - rsp.seq_no = %d\n", p->cfg_seq_no, rsp.seq_no); if (p->cfg_seq_no == rsp.seq_no) up(&wilc->cfg_event); } else if (rsp.type == WILC_CFG_RSP_STATUS) { - /** - * Call back to indicate status... - **/ linux_wlan_mac_indicate(wilc, WILC_MAC_INDICATE_STATUS); } else if (rsp.type == WILC_CFG_RSP_SCAN) { @@ -1253,11 +1094,6 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) PRINT_D(RX_DBG, "THREAD: Exiting RX thread\n"); } -/******************************************** - * - * Fast DMA Isr - * - ********************************************/ static void wilc_unknown_isr_ext(void) { g_wlan.hif_func.hif_clear_int_ext(0); @@ -1269,10 +1105,8 @@ static void wilc_pllupdate_isr_ext(u32 int_stats) g_wlan.hif_func.hif_clear_int_ext(PLL_INT_CLR); - /* Waiting for PLL */ mdelay(WILC_PLL_TO); - /* poll till read a valid data */ while (!(ISWILC1000(wilc_get_chipid(true)) && --trials)) { PRINT_D(TX_DBG, "PLL update retrying\n"); mdelay(1); @@ -1299,17 +1133,11 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) int ret = 0; struct rxq_entry_t *rqe; - - /** - * Get the rx size - **/ - size = ((int_status & 0x7fff) << 2); while (!size && retries < 10) { u32 time = 0; - /*looping more secure*/ - /*zero size make a crashe because the dma will not happen and that will block the firmware*/ + wilc_debug(N_ERR, "RX Size equal zero ... Trying to read it again for %d time\n", time++); p->hif_func.hif_read_size(&size); size = ((size & 0x7fff) << 2); @@ -1337,16 +1165,7 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) goto _end_; } #endif - - /** - * clear the chip's interrupt after getting size some register getting corrupted after clear the interrupt - **/ p->hif_func.hif_clear_int_ext(DATA_INT_CLR | ENABLE_RX_VMM); - - - /** - * start transfer - **/ ret = p->hif_func.hif_block_rx_ext(0, buffer, size); if (!ret) { @@ -1361,9 +1180,6 @@ _end_: offset += size; p->rx_buffer_offset = offset; #endif - /** - * add to rx queue - **/ rqe = kmalloc(sizeof(struct rxq_entry_t), GFP_KERNEL); if (rqe != NULL) { rqe->buffer = buffer; @@ -1393,7 +1209,6 @@ void wilc_handle_isr(void *wilc) if (int_status & DATA_INT_EXT) { wilc_wlan_handle_isr_ext(wilc, int_status); #ifndef WILC_OPTIMIZE_SLEEP_INT - /* Chip is up and talking*/ genuChipPSstate = CHIP_WAKEDUP; #endif } @@ -1409,11 +1224,6 @@ void wilc_handle_isr(void *wilc) release_bus(RELEASE_ALLOW_SLEEP); } -/******************************************** - * - * Firmware download - * - ********************************************/ int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size) { wilc_wlan_dev_t *p = &g_wlan; @@ -1423,20 +1233,16 @@ int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size) int ret = 0; blksz = BIT(12); - /* Allocate a DMA coherent buffer. */ dma_buffer = kmalloc(blksz, GFP_KERNEL); if (dma_buffer == NULL) { - /*EIO 5*/ ret = -5; PRINT_ER("Can't allocate buffer for firmware download IO error\n "); goto _fail_1; } PRINT_D(INIT_DBG, "Downloading firmware size = %d ...\n", buffer_size); - /** - * load the firmware - **/ + offset = 0; do { memcpy(&addr, &buffer[offset], 4); @@ -1452,7 +1258,7 @@ int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size) size2 = size; else size2 = blksz; - /* Copy firmware into a DMA coherent buffer */ + memcpy(dma_buffer, &buffer[offset], size2); ret = p->hif_func.hif_block_tx(addr, dma_buffer, size2); if (!ret) @@ -1465,7 +1271,6 @@ int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size) release_bus(RELEASE_ONLY); if (!ret) { - /*EIO 5*/ ret = -5; PRINT_ER("Can't download firmware IO error\n "); goto _fail_; @@ -1482,11 +1287,6 @@ _fail_1: return (ret < 0) ? ret : 0; } -/******************************************** - * - * Common - * - ********************************************/ int wilc_wlan_start(void) { wilc_wlan_dev_t *p = &g_wlan; @@ -1494,12 +1294,9 @@ int wilc_wlan_start(void) int ret; u32 chipid; - /** - * Set the host interface - **/ if (p->io_func.io_type == HIF_SDIO) { reg = 0; - reg |= BIT(3); /* bug 4456 and 4557 */ + reg |= BIT(3); } else if (p->io_func.io_type == HIF_SPI) { reg = 1; } @@ -1508,7 +1305,6 @@ int wilc_wlan_start(void) if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail write reg vmm_core_cfg...\n"); release_bus(RELEASE_ONLY); - /* EIO 5*/ ret = -5; return ret; } @@ -1533,14 +1329,9 @@ int wilc_wlan_start(void) #endif reg |= WILC_HAVE_LEGACY_RF_SETTINGS; - - -/*Set oscillator frequency*/ #ifdef XTAL_24 reg |= WILC_HAVE_XTAL_24; #endif - -/*Enable/Disable GPIO configuration for FW logs*/ #ifdef DISABLE_WILC_UART reg |= WILC_HAVE_DISABLE_WILC_UART; #endif @@ -1549,30 +1340,20 @@ int wilc_wlan_start(void) if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail write WILC_GP_REG_1 ...\n"); release_bus(RELEASE_ONLY); - /* EIO 5*/ ret = -5; return ret; } - /** - * Bus related - **/ p->hif_func.hif_sync_ext(NUM_INT_EXT); ret = p->hif_func.hif_read_reg(0x1000, &chipid); if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail read reg 0x1000 ...\n"); release_bus(RELEASE_ONLY); - /* EIO 5*/ ret = -5; return ret; } - /** - * Go... - **/ - - p->hif_func.hif_read_reg(WILC_GLB_RESET_0, ®); if ((reg & BIT(10)) == BIT(10)) { reg &= ~BIT(10); @@ -1603,9 +1384,6 @@ int wilc_wlan_stop(void) u32 reg = 0; int ret; u8 timeout = 10; - /** - * TODO: stop the firmware, need a re-download - **/ acquire_bus(ACQUIRE_AND_WAKEUP); ret = p->hif_func.hif_read_reg(WILC_GLB_RESET_0, ®); @@ -1635,7 +1413,7 @@ int wilc_wlan_stop(void) return ret; } PRINT_D(GENERIC_DBG, "Read RESET Reg %x : Retry%d\n", reg, timeout); - /*Workaround to ensure that the chip is actually reset*/ + if ((reg & BIT(10))) { PRINT_D(GENERIC_DBG, "Bit 10 not reset : Retry %d\n", timeout); reg &= ~BIT(10); @@ -1700,10 +1478,6 @@ void wilc_wlan_cleanup(struct net_device *dev) kfree(rqe); } while (1); - /** - * clean up buffer - **/ - #ifdef MEMORY_STATIC kfree(p->rx_buffer); p->rx_buffer = NULL; @@ -1725,9 +1499,6 @@ void wilc_wlan_cleanup(struct net_device *dev) release_bus(RELEASE_ALLOW_SLEEP); } release_bus(RELEASE_ALLOW_SLEEP); - /** - * io clean up - **/ p->hif_func.hif_deinit(NULL); } @@ -1740,16 +1511,12 @@ static int wilc_wlan_cfg_commit(int type, u32 drvHandler) int seq_no = p->cfg_seq_no % 256; int driver_handler = (u32)drvHandler; - - /** - * Set up header - **/ - if (type == WILC_CFG_SET) { /* Set */ + if (type == WILC_CFG_SET) { cfg->wid_header[0] = 'W'; - } else { /* Query */ + } else { cfg->wid_header[0] = 'Q'; } - cfg->wid_header[1] = seq_no; /* sequence number */ + cfg->wid_header[1] = seq_no; cfg->wid_header[2] = (u8)total_len; cfg->wid_header[3] = (u8)(total_len >> 8); cfg->wid_header[4] = (u8)driver_handler; @@ -1758,10 +1525,6 @@ static int wilc_wlan_cfg_commit(int type, u32 drvHandler) cfg->wid_header[7] = (u8)(driver_handler >> 24); p->cfg_seq_no = seq_no; - /** - * Add to TX queue - **/ - if (!wilc_wlan_txq_add_cfg_pkt(&cfg->wid_header[0], total_len)) return -1; @@ -1859,15 +1622,11 @@ int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size) void wilc_bus_set_max_speed(void) { - - /* Increase bus speed to max possible. */ g_wlan.hif_func.hif_set_max_bus_speed(); } void wilc_bus_set_default_speed(void) { - - /* Restore bus speed to default. */ g_wlan.hif_func.hif_set_default_bus_speed(); } u32 init_chip(struct net_device *dev) @@ -1882,11 +1641,6 @@ u32 init_chip(struct net_device *dev) if ((chipid & 0xfff) != 0xa0) { - /** - * Avoid booting from boot ROM. Make sure that Drive IRQN [SDIO platform] - * or SD_DAT3 [SPI platform] to ?1? - **/ - /* Set cortus reset register to register control. */ ret = g_wlan.hif_func.hif_read_reg(0x1118, ®); if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail read reg 0x1118 ...\n"); @@ -1898,10 +1652,6 @@ u32 init_chip(struct net_device *dev) wilc_debug(N_ERR, "[wilc start]: fail write reg 0x1118 ...\n"); return ret; } - /** - * Write branch intruction to IRAM (0x71 trap) at location 0xFFFF0000 - * (Cortus map) or C0000 (AHB map). - **/ ret = g_wlan.hif_func.hif_write_reg(0xc0000, 0x71); if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail write reg 0xc0000 ...\n"); @@ -1918,8 +1668,6 @@ u32 init_chip(struct net_device *dev) u32 wilc_get_chipid(u8 update) { static u32 chipid; - /* SDIO can't read into global variables */ - /* Use this variable as a temp, then copy to the global */ u32 tempchipid = 0; u32 rfrevid; @@ -1931,15 +1679,15 @@ u32 wilc_get_chipid(u8 update) goto _fail_; } if (tempchipid == 0x1002a0) { - if (rfrevid == 0x1) { /* 1002A0 */ - } else { /* if (rfrevid == 0x2) */ /* 1002A1 */ + if (rfrevid == 0x1) { + } else { tempchipid = 0x1002a1; } } else if (tempchipid == 0x1002b0) { - if (rfrevid == 3) { /* 1002B0 */ - } else if (rfrevid == 4) { /* 1002B1 */ + if (rfrevid == 3) { + } else if (rfrevid == 4) { tempchipid = 0x1002b1; - } else { /* if(rfrevid == 5) */ /* 1002B2 */ + } else { tempchipid = 0x1002b2; } } else { @@ -1959,69 +1707,47 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) PRINT_D(INIT_DBG, "Initializing WILC_Wlan ...\n"); memset((void *)&g_wlan, 0, sizeof(wilc_wlan_dev_t)); - - /** - * store the input - **/ memcpy((void *)&g_wlan.io_func, (void *)&inp->io_func, sizeof(wilc_wlan_io_func_t)); - /*** - * host interface init - **/ + if ((inp->io_func.io_type & 0x1) == HIF_SDIO) { if (!hif_sdio.hif_init(inp, wilc_debug)) { - /* EIO 5 */ ret = -5; goto _fail_; } memcpy((void *)&g_wlan.hif_func, &hif_sdio, sizeof(wilc_hif_func_t)); } else { if ((inp->io_func.io_type & 0x1) == HIF_SPI) { - /** - * TODO: - **/ if (!hif_spi.hif_init(inp, wilc_debug)) { - /* EIO 5 */ ret = -5; goto _fail_; } memcpy((void *)&g_wlan.hif_func, &hif_spi, sizeof(wilc_hif_func_t)); } else { - /* EIO 5 */ ret = -5; goto _fail_; } } - /*** - * mac interface init - **/ if (!wilc_wlan_cfg_init(wilc_debug)) { - /* ENOBUFS 105 */ ret = -105; goto _fail_; } - /** - * alloc tx, rx buffer - **/ if (g_wlan.tx_buffer == NULL) g_wlan.tx_buffer = kmalloc(LINUX_TX_SIZE, GFP_KERNEL); PRINT_D(TX_DBG, "g_wlan.tx_buffer = %p\n", g_wlan.tx_buffer); if (g_wlan.tx_buffer == NULL) { - /* ENOBUFS 105 */ ret = -105; PRINT_ER("Can't allocate Tx Buffer"); goto _fail_; } -/* rx_buffer is not used unless we activate USE_MEM STATIC which is not applicable, allocating such memory is useless*/ #if defined (MEMORY_STATIC) if (g_wlan.rx_buffer == NULL) g_wlan.rx_buffer = kmalloc(LINUX_RX_SIZE, GFP_KERNEL); PRINT_D(TX_DBG, "g_wlan.rx_buffer =%p\n", g_wlan.rx_buffer); if (g_wlan.rx_buffer == NULL) { - /* ENOBUFS 105 */ ret = -105; PRINT_ER("Can't allocate Rx Buffer"); goto _fail_; @@ -2029,7 +1755,6 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) #endif if (!init_chip(dev)) { - /* EIO 5 */ ret = -5; goto _fail_; } @@ -2062,7 +1787,6 @@ u16 set_machw_change_vir_if(struct net_device *dev, bool bValue) nic = netdev_priv(dev); wilc = nic->wilc; - /*Reset WILC_CHANGING_VIR_IF register to allow adding futrue keys to CE H/W*/ mutex_lock(&wilc->hif_cs); ret = (&g_wlan)->hif_func.hif_read_reg(WILC_CHANGING_VIR_IF, ®); if (!ret) From 85489fe17a341b9ab6ef18374b25f5a267bbf04e Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:26 +0900 Subject: [PATCH 233/843] staging: wilc1000: fixes please don't use multiple blank lines This patch fixes the checks reported by checkpatch.pl for Please don't use multiple blank lines. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 48 ---------------------------- 1 file changed, 48 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 7aaad0f3928a..5db87c083b7c 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -6,8 +6,6 @@ extern wilc_hif_func_t hif_sdio; extern wilc_hif_func_t hif_spi; u32 wilc_get_chipid(u8 update); - - typedef struct { int quit; wilc_wlan_io_func_t io_func; @@ -35,8 +33,6 @@ typedef struct { struct rxq_entry_t *rxq_tail; int rxq_entries; int rxq_exit; - - } wilc_wlan_dev_t; static wilc_wlan_dev_t g_wlan; @@ -92,8 +88,6 @@ static void wilc_wlan_txq_remove(struct txq_entry_t *tqe) p->txq_head = tqe->next; if (p->txq_head) p->txq_head->prev = NULL; - - } else if (tqe == p->txq_tail) { p->txq_tail = (tqe->prev); if (p->txq_tail) @@ -126,10 +120,6 @@ wilc_wlan_txq_remove_from_head(struct net_device *dev) p->txq_head->prev = NULL; p->txq_entries -= 1; - - - - } else { tqe = NULL; } @@ -222,9 +212,6 @@ typedef struct { struct txq_entry_t *txqe; } Pending_Acks_info_t; - - - struct Ack_session_info *Free_head; struct Ack_session_info *Alloc_head; @@ -239,8 +226,6 @@ u32 PendingAcks_arrBase; u32 Opened_TCP_session; u32 Pending_Acks; - - static inline int Init_TCP_tracking(void) { @@ -319,7 +304,6 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe) ip_hdr_ptr = &buffer[ETHERNET_HDR_LEN]; protocol = ip_hdr_ptr[9]; - if (protocol == 0x06) { u8 *tcp_hdr_ptr; u32 IHL, Total_Length, Data_offset; @@ -335,7 +319,6 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe) Ack_no = (((u32)tcp_hdr_ptr[8]) << 24) + (((u32)tcp_hdr_ptr[9]) << 16) + (((u32)tcp_hdr_ptr[10]) << 8) + ((u32)tcp_hdr_ptr[11]); - for (i = 0; i < Opened_TCP_session; i++) { if (Acks_keep_track_info[i].Ack_seq_num == seq_no) { Update_TCP_track_session(i, Ack_no); @@ -346,8 +329,6 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe) add_TCP_track_session(0, 0, seq_no); add_TCP_Pending_Ack(Ack_no, i, tqe); - - } } else { @@ -360,7 +341,6 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe) return ret; } - static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) { perInterface_wlan_t *nic; @@ -398,7 +378,6 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) else PendingAcks_arrBase = 0; - spin_unlock_irqrestore(&wilc->txq_spinlock, p->txq_spinlock_flags); while (Dropped > 0) { @@ -523,7 +502,6 @@ static struct txq_entry_t *wilc_wlan_txq_get_first(struct wilc *wilc) spin_unlock_irqrestore(&wilc->txq_spinlock, flags); - return tqe; } @@ -536,7 +514,6 @@ static struct txq_entry_t *wilc_wlan_txq_get_next(struct wilc *wilc, tqe = tqe->next; spin_unlock_irqrestore(&wilc->txq_spinlock, flags); - return tqe; } @@ -637,7 +614,6 @@ static inline void chip_wakeup(void) } while ((clk_status_reg & 0x1) == 0); } - if (genuChipPSstate == CHIP_SLEEPING_MANUAL) { g_wlan.hif_func.hif_read_reg(0x1C0C, ®); reg &= ~BIT(0); @@ -990,9 +966,6 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) p->rxq_exit = 0; - - - do { if (p->quit) { PRINT_D(RX_DBG, "exit 1st do-while due to Clean_UP function\n"); @@ -1009,8 +982,6 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) PRINT_D(RX_DBG, "rxQ entery Size = %d - Address = %p\n", size, buffer); offset = 0; - - do { u32 header; u32 pkt_len, pkt_offset, tp_len; @@ -1023,8 +994,6 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) #endif PRINT_D(RX_DBG, "Header = %04x - Offset = %d\n", header, offset); - - is_cfg_packet = (header >> 31) & 0x1; pkt_offset = (header >> 22) & 0x1ff; tp_len = (header >> 11) & 0x7ff; @@ -1039,7 +1008,6 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) #define IS_MANAGMEMENT_CALLBACK 0x080 #define IS_MGMT_STATUS_SUCCES 0x040 - if (pkt_offset & IS_MANAGMEMENT) { pkt_offset &= ~(IS_MANAGMEMENT | IS_MANAGMEMENT_CALLBACK | IS_MGMT_STATUS_SUCCES); @@ -1059,8 +1027,6 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) } else { wilc_cfg_rsp_t rsp; - - wilc_wlan_cfg_indicate_rx(&buffer[pkt_offset + offset], pkt_len, &rsp); if (rsp.type == WILC_CFG_RSP) { PRINT_D(RX_DBG, "p->cfg_seq_no = %d - rsp.seq_no = %d\n", p->cfg_seq_no, rsp.seq_no); @@ -1078,8 +1044,6 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) if (offset >= size) break; } while (1); - - #ifndef MEMORY_STATIC kfree(buffer); #endif @@ -1173,8 +1137,6 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) goto _end_; } _end_: - - if (ret) { #ifdef MEMORY_STATIC offset += size; @@ -1394,8 +1356,6 @@ int wilc_wlan_stop(void) } reg &= ~BIT(10); - - ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg); if (!ret) { PRINT_ER("Error while writing reg\n"); @@ -1403,8 +1363,6 @@ int wilc_wlan_stop(void) return ret; } - - do { ret = p->hif_func.hif_read_reg(WILC_GLB_RESET_0, ®); if (!ret) { @@ -1486,7 +1444,6 @@ void wilc_wlan_cleanup(struct net_device *dev) acquire_bus(ACQUIRE_AND_WAKEUP); - ret = p->hif_func.hif_read_reg(WILC_GP_REG_0, ®); if (!ret) { PRINT_ER("Error while reading reg\n"); @@ -1538,7 +1495,6 @@ int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, u32 offset; int ret_size; - if (p->cfg_frame_in_use) return 0; @@ -1578,7 +1534,6 @@ int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler) u32 offset; int ret_size; - if (p->cfg_frame_in_use) return 0; @@ -1596,7 +1551,6 @@ int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler) if (wilc_wlan_cfg_commit(WILC_CFG_QUERY, drvHandler)) ret_size = 0; - if (linux_wlan_lock_timeout(&g_linux_wlan->cfg_event, CFG_PKTS_TIMEOUT)) { PRINT_D(TX_DBG, "Get Timed Out\n"); @@ -1638,8 +1592,6 @@ u32 init_chip(struct net_device *dev) chipid = wilc_get_chipid(true); - - if ((chipid & 0xfff) != 0xa0) { ret = g_wlan.hif_func.hif_read_reg(0x1118, ®); if (!ret) { From 0edeea292b29efd1a898dc040a4e66c94c846c1a Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:27 +0900 Subject: [PATCH 234/843] staging: wilc1000: fixes blank lines aren't necessary brace This patch fixes the checks reported by checkpatch.pl for Blank lines aren't necessary after an open brace '{' and Blank lines aren't necessary before a close brace '}'. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 5db87c083b7c..603541c90728 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -59,7 +59,6 @@ static CHIP_PS_STATE_T genuChipPSstate = CHIP_WAKEDUP; static inline void acquire_bus(BUS_ACQUIRE_T acquire) { - mutex_lock(&g_linux_wlan->hif_cs); #ifndef WILC_OPTIMIZE_SLEEP_INT if (genuChipPSstate != CHIP_WAKEDUP) @@ -68,7 +67,6 @@ static inline void acquire_bus(BUS_ACQUIRE_T acquire) if (acquire == ACQUIRE_AND_WAKEUP) chip_wakeup(); } - } static inline void release_bus(BUS_RELEASE_T release) { @@ -81,10 +79,8 @@ static inline void release_bus(BUS_RELEASE_T release) static void wilc_wlan_txq_remove(struct txq_entry_t *tqe) { - wilc_wlan_dev_t *p = &g_wlan; if (tqe == p->txq_head) { - p->txq_head = tqe->next; if (p->txq_head) p->txq_head->prev = NULL; @@ -97,7 +93,6 @@ static void wilc_wlan_txq_remove(struct txq_entry_t *tqe) tqe->next->prev = tqe->prev; } p->txq_entries -= 1; - } static struct txq_entry_t * @@ -191,7 +186,6 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe) PRINT_D(TX_DBG, "Wake up the txq_handler\n"); return 0; - } u32 Statisitcs_totalAcks = 0, Statisitcs_DroppedAcks = 0; @@ -228,9 +222,7 @@ u32 Pending_Acks; static inline int Init_TCP_tracking(void) { - return 0; - } static inline int add_TCP_track_session(u32 src_prt, u32 dst_prt, u32 seq) { @@ -246,11 +238,9 @@ static inline int add_TCP_track_session(u32 src_prt, u32 dst_prt, u32 seq) static inline int Update_TCP_track_session(u32 index, u32 Ack) { - if (Ack > Acks_keep_track_info[index].Bigger_Ack_num) Acks_keep_track_info[index].Bigger_Ack_num = Ack; return 0; - } static inline int add_TCP_Pending_Ack(u32 Ack, u32 Session_index, struct txq_entry_t *txqe) { @@ -261,7 +251,6 @@ static inline int add_TCP_Pending_Ack(u32 Ack, u32 Session_index, struct txq_ent Pending_Acks_info[PendingAcks_arrBase + Pending_Acks].Session_index = Session_index; txqe->tcp_PendingAck_index = PendingAcks_arrBase + Pending_Acks; Pending_Acks++; - } else { } @@ -466,7 +455,6 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, u32 buffer_size, wilc_tx_complete_func_t func) { - wilc_wlan_dev_t *p = &g_wlan; struct txq_entry_t *tqe; @@ -605,7 +593,6 @@ static inline void chip_wakeup(void) if ((clk_status_reg & 0x1) == 0) wilc_debug(N_ERR, "clocks still OFF. Wake up failed\n"); - } if ((clk_status_reg & 0x1) == 0) { g_wlan.hif_func.hif_write_reg(0xf0, reg & @@ -694,7 +681,6 @@ void chip_sleep_manually(u32 u32SleepTime) genuChipPSstate = CHIP_SLEEPING_MANUAL; release_bus(RELEASE_ONLY); - } int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) @@ -733,7 +719,6 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) sum = 0; do { if ((tqe != NULL) && (i < (WILC_VMM_TBL_SIZE - 1))) { - if (tqe->type == WILC_CFG_PKT) vmm_sz = ETH_CONFIG_PKT_HDR_OFFSET; @@ -782,7 +767,6 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) acquire_bus(ACQUIRE_AND_WAKEUP); counter = 0; do { - ret = p->hif_func.hif_read_reg(WILC_HOST_TX_CTRL, ®); if (!ret) { wilc_debug(N_ERR, "[wilc txq]: fail can't read reg vmm_tbl_entry..\n"); @@ -1015,7 +999,6 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) } else { - if (!is_cfg_packet) { if (pkt_len > 0) { frmw_to_linux(wilc, @@ -1064,7 +1047,6 @@ static void wilc_unknown_isr_ext(void) } static void wilc_pllupdate_isr_ext(u32 int_stats) { - int trials = 10; g_wlan.hif_func.hif_clear_int_ext(PLL_INT_CLR); @@ -1106,7 +1088,6 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) p->hif_func.hif_read_size(&size); size = ((size & 0x7fff) << 2); retries++; - } if (size > 0) { @@ -1457,7 +1438,6 @@ void wilc_wlan_cleanup(struct net_device *dev) } release_bus(RELEASE_ALLOW_SLEEP); p->hif_func.hif_deinit(NULL); - } static int wilc_wlan_cfg_commit(int type, u32 drvHandler) @@ -1523,7 +1503,6 @@ int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, p->cfg_frame_in_use = 0; p->cfg_frame_offset = 0; p->cfg_seq_no += 1; - } return ret_size; @@ -1614,7 +1593,6 @@ u32 init_chip(struct net_device *dev) release_bus(RELEASE_ONLY); return ret; - } u32 wilc_get_chipid(u8 update) @@ -1653,7 +1631,6 @@ _fail_: int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) { - int ret = 0; PRINT_D(INIT_DBG, "Initializing WILC_Wlan ...\n"); @@ -1726,7 +1703,6 @@ _fail_: g_wlan.tx_buffer = NULL; return ret; - } u16 set_machw_change_vir_if(struct net_device *dev, bool bValue) From 2d6973e6cd17a66d6904288993466a64ba0b9855 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:28 +0900 Subject: [PATCH 235/843] staging: wilc1000: fixes add blank line after function declaration This patch fixes the warnings reported by checkpatch.pl for please use a blank line after function/struct/union/enum declarations Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 603541c90728..d3117f95bba3 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -68,6 +68,7 @@ static inline void acquire_bus(BUS_ACQUIRE_T acquire) chip_wakeup(); } } + static inline void release_bus(BUS_RELEASE_T release) { #ifdef WILC_OPTIMIZE_SLEEP_INT @@ -224,6 +225,7 @@ static inline int Init_TCP_tracking(void) { return 0; } + static inline int add_TCP_track_session(u32 src_prt, u32 dst_prt, u32 seq) { Acks_keep_track_info[Opened_TCP_session].Ack_seq_num = seq; @@ -242,6 +244,7 @@ static inline int Update_TCP_track_session(u32 index, u32 Ack) Acks_keep_track_info[index].Bigger_Ack_num = Ack; return 0; } + static inline int add_TCP_Pending_Ack(u32 Ack, u32 Session_index, struct txq_entry_t *txqe) { Statisitcs_totalAcks++; @@ -1045,6 +1048,7 @@ static void wilc_unknown_isr_ext(void) { g_wlan.hif_func.hif_clear_int_ext(0); } + static void wilc_pllupdate_isr_ext(u32 int_stats) { int trials = 10; @@ -1507,6 +1511,7 @@ int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, return ret_size; } + int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler) { wilc_wlan_dev_t *p = &g_wlan; @@ -1562,6 +1567,7 @@ void wilc_bus_set_default_speed(void) { g_wlan.hif_func.hif_set_default_bus_speed(); } + u32 init_chip(struct net_device *dev) { u32 chipid; From 8739eeba4b8b2549170baf01fd70f15db3acc781 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:29 +0900 Subject: [PATCH 236/843] staging: wilc1000: fixes missing a blank line after declarations This patch fixes the warnings reported by checkpatch.pl for Missing a blank line after declarations. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index d3117f95bba3..7ebfcaf8daf1 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -81,6 +81,7 @@ static inline void release_bus(BUS_RELEASE_T release) static void wilc_wlan_txq_remove(struct txq_entry_t *tqe) { wilc_wlan_dev_t *p = &g_wlan; + if (tqe == p->txq_head) { p->txq_head = tqe->next; if (p->txq_head) @@ -500,6 +501,7 @@ static struct txq_entry_t *wilc_wlan_txq_get_next(struct wilc *wilc, struct txq_entry_t *tqe) { unsigned long flags; + spin_lock_irqsave(&wilc->txq_spinlock, flags); tqe = tqe->next; From b7d1e18c278fe01f77a428b88bf750fc9ee6742e Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:30 +0900 Subject: [PATCH 237/843] staging: wilc1000: rename genuChipPSstate variable This patch rename genuChipPSstate variable to chip_ps_state to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 7ebfcaf8daf1..c393e529ce66 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -55,13 +55,13 @@ static void wilc_debug(u32 flag, char *fmt, ...) } } -static CHIP_PS_STATE_T genuChipPSstate = CHIP_WAKEDUP; +static CHIP_PS_STATE_T chip_ps_state = CHIP_WAKEDUP; static inline void acquire_bus(BUS_ACQUIRE_T acquire) { mutex_lock(&g_linux_wlan->hif_cs); #ifndef WILC_OPTIMIZE_SLEEP_INT - if (genuChipPSstate != CHIP_WAKEDUP) + if (chip_ps_state != CHIP_WAKEDUP) #endif { if (acquire == ACQUIRE_AND_WAKEUP) @@ -606,7 +606,7 @@ static inline void chip_wakeup(void) } while ((clk_status_reg & 0x1) == 0); } - if (genuChipPSstate == CHIP_SLEEPING_MANUAL) { + if (chip_ps_state == CHIP_SLEEPING_MANUAL) { g_wlan.hif_func.hif_read_reg(0x1C0C, ®); reg &= ~BIT(0); g_wlan.hif_func.hif_write_reg(0x1C0C, reg); @@ -623,7 +623,7 @@ static inline void chip_wakeup(void) g_wlan.hif_func.hif_write_reg(0x1e9c, val32); } } - genuChipPSstate = CHIP_WAKEDUP; + chip_ps_state = CHIP_WAKEDUP; } #else static inline void chip_wakeup(void) @@ -653,7 +653,7 @@ static inline void chip_wakeup(void) } while (wilc_get_chipid(true) == 0); - if (genuChipPSstate == CHIP_SLEEPING_MANUAL) { + if (chip_ps_state == CHIP_SLEEPING_MANUAL) { g_wlan.hif_func.hif_read_reg(0x1C0C, ®); reg &= ~BIT(0); g_wlan.hif_func.hif_write_reg(0x1C0C, reg); @@ -670,12 +670,12 @@ static inline void chip_wakeup(void) g_wlan.hif_func.hif_write_reg(0x1e9c, val32); } } - genuChipPSstate = CHIP_WAKEDUP; + chip_ps_state = CHIP_WAKEDUP; } #endif void chip_sleep_manually(u32 u32SleepTime) { - if (genuChipPSstate != CHIP_WAKEDUP) + if (chip_ps_state != CHIP_WAKEDUP) return; acquire_bus(ACQUIRE_ONLY); @@ -684,7 +684,7 @@ void chip_sleep_manually(u32 u32SleepTime) #endif g_wlan.hif_func.hif_write_reg(0x10a8, 1); - genuChipPSstate = CHIP_SLEEPING_MANUAL; + chip_ps_state = CHIP_SLEEPING_MANUAL; release_bus(RELEASE_ONLY); } @@ -1069,7 +1069,7 @@ static void wilc_sleeptimer_isr_ext(u32 int_stats1) { g_wlan.hif_func.hif_clear_int_ext(SLEEP_INT_CLR); #ifndef WILC_OPTIMIZE_SLEEP_INT - genuChipPSstate = CHIP_SLEEPING_AUTO; + chip_ps_state = CHIP_SLEEPING_AUTO; #endif } @@ -1158,7 +1158,7 @@ void wilc_handle_isr(void *wilc) if (int_status & DATA_INT_EXT) { wilc_wlan_handle_isr_ext(wilc, int_status); #ifndef WILC_OPTIMIZE_SLEEP_INT - genuChipPSstate = CHIP_WAKEDUP; + chip_ps_state = CHIP_WAKEDUP; #endif } if (int_status & SLEEP_INT_EXT) From a4b1719728652406913f13c99d725dd35515b372 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:31 +0900 Subject: [PATCH 238/843] staging: wilc1000: replace explicit NULL comparisons with ! This patch replace explicit NULL comparison with ! operator to simplify code. Reported by checkpatch.pl for Comparison to NULL could be written "!XXX" or "XXX". Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 36 ++++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index c393e529ce66..8ac0b1eb71aa 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -137,7 +137,7 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev, spin_lock_irqsave(&wilc->txq_spinlock, flags); - if (p->txq_head == NULL) { + if (!p->txq_head) { tqe->next = NULL; tqe->prev = NULL; p->txq_head = tqe; @@ -168,7 +168,7 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe) spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags); - if (p->txq_head == NULL) { + if (!p->txq_head) { tqe->next = NULL; tqe->prev = NULL; p->txq_head = tqe; @@ -407,7 +407,7 @@ static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 buffer_size) } tqe = kmalloc(sizeof(struct txq_entry_t), GFP_ATOMIC); - if (tqe == NULL) { + if (!tqe) { PRINT_ER("Failed to allocate memory\n"); return 0; } @@ -438,7 +438,7 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, tqe = kmalloc(sizeof(struct txq_entry_t), GFP_ATOMIC); - if (tqe == NULL) + if (!tqe) return 0; tqe->type = WILC_NET_PKT; tqe->buffer = buffer; @@ -467,7 +467,7 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, tqe = kmalloc(sizeof(struct txq_entry_t), GFP_KERNEL); - if (tqe == NULL) + if (!tqe) return 0; tqe->type = WILC_MGMT_PKT; tqe->buffer = buffer; @@ -518,7 +518,7 @@ static int wilc_wlan_rxq_add(struct wilc *wilc, struct rxq_entry_t *rqe) return 0; mutex_lock(&wilc->rxq_cs); - if (p->rxq_head == NULL) { + if (!p->rxq_head) { PRINT_D(RX_DBG, "Add to Queue head\n"); rqe->next = NULL; p->rxq_head = rqe; @@ -723,7 +723,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) i = 0; sum = 0; do { - if ((tqe != NULL) && (i < (WILC_VMM_TBL_SIZE - 1))) { + if (tqe && (i < (WILC_VMM_TBL_SIZE - 1))) { if (tqe->type == WILC_CFG_PKT) vmm_sz = ETH_CONFIG_PKT_HDR_OFFSET; @@ -871,7 +871,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) i = 0; do { tqe = wilc_wlan_txq_remove_from_head(dev); - if (tqe != NULL && (vmm_table[i] != 0)) { + if (tqe && (vmm_table[i] != 0)) { u32 header, buffer_offset; #ifdef BIG_ENDIAN @@ -962,7 +962,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) break; } rqe = wilc_wlan_rxq_remove(wilc); - if (rqe == NULL) { + if (!rqe) { PRINT_D(RX_DBG, "nothing in the queue - exit 1st do-while\n"); break; } @@ -1110,7 +1110,7 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) #else buffer = kmalloc(size, GFP_KERNEL); - if (buffer == NULL) { + if (!buffer) { wilc_debug(N_ERR, "[wilc isr]: fail alloc host memory...drop the packets (%d)\n", size); usleep_range(100 * 1000, 100 * 1000); goto _end_; @@ -1130,7 +1130,7 @@ _end_: p->rx_buffer_offset = offset; #endif rqe = kmalloc(sizeof(struct rxq_entry_t), GFP_KERNEL); - if (rqe != NULL) { + if (rqe) { rqe->buffer = buffer; rqe->buffer_size = size; PRINT_D(RX_DBG, "rxq entery Size= %d - Address = %p\n", rqe->buffer_size, rqe->buffer); @@ -1184,7 +1184,7 @@ int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size) blksz = BIT(12); dma_buffer = kmalloc(blksz, GFP_KERNEL); - if (dma_buffer == NULL) { + if (!dma_buffer) { ret = -5; PRINT_ER("Can't allocate buffer for firmware download IO error\n "); goto _fail_1; @@ -1406,7 +1406,7 @@ void wilc_wlan_cleanup(struct net_device *dev) p->quit = 1; do { tqe = wilc_wlan_txq_remove_from_head(dev); - if (tqe == NULL) + if (!tqe) break; if (tqe->tx_complete_func) tqe->tx_complete_func(tqe->priv, 0); @@ -1415,7 +1415,7 @@ void wilc_wlan_cleanup(struct net_device *dev) do { rqe = wilc_wlan_rxq_remove(wilc); - if (rqe == NULL) + if (!rqe) break; #ifndef MEMORY_STATIC kfree(rqe->buffer); @@ -1670,21 +1670,21 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) goto _fail_; } - if (g_wlan.tx_buffer == NULL) + if (!g_wlan.tx_buffer) g_wlan.tx_buffer = kmalloc(LINUX_TX_SIZE, GFP_KERNEL); PRINT_D(TX_DBG, "g_wlan.tx_buffer = %p\n", g_wlan.tx_buffer); - if (g_wlan.tx_buffer == NULL) { + if (!g_wlan.tx_buffer) { ret = -105; PRINT_ER("Can't allocate Tx Buffer"); goto _fail_; } #if defined (MEMORY_STATIC) - if (g_wlan.rx_buffer == NULL) + if (!g_wlan.rx_buffer) g_wlan.rx_buffer = kmalloc(LINUX_RX_SIZE, GFP_KERNEL); PRINT_D(TX_DBG, "g_wlan.rx_buffer =%p\n", g_wlan.rx_buffer); - if (g_wlan.rx_buffer == NULL) { + if (!g_wlan.rx_buffer) { ret = -105; PRINT_ER("Can't allocate Rx Buffer"); goto _fail_; From 821466d2fe8f6932c32ad86b8b36235aed644733 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:32 +0900 Subject: [PATCH 239/843] staging: wilc1000: rename Statisitcs_totalAcks variable This patch rename Statisitcs_totalAcks variable to total_acks to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 8ac0b1eb71aa..8d6215b3b8f5 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -190,7 +190,7 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe) return 0; } -u32 Statisitcs_totalAcks = 0, Statisitcs_DroppedAcks = 0; +u32 total_acks = 0, Statisitcs_DroppedAcks = 0; #ifdef TCP_ACK_FILTER struct Ack_session_info; @@ -248,7 +248,7 @@ static inline int Update_TCP_track_session(u32 index, u32 Ack) static inline int add_TCP_Pending_Ack(u32 Ack, u32 Session_index, struct txq_entry_t *txqe) { - Statisitcs_totalAcks++; + total_acks++; if (Pending_Acks < MAX_PENDING_ACKS) { Pending_Acks_info[PendingAcks_arrBase + Pending_Acks].ack_num = Ack; Pending_Acks_info[PendingAcks_arrBase + Pending_Acks].txqe = txqe; From eb59da3be9054bf76cb159f7bcb90a8f74228dff Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:33 +0900 Subject: [PATCH 240/843] staging: wilc1000: rename Statisitcs_DroppedAcks variable This patch rename Statisitcs_DroppedAcks variable to dropped_acks to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 8d6215b3b8f5..9b1ca170c8da 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -190,7 +190,7 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe) return 0; } -u32 total_acks = 0, Statisitcs_DroppedAcks = 0; +u32 total_acks = 0, dropped_acks = 0; #ifdef TCP_ACK_FILTER struct Ack_session_info; @@ -354,7 +354,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) tqe = Pending_Acks_info[i].txqe; if (tqe) { wilc_wlan_txq_remove(tqe); - Statisitcs_DroppedAcks++; + dropped_acks++; tqe->status = 1; if (tqe->tx_complete_func) tqe->tx_complete_func(tqe->priv, tqe->status); From 130a41f0c73bce3195dbf6e667cc1d8bfa6f7e54 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:34 +0900 Subject: [PATCH 241/843] staging: wilc1000: rename Ack_session_info struct variable This patch rename Ack_session_info struct variable to ack_session_info to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 9b1ca170c8da..f3968fd3af42 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -193,8 +193,8 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe) u32 total_acks = 0, dropped_acks = 0; #ifdef TCP_ACK_FILTER -struct Ack_session_info; -struct Ack_session_info { +struct ack_session_info; +struct ack_session_info { u32 Ack_seq_num; u32 Bigger_Ack_num; u16 src_port; @@ -208,14 +208,14 @@ typedef struct { struct txq_entry_t *txqe; } Pending_Acks_info_t; -struct Ack_session_info *Free_head; -struct Ack_session_info *Alloc_head; +struct ack_session_info *Free_head; +struct ack_session_info *Alloc_head; #define NOT_TCP_ACK (-1) #define MAX_TCP_SESSION 25 #define MAX_PENDING_ACKS 256 -struct Ack_session_info Acks_keep_track_info[2 * MAX_TCP_SESSION]; +struct ack_session_info Acks_keep_track_info[2 * MAX_TCP_SESSION]; Pending_Acks_info_t Pending_Acks_info[MAX_PENDING_ACKS]; u32 PendingAcks_arrBase; From d06b6cb2c06b641765ead77dca42513ce0c138a0 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:35 +0900 Subject: [PATCH 242/843] staging: wilc1000: rename Ack_seq_num of struct ack_session_info This patch rename Ack_seq_num of struct ack_session_info to seq_num to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index f3968fd3af42..7162473b4442 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -195,7 +195,7 @@ u32 total_acks = 0, dropped_acks = 0; #ifdef TCP_ACK_FILTER struct ack_session_info; struct ack_session_info { - u32 Ack_seq_num; + u32 seq_num; u32 Bigger_Ack_num; u16 src_port; u16 dst_port; @@ -229,7 +229,7 @@ static inline int Init_TCP_tracking(void) static inline int add_TCP_track_session(u32 src_prt, u32 dst_prt, u32 seq) { - Acks_keep_track_info[Opened_TCP_session].Ack_seq_num = seq; + Acks_keep_track_info[Opened_TCP_session].seq_num = seq; Acks_keep_track_info[Opened_TCP_session].Bigger_Ack_num = 0; Acks_keep_track_info[Opened_TCP_session].src_port = src_prt; Acks_keep_track_info[Opened_TCP_session].dst_port = dst_prt; @@ -313,7 +313,7 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe) Ack_no = (((u32)tcp_hdr_ptr[8]) << 24) + (((u32)tcp_hdr_ptr[9]) << 16) + (((u32)tcp_hdr_ptr[10]) << 8) + ((u32)tcp_hdr_ptr[11]); for (i = 0; i < Opened_TCP_session; i++) { - if (Acks_keep_track_info[i].Ack_seq_num == seq_no) { + if (Acks_keep_track_info[i].seq_num == seq_no) { Update_TCP_track_session(i, Ack_no); break; } From 9d54d3d5d51fa3d0633e70bf02d732ea86d60581 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:36 +0900 Subject: [PATCH 243/843] staging: wilc1000: rename Bigger_Ack_num of struct ack_session_info This patch rename Bigger_Ack_num of struct ack_session_info to bigger_ack_num to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 7162473b4442..4aec89222b08 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -196,7 +196,7 @@ u32 total_acks = 0, dropped_acks = 0; struct ack_session_info; struct ack_session_info { u32 seq_num; - u32 Bigger_Ack_num; + u32 bigger_ack_num; u16 src_port; u16 dst_port; u16 status; @@ -230,7 +230,7 @@ static inline int Init_TCP_tracking(void) static inline int add_TCP_track_session(u32 src_prt, u32 dst_prt, u32 seq) { Acks_keep_track_info[Opened_TCP_session].seq_num = seq; - Acks_keep_track_info[Opened_TCP_session].Bigger_Ack_num = 0; + Acks_keep_track_info[Opened_TCP_session].bigger_ack_num = 0; Acks_keep_track_info[Opened_TCP_session].src_port = src_prt; Acks_keep_track_info[Opened_TCP_session].dst_port = dst_prt; Opened_TCP_session++; @@ -241,8 +241,8 @@ static inline int add_TCP_track_session(u32 src_prt, u32 dst_prt, u32 seq) static inline int Update_TCP_track_session(u32 index, u32 Ack) { - if (Ack > Acks_keep_track_info[index].Bigger_Ack_num) - Acks_keep_track_info[index].Bigger_Ack_num = Ack; + if (Ack > Acks_keep_track_info[index].bigger_ack_num) + Acks_keep_track_info[index].bigger_ack_num = Ack; return 0; } @@ -347,7 +347,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) spin_lock_irqsave(&wilc->txq_spinlock, p->txq_spinlock_flags); for (i = PendingAcks_arrBase; i < (PendingAcks_arrBase + Pending_Acks); i++) { - if (Pending_Acks_info[i].ack_num < Acks_keep_track_info[Pending_Acks_info[i].Session_index].Bigger_Ack_num) { + if (Pending_Acks_info[i].ack_num < Acks_keep_track_info[Pending_Acks_info[i].Session_index].bigger_ack_num) { struct txq_entry_t *tqe; PRINT_D(TCP_ENH, "DROP ACK: %u\n", Pending_Acks_info[i].ack_num); From 08b90b106cc754206199e74b9512551bc426af15 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:37 +0900 Subject: [PATCH 244/843] staging: wilc1000: remove typedef of struct Pending_Acks_info_t This patch remove typedef of struct Pending_Acks_info_t. And, rename the Pending_Acks_info_t to pending_acks_info. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 4aec89222b08..fb0e63519b1f 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -202,11 +202,11 @@ struct ack_session_info { u16 status; }; -typedef struct { +struct pending_acks_info { u32 ack_num; u32 Session_index; struct txq_entry_t *txqe; -} Pending_Acks_info_t; +}; struct ack_session_info *Free_head; struct ack_session_info *Alloc_head; @@ -216,7 +216,7 @@ struct ack_session_info *Alloc_head; #define MAX_TCP_SESSION 25 #define MAX_PENDING_ACKS 256 struct ack_session_info Acks_keep_track_info[2 * MAX_TCP_SESSION]; -Pending_Acks_info_t Pending_Acks_info[MAX_PENDING_ACKS]; +struct pending_acks_info Pending_Acks_info[MAX_PENDING_ACKS]; u32 PendingAcks_arrBase; u32 Opened_TCP_session; From 841369782d9a4b5105a80bc15baca8907fd35e53 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:38 +0900 Subject: [PATCH 245/843] staging: wilc1000: rename Session_index of struct pending_acks_info This patch rename Session_index of struct pending_acks_info to session_index to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index fb0e63519b1f..af5a16ec227d 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -204,7 +204,7 @@ struct ack_session_info { struct pending_acks_info { u32 ack_num; - u32 Session_index; + u32 session_index; struct txq_entry_t *txqe; }; @@ -252,7 +252,7 @@ static inline int add_TCP_Pending_Ack(u32 Ack, u32 Session_index, struct txq_ent if (Pending_Acks < MAX_PENDING_ACKS) { Pending_Acks_info[PendingAcks_arrBase + Pending_Acks].ack_num = Ack; Pending_Acks_info[PendingAcks_arrBase + Pending_Acks].txqe = txqe; - Pending_Acks_info[PendingAcks_arrBase + Pending_Acks].Session_index = Session_index; + Pending_Acks_info[PendingAcks_arrBase + Pending_Acks].session_index = Session_index; txqe->tcp_PendingAck_index = PendingAcks_arrBase + Pending_Acks; Pending_Acks++; } else { @@ -347,7 +347,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) spin_lock_irqsave(&wilc->txq_spinlock, p->txq_spinlock_flags); for (i = PendingAcks_arrBase; i < (PendingAcks_arrBase + Pending_Acks); i++) { - if (Pending_Acks_info[i].ack_num < Acks_keep_track_info[Pending_Acks_info[i].Session_index].bigger_ack_num) { + if (Pending_Acks_info[i].ack_num < Acks_keep_track_info[Pending_Acks_info[i].session_index].bigger_ack_num) { struct txq_entry_t *tqe; PRINT_D(TCP_ENH, "DROP ACK: %u\n", Pending_Acks_info[i].ack_num); From 32065054ceabfea7a65cb116e39221fac6e46d1e Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:39 +0900 Subject: [PATCH 246/843] staging: wilc1000: rename Acks_keep_track_info variable This patch rename the Acks_keep_track_info variable to ack_session_info to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index af5a16ec227d..359df26c8625 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -215,7 +215,7 @@ struct ack_session_info *Alloc_head; #define MAX_TCP_SESSION 25 #define MAX_PENDING_ACKS 256 -struct ack_session_info Acks_keep_track_info[2 * MAX_TCP_SESSION]; +struct ack_session_info ack_session_info[2 * MAX_TCP_SESSION]; struct pending_acks_info Pending_Acks_info[MAX_PENDING_ACKS]; u32 PendingAcks_arrBase; @@ -229,10 +229,10 @@ static inline int Init_TCP_tracking(void) static inline int add_TCP_track_session(u32 src_prt, u32 dst_prt, u32 seq) { - Acks_keep_track_info[Opened_TCP_session].seq_num = seq; - Acks_keep_track_info[Opened_TCP_session].bigger_ack_num = 0; - Acks_keep_track_info[Opened_TCP_session].src_port = src_prt; - Acks_keep_track_info[Opened_TCP_session].dst_port = dst_prt; + ack_session_info[Opened_TCP_session].seq_num = seq; + ack_session_info[Opened_TCP_session].bigger_ack_num = 0; + ack_session_info[Opened_TCP_session].src_port = src_prt; + ack_session_info[Opened_TCP_session].dst_port = dst_prt; Opened_TCP_session++; PRINT_D(TCP_ENH, "TCP Session %d to Ack %d\n", Opened_TCP_session, seq); @@ -241,8 +241,8 @@ static inline int add_TCP_track_session(u32 src_prt, u32 dst_prt, u32 seq) static inline int Update_TCP_track_session(u32 index, u32 Ack) { - if (Ack > Acks_keep_track_info[index].bigger_ack_num) - Acks_keep_track_info[index].bigger_ack_num = Ack; + if (Ack > ack_session_info[index].bigger_ack_num) + ack_session_info[index].bigger_ack_num = Ack; return 0; } @@ -313,7 +313,7 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe) Ack_no = (((u32)tcp_hdr_ptr[8]) << 24) + (((u32)tcp_hdr_ptr[9]) << 16) + (((u32)tcp_hdr_ptr[10]) << 8) + ((u32)tcp_hdr_ptr[11]); for (i = 0; i < Opened_TCP_session; i++) { - if (Acks_keep_track_info[i].seq_num == seq_no) { + if (ack_session_info[i].seq_num == seq_no) { Update_TCP_track_session(i, Ack_no); break; } @@ -347,7 +347,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) spin_lock_irqsave(&wilc->txq_spinlock, p->txq_spinlock_flags); for (i = PendingAcks_arrBase; i < (PendingAcks_arrBase + Pending_Acks); i++) { - if (Pending_Acks_info[i].ack_num < Acks_keep_track_info[Pending_Acks_info[i].session_index].bigger_ack_num) { + if (Pending_Acks_info[i].ack_num < ack_session_info[Pending_Acks_info[i].session_index].bigger_ack_num) { struct txq_entry_t *tqe; PRINT_D(TCP_ENH, "DROP ACK: %u\n", Pending_Acks_info[i].ack_num); From 2bb170876813491d74f09820424ee5d054f2b40b Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:40 +0900 Subject: [PATCH 247/843] staging: wilc1000: rename Pending_Acks_info variable This patch rename the Pending_Acks_info variable to pending_acks_info to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 359df26c8625..7db42c0fd21f 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -216,7 +216,7 @@ struct ack_session_info *Alloc_head; #define MAX_TCP_SESSION 25 #define MAX_PENDING_ACKS 256 struct ack_session_info ack_session_info[2 * MAX_TCP_SESSION]; -struct pending_acks_info Pending_Acks_info[MAX_PENDING_ACKS]; +struct pending_acks_info pending_acks_info[MAX_PENDING_ACKS]; u32 PendingAcks_arrBase; u32 Opened_TCP_session; @@ -250,9 +250,9 @@ static inline int add_TCP_Pending_Ack(u32 Ack, u32 Session_index, struct txq_ent { total_acks++; if (Pending_Acks < MAX_PENDING_ACKS) { - Pending_Acks_info[PendingAcks_arrBase + Pending_Acks].ack_num = Ack; - Pending_Acks_info[PendingAcks_arrBase + Pending_Acks].txqe = txqe; - Pending_Acks_info[PendingAcks_arrBase + Pending_Acks].session_index = Session_index; + pending_acks_info[PendingAcks_arrBase + Pending_Acks].ack_num = Ack; + pending_acks_info[PendingAcks_arrBase + Pending_Acks].txqe = txqe; + pending_acks_info[PendingAcks_arrBase + Pending_Acks].session_index = Session_index; txqe->tcp_PendingAck_index = PendingAcks_arrBase + Pending_Acks; Pending_Acks++; } else { @@ -347,11 +347,12 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) spin_lock_irqsave(&wilc->txq_spinlock, p->txq_spinlock_flags); for (i = PendingAcks_arrBase; i < (PendingAcks_arrBase + Pending_Acks); i++) { - if (Pending_Acks_info[i].ack_num < ack_session_info[Pending_Acks_info[i].session_index].bigger_ack_num) { + if (pending_acks_info[i].ack_num < ack_session_info[pending_acks_info[i].session_index].bigger_ack_num) { struct txq_entry_t *tqe; - PRINT_D(TCP_ENH, "DROP ACK: %u\n", Pending_Acks_info[i].ack_num); - tqe = Pending_Acks_info[i].txqe; + PRINT_D(TCP_ENH, "DROP ACK: %u\n", + pending_acks_info[i].ack_num); + tqe = pending_acks_info[i].txqe; if (tqe) { wilc_wlan_txq_remove(tqe); dropped_acks++; @@ -910,7 +911,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) tqe->tx_complete_func(tqe->priv, tqe->status); #ifdef TCP_ACK_FILTER if (tqe->tcp_PendingAck_index != NOT_TCP_ACK) - Pending_Acks_info[tqe->tcp_PendingAck_index].txqe = NULL; + pending_acks_info[tqe->tcp_PendingAck_index].txqe = NULL; #endif kfree(tqe); } else { From 2ae91edb52caf62309b737d904d365a4d8fcfd19 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:41 +0900 Subject: [PATCH 248/843] staging: wilc1000: rename PendingAcks_arrBase variable This patch rename the PendingAcks_arrBase variable to pending_base to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 7db42c0fd21f..a1b6067e12ed 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -218,7 +218,7 @@ struct ack_session_info *Alloc_head; struct ack_session_info ack_session_info[2 * MAX_TCP_SESSION]; struct pending_acks_info pending_acks_info[MAX_PENDING_ACKS]; -u32 PendingAcks_arrBase; +u32 pending_base; u32 Opened_TCP_session; u32 Pending_Acks; @@ -250,10 +250,10 @@ static inline int add_TCP_Pending_Ack(u32 Ack, u32 Session_index, struct txq_ent { total_acks++; if (Pending_Acks < MAX_PENDING_ACKS) { - pending_acks_info[PendingAcks_arrBase + Pending_Acks].ack_num = Ack; - pending_acks_info[PendingAcks_arrBase + Pending_Acks].txqe = txqe; - pending_acks_info[PendingAcks_arrBase + Pending_Acks].session_index = Session_index; - txqe->tcp_PendingAck_index = PendingAcks_arrBase + Pending_Acks; + pending_acks_info[pending_base + Pending_Acks].ack_num = Ack; + pending_acks_info[pending_base + Pending_Acks].txqe = txqe; + pending_acks_info[pending_base + Pending_Acks].session_index = Session_index; + txqe->tcp_PendingAck_index = pending_base + Pending_Acks; Pending_Acks++; } else { @@ -346,7 +346,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) wilc = nic->wilc; spin_lock_irqsave(&wilc->txq_spinlock, p->txq_spinlock_flags); - for (i = PendingAcks_arrBase; i < (PendingAcks_arrBase + Pending_Acks); i++) { + for (i = pending_base; i < (pending_base + Pending_Acks); i++) { if (pending_acks_info[i].ack_num < ack_session_info[pending_acks_info[i].session_index].bigger_ack_num) { struct txq_entry_t *tqe; @@ -367,10 +367,10 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) Pending_Acks = 0; Opened_TCP_session = 0; - if (PendingAcks_arrBase == 0) - PendingAcks_arrBase = MAX_TCP_SESSION; + if (pending_base == 0) + pending_base = MAX_TCP_SESSION; else - PendingAcks_arrBase = 0; + pending_base = 0; spin_unlock_irqrestore(&wilc->txq_spinlock, p->txq_spinlock_flags); From 3056ec39f864ee10be71433c5347338c1a281c27 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:42 +0900 Subject: [PATCH 249/843] staging: wilc1000: rename Opened_TCP_session variable This patch rename the Opened_TCP_session variable to tcp_session to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index a1b6067e12ed..34e109753ea3 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -219,7 +219,7 @@ struct ack_session_info ack_session_info[2 * MAX_TCP_SESSION]; struct pending_acks_info pending_acks_info[MAX_PENDING_ACKS]; u32 pending_base; -u32 Opened_TCP_session; +u32 tcp_session; u32 Pending_Acks; static inline int Init_TCP_tracking(void) @@ -229,13 +229,13 @@ static inline int Init_TCP_tracking(void) static inline int add_TCP_track_session(u32 src_prt, u32 dst_prt, u32 seq) { - ack_session_info[Opened_TCP_session].seq_num = seq; - ack_session_info[Opened_TCP_session].bigger_ack_num = 0; - ack_session_info[Opened_TCP_session].src_port = src_prt; - ack_session_info[Opened_TCP_session].dst_port = dst_prt; - Opened_TCP_session++; + ack_session_info[tcp_session].seq_num = seq; + ack_session_info[tcp_session].bigger_ack_num = 0; + ack_session_info[tcp_session].src_port = src_prt; + ack_session_info[tcp_session].dst_port = dst_prt; + tcp_session++; - PRINT_D(TCP_ENH, "TCP Session %d to Ack %d\n", Opened_TCP_session, seq); + PRINT_D(TCP_ENH, "TCP Session %d to Ack %d\n", tcp_session, seq); return 0; } @@ -312,13 +312,13 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe) Ack_no = (((u32)tcp_hdr_ptr[8]) << 24) + (((u32)tcp_hdr_ptr[9]) << 16) + (((u32)tcp_hdr_ptr[10]) << 8) + ((u32)tcp_hdr_ptr[11]); - for (i = 0; i < Opened_TCP_session; i++) { + for (i = 0; i < tcp_session; i++) { if (ack_session_info[i].seq_num == seq_no) { Update_TCP_track_session(i, Ack_no); break; } } - if (i == Opened_TCP_session) + if (i == tcp_session) add_TCP_track_session(0, 0, seq_no); add_TCP_Pending_Ack(Ack_no, i, tqe); @@ -365,7 +365,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) } } Pending_Acks = 0; - Opened_TCP_session = 0; + tcp_session = 0; if (pending_base == 0) pending_base = MAX_TCP_SESSION; From d12ac7e2b0c9bcdf9bee0a54424f4e9f270c19a0 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:43 +0900 Subject: [PATCH 250/843] staging: wilc1000: rename Pending_Acks variable This patch rename the Pending_Acks variable to pending_acks to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 34e109753ea3..df20d4d9f48f 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -220,7 +220,7 @@ struct pending_acks_info pending_acks_info[MAX_PENDING_ACKS]; u32 pending_base; u32 tcp_session; -u32 Pending_Acks; +u32 pending_acks; static inline int Init_TCP_tracking(void) { @@ -249,12 +249,12 @@ static inline int Update_TCP_track_session(u32 index, u32 Ack) static inline int add_TCP_Pending_Ack(u32 Ack, u32 Session_index, struct txq_entry_t *txqe) { total_acks++; - if (Pending_Acks < MAX_PENDING_ACKS) { - pending_acks_info[pending_base + Pending_Acks].ack_num = Ack; - pending_acks_info[pending_base + Pending_Acks].txqe = txqe; - pending_acks_info[pending_base + Pending_Acks].session_index = Session_index; - txqe->tcp_PendingAck_index = pending_base + Pending_Acks; - Pending_Acks++; + if (pending_acks < MAX_PENDING_ACKS) { + pending_acks_info[pending_base + pending_acks].ack_num = Ack; + pending_acks_info[pending_base + pending_acks].txqe = txqe; + pending_acks_info[pending_base + pending_acks].session_index = Session_index; + txqe->tcp_PendingAck_index = pending_base + pending_acks; + pending_acks++; } else { } @@ -346,7 +346,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) wilc = nic->wilc; spin_lock_irqsave(&wilc->txq_spinlock, p->txq_spinlock_flags); - for (i = pending_base; i < (pending_base + Pending_Acks); i++) { + for (i = pending_base; i < (pending_base + pending_acks); i++) { if (pending_acks_info[i].ack_num < ack_session_info[pending_acks_info[i].session_index].bigger_ack_num) { struct txq_entry_t *tqe; @@ -364,7 +364,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) } } } - Pending_Acks = 0; + pending_acks = 0; tcp_session = 0; if (pending_base == 0) From ef06b5f7330182604c348b7ee8fef6620bc5a44e Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:44 +0900 Subject: [PATCH 251/843] staging: wilc1000: rename Init_TCP_tracking function This patch rename the Init_TCP_tracking function to init_tcp_tracking to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index df20d4d9f48f..df0f5ce5b203 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -222,7 +222,7 @@ u32 pending_base; u32 tcp_session; u32 pending_acks; -static inline int Init_TCP_tracking(void) +static inline int init_tcp_tracking(void) { return 0; } @@ -1697,7 +1697,7 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) goto _fail_; } #ifdef TCP_ACK_FILTER - Init_TCP_tracking(); + init_tcp_tracking(); #endif return 1; From 67620788526cec1bcd5e5ff44b529d24f104172e Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:45 +0900 Subject: [PATCH 252/843] staging: wilc1000: rename add_TCP_track_session function This patch rename the add_TCP_track_session function to add_tcp_session to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index df0f5ce5b203..75b35b8412c0 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -227,7 +227,7 @@ static inline int init_tcp_tracking(void) return 0; } -static inline int add_TCP_track_session(u32 src_prt, u32 dst_prt, u32 seq) +static inline int add_tcp_session(u32 src_prt, u32 dst_prt, u32 seq) { ack_session_info[tcp_session].seq_num = seq; ack_session_info[tcp_session].bigger_ack_num = 0; @@ -319,7 +319,7 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe) } } if (i == tcp_session) - add_TCP_track_session(0, 0, seq_no); + add_tcp_session(0, 0, seq_no); add_TCP_Pending_Ack(Ack_no, i, tqe); } From bbf3dbd7dd5e4a798936cf1ce624d76f5ec37780 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:46 +0900 Subject: [PATCH 253/843] staging: wilc1000: rename Update_TCP_track_session function This patch rename the Update_TCP_track_session function to update_tcp_session to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 75b35b8412c0..c4312bb071bc 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -239,7 +239,7 @@ static inline int add_tcp_session(u32 src_prt, u32 dst_prt, u32 seq) return 0; } -static inline int Update_TCP_track_session(u32 index, u32 Ack) +static inline int update_tcp_session(u32 index, u32 Ack) { if (Ack > ack_session_info[index].bigger_ack_num) ack_session_info[index].bigger_ack_num = Ack; @@ -314,7 +314,7 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe) for (i = 0; i < tcp_session; i++) { if (ack_session_info[i].seq_num == seq_no) { - Update_TCP_track_session(i, Ack_no); + update_tcp_session(i, Ack_no); break; } } From bdc13ad502e3370dbdf285eea0d8f7fe4930fa89 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:47 +0900 Subject: [PATCH 254/843] staging: wilc1000: rename add_TCP_Pending_Ack function This patch rename the add_TCP_Pending_Ack function to add_tcp_pending_ack to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index c4312bb071bc..3e62abd47153 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -246,7 +246,8 @@ static inline int update_tcp_session(u32 index, u32 Ack) return 0; } -static inline int add_TCP_Pending_Ack(u32 Ack, u32 Session_index, struct txq_entry_t *txqe) +static inline int add_tcp_pending_ack(u32 Ack, u32 Session_index, + struct txq_entry_t *txqe) { total_acks++; if (pending_acks < MAX_PENDING_ACKS) { @@ -321,7 +322,7 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe) if (i == tcp_session) add_tcp_session(0, 0, seq_no); - add_TCP_Pending_Ack(Ack_no, i, tqe); + add_tcp_pending_ack(Ack_no, i, tqe); } } else { From b801a96c65b9d0fe64f2ce80bec2dd781127eb2f Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:48 +0900 Subject: [PATCH 255/843] staging: wilc1000: rename Ack member variable This patch rename the Ack member variable to ack to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 3e62abd47153..58043dc52413 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -239,19 +239,19 @@ static inline int add_tcp_session(u32 src_prt, u32 dst_prt, u32 seq) return 0; } -static inline int update_tcp_session(u32 index, u32 Ack) +static inline int update_tcp_session(u32 index, u32 ack) { - if (Ack > ack_session_info[index].bigger_ack_num) - ack_session_info[index].bigger_ack_num = Ack; + if (ack > ack_session_info[index].bigger_ack_num) + ack_session_info[index].bigger_ack_num = ack; return 0; } -static inline int add_tcp_pending_ack(u32 Ack, u32 Session_index, +static inline int add_tcp_pending_ack(u32 ack, u32 Session_index, struct txq_entry_t *txqe) { total_acks++; if (pending_acks < MAX_PENDING_ACKS) { - pending_acks_info[pending_base + pending_acks].ack_num = Ack; + pending_acks_info[pending_base + pending_acks].ack_num = ack; pending_acks_info[pending_base + pending_acks].txqe = txqe; pending_acks_info[pending_base + pending_acks].session_index = Session_index; txqe->tcp_PendingAck_index = pending_base + pending_acks; From ea03f57b91dfcd23df11861b212949b1b967374c Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:49 +0900 Subject: [PATCH 256/843] staging: wilc1000: rename Session_index member variable This patch rename the Ack Session_index variable to session_index to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 58043dc52413..ce9f45ca7985 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -246,14 +246,14 @@ static inline int update_tcp_session(u32 index, u32 ack) return 0; } -static inline int add_tcp_pending_ack(u32 ack, u32 Session_index, +static inline int add_tcp_pending_ack(u32 ack, u32 session_index, struct txq_entry_t *txqe) { total_acks++; if (pending_acks < MAX_PENDING_ACKS) { pending_acks_info[pending_base + pending_acks].ack_num = ack; pending_acks_info[pending_base + pending_acks].txqe = txqe; - pending_acks_info[pending_base + pending_acks].session_index = Session_index; + pending_acks_info[pending_base + pending_acks].session_index = session_index; txqe->tcp_PendingAck_index = pending_base + pending_acks; pending_acks++; } else { From 6ef3be9fb76c626541d80c273c13a56228b38731 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:50 +0900 Subject: [PATCH 257/843] staging: wilc1000: remove do-nothing else condition case. This patch removes do-nothing else condition case. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index ce9f45ca7985..b07d229eeedc 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -256,8 +256,6 @@ static inline int add_tcp_pending_ack(u32 ack, u32 session_index, pending_acks_info[pending_base + pending_acks].session_index = session_index; txqe->tcp_PendingAck_index = pending_base + pending_acks; pending_acks++; - } else { - } return 0; } @@ -1630,7 +1628,6 @@ u32 wilc_get_chipid(u8 update) } else { tempchipid = 0x1002b2; } - } else { } chipid = tempchipid; From 24e2dac20c10576d7dac4ca2f93918c397801c57 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:51 +0900 Subject: [PATCH 258/843] staging: wilc1000: rename Total_Length variable This patch rename the Total_Length variable to total_length to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index b07d229eeedc..34a8b47596f7 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -298,13 +298,14 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe) if (protocol == 0x06) { u8 *tcp_hdr_ptr; - u32 IHL, Total_Length, Data_offset; + u32 IHL, total_length, Data_offset; tcp_hdr_ptr = &ip_hdr_ptr[IP_HDR_LEN]; IHL = (ip_hdr_ptr[0] & 0xf) << 2; - Total_Length = (((u32)ip_hdr_ptr[2]) << 8) + ((u32)ip_hdr_ptr[3]); + total_length = ((u32)ip_hdr_ptr[2] << 8) + + (u32)ip_hdr_ptr[3]; Data_offset = (((u32)tcp_hdr_ptr[12] & 0xf0) >> 2); - if (Total_Length == (IHL + Data_offset)) { + if (total_length == (IHL + Data_offset)) { u32 seq_no, Ack_no; seq_no = (((u32)tcp_hdr_ptr[4]) << 24) + (((u32)tcp_hdr_ptr[5]) << 16) + (((u32)tcp_hdr_ptr[6]) << 8) + ((u32)tcp_hdr_ptr[7]); From 51bffa96338821d76aa4d61db1ed68c118cd36ed Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:52 +0900 Subject: [PATCH 259/843] staging: wilc1000: rename Data_offset variable This patch rename the Data_offset variable to data_offset to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 34a8b47596f7..6d72e09b0479 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -298,14 +298,14 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe) if (protocol == 0x06) { u8 *tcp_hdr_ptr; - u32 IHL, total_length, Data_offset; + u32 IHL, total_length, data_offset; tcp_hdr_ptr = &ip_hdr_ptr[IP_HDR_LEN]; IHL = (ip_hdr_ptr[0] & 0xf) << 2; total_length = ((u32)ip_hdr_ptr[2] << 8) + (u32)ip_hdr_ptr[3]; - Data_offset = (((u32)tcp_hdr_ptr[12] & 0xf0) >> 2); - if (total_length == (IHL + Data_offset)) { + data_offset = ((u32)tcp_hdr_ptr[12] & 0xf0) >> 2; + if (total_length == (IHL + data_offset)) { u32 seq_no, Ack_no; seq_no = (((u32)tcp_hdr_ptr[4]) << 24) + (((u32)tcp_hdr_ptr[5]) << 16) + (((u32)tcp_hdr_ptr[6]) << 8) + ((u32)tcp_hdr_ptr[7]); From f91c5d77163f76ad8c6f2ea3dd84e0c03406b38b Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:53 +0900 Subject: [PATCH 260/843] staging: wilc1000: rename Ack_no variable This patch rename the Ack_no variable to ack_no to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 6d72e09b0479..52351c618657 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -306,22 +306,25 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe) (u32)ip_hdr_ptr[3]; data_offset = ((u32)tcp_hdr_ptr[12] & 0xf0) >> 2; if (total_length == (IHL + data_offset)) { - u32 seq_no, Ack_no; + u32 seq_no, ack_no; seq_no = (((u32)tcp_hdr_ptr[4]) << 24) + (((u32)tcp_hdr_ptr[5]) << 16) + (((u32)tcp_hdr_ptr[6]) << 8) + ((u32)tcp_hdr_ptr[7]); - Ack_no = (((u32)tcp_hdr_ptr[8]) << 24) + (((u32)tcp_hdr_ptr[9]) << 16) + (((u32)tcp_hdr_ptr[10]) << 8) + ((u32)tcp_hdr_ptr[11]); + ack_no = ((u32)tcp_hdr_ptr[8] << 24) + + ((u32)tcp_hdr_ptr[9] << 16) + + ((u32)tcp_hdr_ptr[10] << 8) + + (u32)tcp_hdr_ptr[11]; for (i = 0; i < tcp_session; i++) { if (ack_session_info[i].seq_num == seq_no) { - update_tcp_session(i, Ack_no); + update_tcp_session(i, ack_no); break; } } if (i == tcp_session) add_tcp_session(0, 0, seq_no); - add_tcp_pending_ack(Ack_no, i, tqe); + add_tcp_pending_ack(ack_no, i, tqe); } } else { From 4478c62aa44c5caaaf6bb4d7917a3eacda214d2a Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:54 +0900 Subject: [PATCH 261/843] staging: wilc1000: remove warnings line over 80 characters This patch removes the warnings reported by checkpatch.pl for line over 80 characters. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 52351c618657..66d7f1e86419 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -308,7 +308,10 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe) if (total_length == (IHL + data_offset)) { u32 seq_no, ack_no; - seq_no = (((u32)tcp_hdr_ptr[4]) << 24) + (((u32)tcp_hdr_ptr[5]) << 16) + (((u32)tcp_hdr_ptr[6]) << 8) + ((u32)tcp_hdr_ptr[7]); + seq_no = ((u32)tcp_hdr_ptr[4] << 24) + + ((u32)tcp_hdr_ptr[5] << 16) + + ((u32)tcp_hdr_ptr[6] << 8) + + (u32)tcp_hdr_ptr[7]; ack_no = ((u32)tcp_hdr_ptr[8] << 24) + ((u32)tcp_hdr_ptr[9] << 16) + From 442eda4ecb614caaec605a17a1c57fecbd7bd72f Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:55 +0900 Subject: [PATCH 262/843] staging: wilc1000: rename Dropped variable This patch rename the Dropped variable to dropped to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 66d7f1e86419..283ab521ba18 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -345,7 +345,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) perInterface_wlan_t *nic; struct wilc *wilc; u32 i = 0; - u32 Dropped = 0; + u32 dropped = 0; wilc_wlan_dev_t *p = &g_wlan; nic = netdev_priv(dev); @@ -366,7 +366,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) if (tqe->tx_complete_func) tqe->tx_complete_func(tqe->priv, tqe->status); kfree(tqe); - Dropped++; + dropped++; } } } @@ -380,9 +380,9 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) spin_unlock_irqrestore(&wilc->txq_spinlock, p->txq_spinlock_flags); - while (Dropped > 0) { + while (dropped > 0) { linux_wlan_lock_timeout(&wilc->txq_event, 1); - Dropped--; + dropped--; } return 1; From 7c4bafe9e0ec64dd76d6a87633fea1739ef236de Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:56 +0900 Subject: [PATCH 263/843] staging: wilc1000: rename EnableTCPAckFilter variable This patch rename the EnableTCPAckFilter variable to enabled to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 283ab521ba18..0bfd1bd9aa2f 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -389,16 +389,16 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) } #endif -bool EnableTCPAckFilter = false; +bool enabled = false; void Enable_TCP_ACK_Filter(bool value) { - EnableTCPAckFilter = value; + enabled = value; } bool is_TCP_ACK_Filter_Enabled(void) { - return EnableTCPAckFilter; + return enabled; } static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 buffer_size) From b9e04aa648fccd5d82067a12bc11359ac8b8b8ee Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:57 +0900 Subject: [PATCH 264/843] staging: wilc1000: rename Enable_TCP_ACK_Filter function This patch rename the Enable_TCP_ACK_Filter function to enable_tcp_ack_filter to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ++-- drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 2 +- drivers/staging/wilc1000/wilc_wlan.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 5291868b7077..6f405221030c 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1570,9 +1570,9 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, if ((strStatistics.link_speed > TCP_ACK_FILTER_LINK_SPEED_THRESH) && (strStatistics.link_speed != DEFAULT_LINK_SPEED)) - Enable_TCP_ACK_Filter(true); + enable_tcp_ack_filter(true); else if (strStatistics.link_speed != DEFAULT_LINK_SPEED) - Enable_TCP_ACK_Filter(false); + enable_tcp_ack_filter(false); PRINT_D(CORECONFIG_DBG, "*** stats[%d][%d][%d][%d][%d]\n", sinfo->signal, sinfo->rx_packets, sinfo->tx_packets, sinfo->tx_failed, sinfo->txrate.legacy); diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h index 39cd8e1b5675..d7bdca1f4c5b 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h @@ -104,6 +104,6 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev, #define TCP_ACK_FILTER_LINK_SPEED_THRESH 54 #define DEFAULT_LINK_SPEED 72 -void Enable_TCP_ACK_Filter(bool value); +void enable_tcp_ack_filter(bool value); #endif diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 0bfd1bd9aa2f..53c5804dd172 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -391,7 +391,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) bool enabled = false; -void Enable_TCP_ACK_Filter(bool value) +void enable_tcp_ack_filter(bool value) { enabled = value; } From 44c4417d1b2b3a05c9dd8f653915d2c3a6de4182 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:58 +0900 Subject: [PATCH 265/843] staging: wilc1000: rename is_TCP_ACK_Filter_Enabled function This patch rename the is_TCP_ACK_Filter_Enabled function to is_tcp_ack_filter_enabled to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 53c5804dd172..78a43590e645 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -396,7 +396,7 @@ void enable_tcp_ack_filter(bool value) enabled = value; } -bool is_TCP_ACK_Filter_Enabled(void) +bool is_tcp_ack_filter_enabled(void) { return enabled; } @@ -456,7 +456,7 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, PRINT_D(TX_DBG, "Adding mgmt packet at the Queue tail\n"); #ifdef TCP_ACK_FILTER tqe->tcp_PendingAck_index = NOT_TCP_ACK; - if (is_TCP_ACK_Filter_Enabled()) + if (is_tcp_ack_filter_enabled()) tcp_process(dev, tqe); #endif wilc_wlan_txq_add_to_tail(dev, tqe); From 1d401a4d66f6a3b1c70eec21288fe05d804d4bd8 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:12:59 +0900 Subject: [PATCH 266/843] staging: wilc1000: fixes a struct allocation to match coding standards This patch fixes the checks reported by checkpatch.pl for prefer kmalloc(sizeof(*tqe)...) over kmalloc(sizeof(struct txq_entry_t)...) Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 78a43590e645..0c08a9ac38ae 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -413,7 +413,7 @@ static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 buffer_size) return 0; } - tqe = kmalloc(sizeof(struct txq_entry_t), GFP_ATOMIC); + tqe = kmalloc(sizeof(*tqe), GFP_ATOMIC); if (!tqe) { PRINT_ER("Failed to allocate memory\n"); return 0; @@ -443,7 +443,7 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, if (p->quit) return 0; - tqe = kmalloc(sizeof(struct txq_entry_t), GFP_ATOMIC); + tqe = kmalloc(sizeof(*tqe), GFP_ATOMIC); if (!tqe) return 0; @@ -472,7 +472,7 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, if (p->quit) return 0; - tqe = kmalloc(sizeof(struct txq_entry_t), GFP_KERNEL); + tqe = kmalloc(sizeof(*tqe), GFP_KERNEL); if (!tqe) return 0; From 1b721bf03164854da11be947ebf2e9e89994050f Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:13:00 +0900 Subject: [PATCH 267/843] staging: wilc1000: remove unused argument of chip_sleep_manually function This patch removes u32SleepTime that is second argument of chip_sleep_manually function because it is not used in this function. Remove argument in the function call also. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 3 +-- drivers/staging/wilc1000/wilc_wlan.c | 2 +- drivers/staging/wilc1000/wilc_wlan.h | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 84a247960090..7014915e30d1 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -271,7 +271,6 @@ static struct host_if_drv *join_req_drv; static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo); -extern void chip_sleep_manually(u32 u32SleepTime); extern int linux_wlan_get_num_conn_ifcs(void); static int add_handler_in_list(struct host_if_drv *handler) @@ -2906,7 +2905,7 @@ static int hostIFthread(void *pvArg) PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); if (!linux_wlan_get_num_conn_ifcs()) - chip_sleep_manually(INFINITE_SLEEP_TIME); + chip_sleep_manually(); Handle_ScanDone(msg.drv, SCAN_EVENT_DONE); diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 0c08a9ac38ae..66d5d4267327 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -680,7 +680,7 @@ static inline void chip_wakeup(void) chip_ps_state = CHIP_WAKEDUP; } #endif -void chip_sleep_manually(u32 u32SleepTime) +void chip_sleep_manually(void) { if (chip_ps_state != CHIP_WAKEDUP) return; diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 2eb7e207b3ab..de2fb7cdd1f4 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -309,4 +309,5 @@ int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler); int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size); int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, u32 buffer_size, wilc_tx_complete_func_t func); +void chip_sleep_manually(void); #endif From b1d19298aaca112c895b26df0488e9c3312a1bcf Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:13:01 +0900 Subject: [PATCH 268/843] staging: wilc1000: rename pu32TxqCount in wilc_wlan_handle_txq function This patch rename pu32TxqCount to txq_count that is second argument of wilc_wlan_handle_txq function to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 4 ++-- drivers/staging/wilc1000/wilc_wlan.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 66d5d4267327..cffd7205daeb 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -695,7 +695,7 @@ void chip_sleep_manually(void) release_bus(RELEASE_ONLY); } -int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount) +int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) { wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan; int i, entries = 0; @@ -949,7 +949,7 @@ _end_: p->txq_exit = 1; PRINT_D(TX_DBG, "THREAD: Exiting txq\n"); - *pu32TxqCount = p->txq_entries; + *txq_count = p->txq_entries; return ret; } diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index de2fb7cdd1f4..1eaac9a9c43c 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -300,7 +300,7 @@ int wilc_wlan_start(void); int wilc_wlan_stop(void); int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, u32 buffer_size, wilc_tx_complete_func_t func); -int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount); +int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count); void wilc_handle_isr(void *wilc); void wilc_wlan_cleanup(struct net_device *dev); int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, From 590c0a39650f0212a67141034156cd7452621619 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:13:02 +0900 Subject: [PATCH 269/843] staging: wilc1000: fixes else should follow close brace '}' This patch fixes the error reported by checkpatch.pl for else should follow close brace '}' Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index cffd7205daeb..ec5fc1d3486d 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -898,14 +898,12 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) memcpy(&txb[offset], &header, 4); if (tqe->type == WILC_CFG_PKT) { buffer_offset = ETH_CONFIG_PKT_HDR_OFFSET; - } - else if (tqe->type == WILC_NET_PKT) { + } else if (tqe->type == WILC_NET_PKT) { char *pBSSID = ((struct tx_complete_data *)(tqe->priv))->pBssid; buffer_offset = ETH_ETHERNET_HDR_OFFSET; memcpy(&txb[offset + 4], pBSSID, 6); - } - else { + } else { buffer_offset = HOST_HDR_OFFSET; } @@ -1008,9 +1006,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) pkt_offset &= ~(IS_MANAGMEMENT | IS_MANAGMEMENT_CALLBACK | IS_MGMT_STATUS_SUCCES); WILC_WFI_mgmt_rx(wilc, &buffer[offset + HOST_HDR_OFFSET], pkt_len); - } - else - { + } else { if (!is_cfg_packet) { if (pkt_len > 0) { frmw_to_linux(wilc, From 2f7c31fd9c81a428c024cf5c18eeac6202bfabd7 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:13:03 +0900 Subject: [PATCH 270/843] staging: wilc1000: rename pBSSID variable This patch rename the pBSSID variable to bssid to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index ec5fc1d3486d..f1bb8affec5b 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -899,10 +899,10 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) if (tqe->type == WILC_CFG_PKT) { buffer_offset = ETH_CONFIG_PKT_HDR_OFFSET; } else if (tqe->type == WILC_NET_PKT) { - char *pBSSID = ((struct tx_complete_data *)(tqe->priv))->pBssid; + char *bssid = ((struct tx_complete_data *)(tqe->priv))->pBssid; buffer_offset = ETH_ETHERNET_HDR_OFFSET; - memcpy(&txb[offset + 4], pBSSID, 6); + memcpy(&txb[offset + 4], bssid, 6); } else { buffer_offset = HOST_HDR_OFFSET; } From 13b01e4095476a19d035effa558f791013b07aca Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:13:04 +0900 Subject: [PATCH 271/843] staging: wilc1000: fixes a struct allocation to match coding standards This patch fixes the checks reported by checkpatch.pl for prefer kmalloc(sizeof(*rqe)...) over kmalloc(sizeof(struct rxq_entry_t)...) Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index f1bb8affec5b..c4118fedfb70 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1132,7 +1132,7 @@ _end_: offset += size; p->rx_buffer_offset = offset; #endif - rqe = kmalloc(sizeof(struct rxq_entry_t), GFP_KERNEL); + rqe = kmalloc(sizeof(*rqe), GFP_KERNEL); if (rqe) { rqe->buffer = buffer; rqe->buffer_size = size; From aa313be3c596542872a1b4cef13a07036a72f422 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:13:05 +0900 Subject: [PATCH 272/843] staging: wilc1000: rename bValue in set_machw_change_vir_if function This patch rename bValue to value that is second argument of set_machw_change_vir_if function to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +- drivers/staging/wilc1000/wilc_wlan.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 6f9da09f74c0..54ed72336775 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -217,7 +217,7 @@ void wl_wlan_cleanup(struct wilc *wilc); int wilc_netdev_init(struct wilc **wilc); void wilc1000_wlan_deinit(struct net_device *dev); void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size); -u16 set_machw_change_vir_if(struct net_device *dev, bool bValue); +u16 set_machw_change_vir_if(struct net_device *dev, bool value); int linux_wlan_get_firmware(struct net_device *dev); int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid); #endif diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index c4118fedfb70..458eef2b4df9 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1715,7 +1715,7 @@ _fail_: return ret; } -u16 set_machw_change_vir_if(struct net_device *dev, bool bValue) +u16 set_machw_change_vir_if(struct net_device *dev, bool value) { u16 ret; u32 reg; @@ -1730,7 +1730,7 @@ u16 set_machw_change_vir_if(struct net_device *dev, bool bValue) if (!ret) PRINT_ER("Error while Reading reg WILC_CHANGING_VIR_IF\n"); - if (bValue) + if (value) reg |= BIT(31); else reg &= ~BIT(31); From 7eb17b8d4b49660d2e5c85b234194a0eb3b4e284 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:13:06 +0900 Subject: [PATCH 273/843] staging: wilc1000: fixes braces {} should be used on all arms of this statement This patch fixes the error reported by checkpatch.pl for braces {} should be used on all arms of this statement Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 458eef2b4df9..3b097c137fd3 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1104,9 +1104,9 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) if (LINUX_RX_SIZE - offset < size) offset = 0; - if (p->rx_buffer) + if (p->rx_buffer) { buffer = &p->rx_buffer[offset]; - else { + } else { wilc_debug(N_ERR, "[wilc isr]: fail Rx Buffer is NULL...drop the packets (%d)\n", size); goto _end_; } From 076ef657983d79221cb6f1c9628af2477ead6214 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:13:07 +0900 Subject: [PATCH 274/843] staging: wilc1000: fixes braces {} are not necessary for any arm of this statement This patch fixes the warning reported by checkpatch.pl for braces {} are not necessary for any arm of this statement Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 3b097c137fd3..d7834c5c3130 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1457,11 +1457,10 @@ static int wilc_wlan_cfg_commit(int type, u32 drvHandler) int seq_no = p->cfg_seq_no % 256; int driver_handler = (u32)drvHandler; - if (type == WILC_CFG_SET) { + if (type == WILC_CFG_SET) cfg->wid_header[0] = 'W'; - } else { + else cfg->wid_header[0] = 'Q'; - } cfg->wid_header[1] = seq_no; cfg->wid_header[2] = (u8)total_len; cfg->wid_header[3] = (u8)(total_len >> 8); From 486416798aa8ec2035492b2770104ba5d2a7da6d Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:13:08 +0900 Subject: [PATCH 275/843] staging: wilc1000: rename drvHandler in wilc_wlan_cfg_commit function This patch rename drvHandler to drv_handler that is third argument of wilc_wlan_cfg_commit function to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index d7834c5c3130..2e1d9b8796cd 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1449,13 +1449,13 @@ void wilc_wlan_cleanup(struct net_device *dev) p->hif_func.hif_deinit(NULL); } -static int wilc_wlan_cfg_commit(int type, u32 drvHandler) +static int wilc_wlan_cfg_commit(int type, u32 drv_handler) { wilc_wlan_dev_t *p = &g_wlan; wilc_cfg_frame_t *cfg = &p->cfg_frame; int total_len = p->cfg_frame_offset + 4 + DRIVER_HANDLER_SIZE; int seq_no = p->cfg_seq_no % 256; - int driver_handler = (u32)drvHandler; + int driver_handler = (u32)drv_handler; if (type == WILC_CFG_SET) cfg->wid_header[0] = 'W'; From 9cd034b8418a8774ef57875e682bf71c9f2afca0 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:13:09 +0900 Subject: [PATCH 276/843] staging: wilc1000: rename drvHandler in wilc_wlan_cfg_set function This patch rename drvHandler to drv_handler that is seventh argument of wilc_wlan_cfg_set function to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 4 ++-- drivers/staging/wilc1000/wilc_wlan.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 2e1d9b8796cd..f0a81318ab16 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1477,7 +1477,7 @@ static int wilc_wlan_cfg_commit(int type, u32 drv_handler) } int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, - int commit, u32 drvHandler) + int commit, u32 drv_handler) { wilc_wlan_dev_t *p = &g_wlan; u32 offset; @@ -1500,7 +1500,7 @@ int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, PRINT_D(RX_DBG, "Processing cfg_set()\n"); p->cfg_frame_in_use = 1; - if (wilc_wlan_cfg_commit(WILC_CFG_SET, drvHandler)) + if (wilc_wlan_cfg_commit(WILC_CFG_SET, drv_handler)) ret_size = 0; if (linux_wlan_lock_timeout(&g_linux_wlan->cfg_event, diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 1eaac9a9c43c..03af19bfa37c 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -304,7 +304,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count); void wilc_handle_isr(void *wilc); void wilc_wlan_cleanup(struct net_device *dev); int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, - int commit, u32 drvHandler); + int commit, u32 drv_handler); int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler); int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size); int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, From 4878bd6c8cea8c7986a450c8fc5dd0148d233cf4 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:13:10 +0900 Subject: [PATCH 277/843] staging: wilc1000: rename drvHandler in wilc_wlan_cfg_get function This patch rename drvHandler to drv_handler that is fifth argument of wilc_wlan_cfg_get function to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 4 ++-- drivers/staging/wilc1000/wilc_wlan.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index f0a81318ab16..09029b61be52 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1516,7 +1516,7 @@ int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, return ret_size; } -int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler) +int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drv_handler) { wilc_wlan_dev_t *p = &g_wlan; u32 offset; @@ -1536,7 +1536,7 @@ int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler) if (commit) { p->cfg_frame_in_use = 1; - if (wilc_wlan_cfg_commit(WILC_CFG_QUERY, drvHandler)) + if (wilc_wlan_cfg_commit(WILC_CFG_QUERY, drv_handler)) ret_size = 0; if (linux_wlan_lock_timeout(&g_linux_wlan->cfg_event, diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 03af19bfa37c..55e4f19e29da 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -305,7 +305,7 @@ void wilc_handle_isr(void *wilc); void wilc_wlan_cleanup(struct net_device *dev); int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, int commit, u32 drv_handler); -int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler); +int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drv_handler); int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size); int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, u32 buffer_size, wilc_tx_complete_func_t func); From 9962b1a0401801ef27c8403c7dec597ea6467e0f Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:19:49 +0900 Subject: [PATCH 278/843] staging: wilc1000: wilc_wlan.c: remove unused pointer variables This patch removes unused two pointer variable. - Free_head - Alloc_head It's pointer variables unused inside code. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 09029b61be52..7e7e77facc5f 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -208,9 +208,6 @@ struct pending_acks_info { struct txq_entry_t *txqe; }; -struct ack_session_info *Free_head; -struct ack_session_info *Alloc_head; - #define NOT_TCP_ACK (-1) #define MAX_TCP_SESSION 25 From 66a43a916263580a38f9882314f42ac864389ba2 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:19:50 +0900 Subject: [PATCH 279/843] staging: wilc1000: fixes alignment should match open parenthesis This patch fixes the checks reported by checkpatch.pl for alignment should match open parenthesis. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 7e7e77facc5f..68158c94248f 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -244,7 +244,7 @@ static inline int update_tcp_session(u32 index, u32 ack) } static inline int add_tcp_pending_ack(u32 ack, u32 session_index, - struct txq_entry_t *txqe) + struct txq_entry_t *txqe) { total_acks++; if (pending_acks < MAX_PENDING_ACKS) { From 8e55639d066f4ef402ba88fca08ed1be70e1c4da Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:19:51 +0900 Subject: [PATCH 280/843] staging: wilc1000: rename tcp_PendingAck_index of struct txq_entry_t This patch renames tcp_PendingAck_index of struct txq_entry_t to index to avoid CamelCase naming convention. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 12 ++++++------ drivers/staging/wilc1000/wilc_wlan.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 68158c94248f..679ae7efa431 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -251,7 +251,7 @@ static inline int add_tcp_pending_ack(u32 ack, u32 session_index, pending_acks_info[pending_base + pending_acks].ack_num = ack; pending_acks_info[pending_base + pending_acks].txqe = txqe; pending_acks_info[pending_base + pending_acks].session_index = session_index; - txqe->tcp_PendingAck_index = pending_base + pending_acks; + txqe->index = pending_base + pending_acks; pending_acks++; } return 0; @@ -422,7 +422,7 @@ static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 buffer_size) tqe->tx_complete_func = NULL; tqe->priv = NULL; #ifdef TCP_ACK_FILTER - tqe->tcp_PendingAck_index = NOT_TCP_ACK; + tqe->index = NOT_TCP_ACK; #endif PRINT_D(TX_DBG, "Adding the config packet at the Queue tail\n"); @@ -452,7 +452,7 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, PRINT_D(TX_DBG, "Adding mgmt packet at the Queue tail\n"); #ifdef TCP_ACK_FILTER - tqe->tcp_PendingAck_index = NOT_TCP_ACK; + tqe->index = NOT_TCP_ACK; if (is_tcp_ack_filter_enabled()) tcp_process(dev, tqe); #endif @@ -479,7 +479,7 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, tqe->tx_complete_func = func; tqe->priv = priv; #ifdef TCP_ACK_FILTER - tqe->tcp_PendingAck_index = NOT_TCP_ACK; + tqe->index = NOT_TCP_ACK; #endif PRINT_D(TX_DBG, "Adding Network packet at the Queue tail\n"); wilc_wlan_txq_add_to_tail(dev, tqe); @@ -911,8 +911,8 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) if (tqe->tx_complete_func) tqe->tx_complete_func(tqe->priv, tqe->status); #ifdef TCP_ACK_FILTER - if (tqe->tcp_PendingAck_index != NOT_TCP_ACK) - pending_acks_info[tqe->tcp_PendingAck_index].txqe = NULL; + if (tqe->index != NOT_TCP_ACK) + pending_acks_info[tqe->index].txqe = NULL; #endif kfree(tqe); } else { diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 55e4f19e29da..ff852b4c2763 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -231,7 +231,7 @@ struct txq_entry_t { struct txq_entry_t *next; struct txq_entry_t *prev; int type; - int tcp_PendingAck_index; + int index; u8 *buffer; int buffer_size; void *priv; From 706671db2f4714c1f5df65861d8b69a61ddd2da3 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:19:52 +0900 Subject: [PATCH 281/843] staging: wilc1000: fixes space prohibited between function name and open parenthesis This patch fixes the warning reported by checkpatch.pl for space prohibited between function name and open parenthesis '(' Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 679ae7efa431..ba5060578c91 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1678,7 +1678,7 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) goto _fail_; } -#if defined (MEMORY_STATIC) +#if defined(MEMORY_STATIC) if (!g_wlan.rx_buffer) g_wlan.rx_buffer = kmalloc(LINUX_RX_SIZE, GFP_KERNEL); PRINT_D(TX_DBG, "g_wlan.rx_buffer =%p\n", g_wlan.rx_buffer); From 7df0bb0db516095d8b719e8dd0daca22b1daa248 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:19:53 +0900 Subject: [PATCH 282/843] staging: wilc1000: fixes possible unnecessary 'out of memory' message This patch fixes the warning reported by checkpatch.pl for possible unnecessary 'out of memory' message Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index ba5060578c91..70d794b717fd 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1111,7 +1111,6 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) #else buffer = kmalloc(size, GFP_KERNEL); if (!buffer) { - wilc_debug(N_ERR, "[wilc isr]: fail alloc host memory...drop the packets (%d)\n", size); usleep_range(100 * 1000, 100 * 1000); goto _end_; } From ab12d8c773f86cbbd3773f65b355922fd13e5951 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:19:54 +0900 Subject: [PATCH 283/843] staging: wilc1000: remove warnings line over 80 characters This patch removes the warnings reported by checkpatch.pl for line over 80 characters. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 50 +++++++++++++++++++--------- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 70d794b717fd..ffe7baa9277d 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -361,7 +361,8 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) dropped_acks++; tqe->status = 1; if (tqe->tx_complete_func) - tqe->tx_complete_func(tqe->priv, tqe->status); + tqe->tx_complete_func(tqe->priv, + tqe->status); kfree(tqe); dropped++; } @@ -747,7 +748,8 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) PRINT_D(TX_DBG, "VMM Size AFTER alignment = %d\n", vmm_sz); vmm_table[i] = vmm_sz / 4; - PRINT_D(TX_DBG, "VMMTable entry size = %d\n", vmm_table[i]); + PRINT_D(TX_DBG, "VMMTable entry size = %d\n", + vmm_table[i]); if (tqe->type == WILC_CFG_PKT) { vmm_table[i] |= BIT(10); @@ -883,7 +885,9 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) #endif vmm_sz = (vmm_table[i] & 0x3ff); vmm_sz *= 4; - header = (tqe->type << 31) | (tqe->buffer_size << 15) | vmm_sz; + header = (tqe->type << 31) | + (tqe->buffer_size << 15) | + vmm_sz; if (tqe->type == WILC_MGMT_PKT) header |= BIT(30); else @@ -904,12 +908,14 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) buffer_offset = HOST_HDR_OFFSET; } - memcpy(&txb[offset + buffer_offset], tqe->buffer, tqe->buffer_size); + memcpy(&txb[offset + buffer_offset], + tqe->buffer, tqe->buffer_size); offset += vmm_sz; i++; tqe->status = 1; if (tqe->tx_complete_func) - tqe->tx_complete_func(tqe->priv, tqe->status); + tqe->tx_complete_func(tqe->priv, + tqe->status); #ifdef TCP_ACK_FILTER if (tqe->index != NOT_TCP_ACK) pending_acks_info[tqe->index].txqe = NULL; @@ -970,7 +976,8 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) } buffer = rqe->buffer; size = rqe->buffer_size; - PRINT_D(RX_DBG, "rxQ entery Size = %d - Address = %p\n", size, buffer); + PRINT_D(RX_DBG, "rxQ entery Size = %d - Address = %p\n", + size, buffer); offset = 0; do { @@ -983,7 +990,8 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) #ifdef BIG_ENDIAN header = BYTE_SWAP(header); #endif - PRINT_D(RX_DBG, "Header = %04x - Offset = %d\n", header, offset); + PRINT_D(RX_DBG, "Header = %04x - Offset = %d\n", + header, offset); is_cfg_packet = (header >> 31) & 0x1; pkt_offset = (header >> 22) & 0x1ff; @@ -1000,7 +1008,9 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) #define IS_MGMT_STATUS_SUCCES 0x040 if (pkt_offset & IS_MANAGMEMENT) { - pkt_offset &= ~(IS_MANAGMEMENT | IS_MANAGMEMENT_CALLBACK | IS_MGMT_STATUS_SUCCES); + pkt_offset &= ~(IS_MANAGMEMENT | + IS_MANAGMEMENT_CALLBACK | + IS_MGMT_STATUS_SUCCES); WILC_WFI_mgmt_rx(wilc, &buffer[offset + HOST_HDR_OFFSET], pkt_len); } else { @@ -1356,22 +1366,26 @@ int wilc_wlan_stop(void) release_bus(RELEASE_ALLOW_SLEEP); return ret; } - PRINT_D(GENERIC_DBG, "Read RESET Reg %x : Retry%d\n", reg, timeout); + PRINT_D(GENERIC_DBG, "Read RESET Reg %x : Retry%d\n", + reg, timeout); if ((reg & BIT(10))) { - PRINT_D(GENERIC_DBG, "Bit 10 not reset : Retry %d\n", timeout); + PRINT_D(GENERIC_DBG, "Bit 10 not reset : Retry %d\n", + timeout); reg &= ~BIT(10); ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg); timeout--; } else { - PRINT_D(GENERIC_DBG, "Bit 10 reset after : Retry %d\n", timeout); + PRINT_D(GENERIC_DBG, "Bit 10 reset after : Retry %d\n", + timeout); ret = p->hif_func.hif_read_reg(WILC_GLB_RESET_0, ®); if (!ret) { PRINT_ER("Error while reading reg\n"); release_bus(RELEASE_ALLOW_SLEEP); return ret; } - PRINT_D(GENERIC_DBG, "Read RESET Reg %x : Retry%d\n", reg, timeout); + PRINT_D(GENERIC_DBG, "Read RESET Reg %x : Retry%d\n", + reg, timeout); break; } @@ -1492,7 +1506,8 @@ int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, p->cfg_frame_offset = offset; if (commit) { - PRINT_D(TX_DBG, "[WILC]PACKET Commit with sequence number %d\n", p->cfg_seq_no); + PRINT_D(TX_DBG, "[WILC]PACKET Commit with sequence number %d\n", + p->cfg_seq_no); PRINT_D(RX_DBG, "Processing cfg_set()\n"); p->cfg_frame_in_use = 1; @@ -1641,21 +1656,24 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) PRINT_D(INIT_DBG, "Initializing WILC_Wlan ...\n"); memset((void *)&g_wlan, 0, sizeof(wilc_wlan_dev_t)); - memcpy((void *)&g_wlan.io_func, (void *)&inp->io_func, sizeof(wilc_wlan_io_func_t)); + memcpy((void *)&g_wlan.io_func, (void *)&inp->io_func, + sizeof(wilc_wlan_io_func_t)); if ((inp->io_func.io_type & 0x1) == HIF_SDIO) { if (!hif_sdio.hif_init(inp, wilc_debug)) { ret = -5; goto _fail_; } - memcpy((void *)&g_wlan.hif_func, &hif_sdio, sizeof(wilc_hif_func_t)); + memcpy((void *)&g_wlan.hif_func, &hif_sdio, + sizeof(wilc_hif_func_t)); } else { if ((inp->io_func.io_type & 0x1) == HIF_SPI) { if (!hif_spi.hif_init(inp, wilc_debug)) { ret = -5; goto _fail_; } - memcpy((void *)&g_wlan.hif_func, &hif_spi, sizeof(wilc_hif_func_t)); + memcpy((void *)&g_wlan.hif_func, &hif_spi, + sizeof(wilc_hif_func_t)); } else { ret = -5; goto _fail_; From 92e7d188860277bf539c247c262d5a7ae098deb4 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:19:55 +0900 Subject: [PATCH 284/843] staging: wilc1000: replace numeric type to kernel error type This patch replaces numeric type to generic type by kernel style. -5 -> -EIO -105 -> -ENOBUFS Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index ffe7baa9277d..283c506b4f21 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1194,7 +1194,7 @@ int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size) dma_buffer = kmalloc(blksz, GFP_KERNEL); if (!dma_buffer) { - ret = -5; + ret = -EIO; PRINT_ER("Can't allocate buffer for firmware download IO error\n "); goto _fail_1; } @@ -1229,7 +1229,7 @@ int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size) release_bus(RELEASE_ONLY); if (!ret) { - ret = -5; + ret = -EIO; PRINT_ER("Can't download firmware IO error\n "); goto _fail_; } @@ -1263,7 +1263,7 @@ int wilc_wlan_start(void) if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail write reg vmm_core_cfg...\n"); release_bus(RELEASE_ONLY); - ret = -5; + ret = -EIO; return ret; } reg = 0; @@ -1298,7 +1298,7 @@ int wilc_wlan_start(void) if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail write WILC_GP_REG_1 ...\n"); release_bus(RELEASE_ONLY); - ret = -5; + ret = -EIO; return ret; } @@ -1308,7 +1308,7 @@ int wilc_wlan_start(void) if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail read reg 0x1000 ...\n"); release_bus(RELEASE_ONLY); - ret = -5; + ret = -EIO; return ret; } @@ -1661,7 +1661,7 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) if ((inp->io_func.io_type & 0x1) == HIF_SDIO) { if (!hif_sdio.hif_init(inp, wilc_debug)) { - ret = -5; + ret = -EIO; goto _fail_; } memcpy((void *)&g_wlan.hif_func, &hif_sdio, @@ -1669,19 +1669,19 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) } else { if ((inp->io_func.io_type & 0x1) == HIF_SPI) { if (!hif_spi.hif_init(inp, wilc_debug)) { - ret = -5; + ret = -EIO; goto _fail_; } memcpy((void *)&g_wlan.hif_func, &hif_spi, sizeof(wilc_hif_func_t)); } else { - ret = -5; + ret = -EIO; goto _fail_; } } if (!wilc_wlan_cfg_init(wilc_debug)) { - ret = -105; + ret = -ENOBUFS; goto _fail_; } @@ -1690,7 +1690,7 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) PRINT_D(TX_DBG, "g_wlan.tx_buffer = %p\n", g_wlan.tx_buffer); if (!g_wlan.tx_buffer) { - ret = -105; + ret = -ENOBUFS; PRINT_ER("Can't allocate Tx Buffer"); goto _fail_; } @@ -1700,14 +1700,14 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) g_wlan.rx_buffer = kmalloc(LINUX_RX_SIZE, GFP_KERNEL); PRINT_D(TX_DBG, "g_wlan.rx_buffer =%p\n", g_wlan.rx_buffer); if (!g_wlan.rx_buffer) { - ret = -105; + ret = -ENOBUFS; PRINT_ER("Can't allocate Rx Buffer"); goto _fail_; } #endif if (!init_chip(dev)) { - ret = -5; + ret = -EIO; goto _fail_; } #ifdef TCP_ACK_FILTER From 7cf241a1cdb481b14e4d55e10d4b45f78aa41df4 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:19:56 +0900 Subject: [PATCH 285/843] staging: wilc1000: wilc_wlan.h: alignment defines This patch fixes alignment of defines. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.h | 258 ++++++++++++++------------- 1 file changed, 131 insertions(+), 127 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index ff852b4c2763..ba7063020417 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -3,7 +3,7 @@ -#define ISWILC1000(id) (((id & 0xfffff000) == 0x100000) ? 1 : 0) +#define ISWILC1000(id) ((id & 0xfffff000) == 0x100000 ? 1 : 0) /******************************************** @@ -11,27 +11,30 @@ * Mac eth header length * ********************************************/ -#define DRIVER_HANDLER_SIZE 4 -#define MAX_MAC_HDR_LEN 26 /* QOS_MAC_HDR_LEN */ -#define SUB_MSDU_HEADER_LENGTH 14 -#define SNAP_HDR_LEN 8 -#define ETHERNET_HDR_LEN 14 -#define WORD_ALIGNMENT_PAD 0 +#define DRIVER_HANDLER_SIZE 4 +#define MAX_MAC_HDR_LEN 26 /* QOS_MAC_HDR_LEN */ +#define SUB_MSDU_HEADER_LENGTH 14 +#define SNAP_HDR_LEN 8 +#define ETHERNET_HDR_LEN 14 +#define WORD_ALIGNMENT_PAD 0 -#define ETH_ETHERNET_HDR_OFFSET (MAX_MAC_HDR_LEN + SUB_MSDU_HEADER_LENGTH + \ - SNAP_HDR_LEN - ETHERNET_HDR_LEN + WORD_ALIGNMENT_PAD) +#define ETH_ETHERNET_HDR_OFFSET (MAX_MAC_HDR_LEN + \ + SUB_MSDU_HEADER_LENGTH + \ + SNAP_HDR_LEN - \ + ETHERNET_HDR_LEN + \ + WORD_ALIGNMENT_PAD) -#define HOST_HDR_OFFSET 4 -#define ETHERNET_HDR_LEN 14 -#define IP_HDR_LEN 20 -#define IP_HDR_OFFSET ETHERNET_HDR_LEN -#define UDP_HDR_OFFSET (IP_HDR_LEN + IP_HDR_OFFSET) -#define UDP_HDR_LEN 8 -#define UDP_DATA_OFFSET (UDP_HDR_OFFSET + UDP_HDR_LEN) -#define ETH_CONFIG_PKT_HDR_LEN UDP_DATA_OFFSET +#define HOST_HDR_OFFSET 4 +#define ETHERNET_HDR_LEN 14 +#define IP_HDR_LEN 20 +#define IP_HDR_OFFSET ETHERNET_HDR_LEN +#define UDP_HDR_OFFSET (IP_HDR_LEN + IP_HDR_OFFSET) +#define UDP_HDR_LEN 8 +#define UDP_DATA_OFFSET (UDP_HDR_OFFSET + UDP_HDR_LEN) +#define ETH_CONFIG_PKT_HDR_LEN UDP_DATA_OFFSET -#define ETH_CONFIG_PKT_HDR_OFFSET (ETH_ETHERNET_HDR_OFFSET + \ - ETH_CONFIG_PKT_HDR_LEN) +#define ETH_CONFIG_PKT_HDR_OFFSET (ETH_ETHERNET_HDR_OFFSET + \ + ETH_CONFIG_PKT_HDR_LEN) /******************************************** * @@ -39,91 +42,92 @@ * ********************************************/ -#define BYTE_SWAP(val) ((((val) & 0x000000FF) << 24) + \ - (((val) & 0x0000FF00) << 8) + \ - (((val) & 0x00FF0000) >> 8) + \ - (((val) & 0xFF000000) >> 24)) +#define BYTE_SWAP(val) (((val & 0x000000FF) << 24) + \ + ((val & 0x0000FF00) << 8) + \ + ((val & 0x00FF0000) >> 8) + \ + ((val & 0xFF000000) >> 24)) /******************************************** * * Register Defines * ********************************************/ -#define WILC_PERIPH_REG_BASE 0x1000 -#define WILC_CHANGING_VIR_IF (0x108c) -#define WILC_CHIPID (WILC_PERIPH_REG_BASE) -#define WILC_GLB_RESET_0 (WILC_PERIPH_REG_BASE + 0x400) -#define WILC_PIN_MUX_0 (WILC_PERIPH_REG_BASE + 0x408) -#define WILC_HOST_TX_CTRL (WILC_PERIPH_REG_BASE + 0x6c) -#define WILC_HOST_RX_CTRL_0 (WILC_PERIPH_REG_BASE + 0x70) -#define WILC_HOST_RX_CTRL_1 (WILC_PERIPH_REG_BASE + 0x74) -#define WILC_HOST_VMM_CTL (WILC_PERIPH_REG_BASE + 0x78) -#define WILC_HOST_RX_CTRL (WILC_PERIPH_REG_BASE + 0x80) -#define WILC_HOST_RX_EXTRA_SIZE (WILC_PERIPH_REG_BASE + 0x84) -#define WILC_HOST_TX_CTRL_1 (WILC_PERIPH_REG_BASE + 0x88) -#define WILC_MISC (WILC_PERIPH_REG_BASE + 0x428) -#define WILC_INTR_REG_BASE (WILC_PERIPH_REG_BASE + 0xa00) -#define WILC_INTR_ENABLE (WILC_INTR_REG_BASE) -#define WILC_INTR2_ENABLE (WILC_INTR_REG_BASE + 4) +#define WILC_PERIPH_REG_BASE 0x1000 +#define WILC_CHANGING_VIR_IF 0x108c +#define WILC_CHIPID WILC_PERIPH_REG_BASE +#define WILC_GLB_RESET_0 (WILC_PERIPH_REG_BASE + 0x400) +#define WILC_PIN_MUX_0 (WILC_PERIPH_REG_BASE + 0x408) +#define WILC_HOST_TX_CTRL (WILC_PERIPH_REG_BASE + 0x6c) +#define WILC_HOST_RX_CTRL_0 (WILC_PERIPH_REG_BASE + 0x70) +#define WILC_HOST_RX_CTRL_1 (WILC_PERIPH_REG_BASE + 0x74) +#define WILC_HOST_VMM_CTL (WILC_PERIPH_REG_BASE + 0x78) +#define WILC_HOST_RX_CTRL (WILC_PERIPH_REG_BASE + 0x80) +#define WILC_HOST_RX_EXTRA_SIZE (WILC_PERIPH_REG_BASE + 0x84) +#define WILC_HOST_TX_CTRL_1 (WILC_PERIPH_REG_BASE + 0x88) +#define WILC_MISC (WILC_PERIPH_REG_BASE + 0x428) +#define WILC_INTR_REG_BASE (WILC_PERIPH_REG_BASE + 0xa00) +#define WILC_INTR_ENABLE WILC_INTR_REG_BASE +#define WILC_INTR2_ENABLE (WILC_INTR_REG_BASE + 4) -#define WILC_INTR_POLARITY (WILC_INTR_REG_BASE + 0x10) -#define WILC_INTR_TYPE (WILC_INTR_REG_BASE + 0x20) -#define WILC_INTR_CLEAR (WILC_INTR_REG_BASE + 0x30) -#define WILC_INTR_STATUS (WILC_INTR_REG_BASE + 0x40) +#define WILC_INTR_POLARITY (WILC_INTR_REG_BASE + 0x10) +#define WILC_INTR_TYPE (WILC_INTR_REG_BASE + 0x20) +#define WILC_INTR_CLEAR (WILC_INTR_REG_BASE + 0x30) +#define WILC_INTR_STATUS (WILC_INTR_REG_BASE + 0x40) -#define WILC_VMM_TBL_SIZE 64 -#define WILC_VMM_TX_TBL_BASE (0x150400) -#define WILC_VMM_RX_TBL_BASE (0x150500) +#define WILC_VMM_TBL_SIZE 64 +#define WILC_VMM_TX_TBL_BASE 0x150400 +#define WILC_VMM_RX_TBL_BASE 0x150500 -#define WILC_VMM_BASE 0x150000 -#define WILC_VMM_CORE_CTL (WILC_VMM_BASE) -#define WILC_VMM_TBL_CTL (WILC_VMM_BASE + 0x4) -#define WILC_VMM_TBL_ENTRY (WILC_VMM_BASE + 0x8) -#define WILC_VMM_TBL0_SIZE (WILC_VMM_BASE + 0xc) -#define WILC_VMM_TO_HOST_SIZE (WILC_VMM_BASE + 0x10) -#define WILC_VMM_CORE_CFG (WILC_VMM_BASE + 0x14) -#define WILC_VMM_TBL_ACTIVE (WILC_VMM_BASE + 040) -#define WILC_VMM_TBL_STATUS (WILC_VMM_BASE + 0x44) +#define WILC_VMM_BASE 0x150000 +#define WILC_VMM_CORE_CTL WILC_VMM_BASE +#define WILC_VMM_TBL_CTL (WILC_VMM_BASE + 0x4) +#define WILC_VMM_TBL_ENTRY (WILC_VMM_BASE + 0x8) +#define WILC_VMM_TBL0_SIZE (WILC_VMM_BASE + 0xc) +#define WILC_VMM_TO_HOST_SIZE (WILC_VMM_BASE + 0x10) +#define WILC_VMM_CORE_CFG (WILC_VMM_BASE + 0x14) +#define WILC_VMM_TBL_ACTIVE (WILC_VMM_BASE + 040) +#define WILC_VMM_TBL_STATUS (WILC_VMM_BASE + 0x44) -#define WILC_SPI_REG_BASE 0xe800 -#define WILC_SPI_CTL (WILC_SPI_REG_BASE) -#define WILC_SPI_MASTER_DMA_ADDR (WILC_SPI_REG_BASE + 0x4) -#define WILC_SPI_MASTER_DMA_COUNT (WILC_SPI_REG_BASE + 0x8) -#define WILC_SPI_SLAVE_DMA_ADDR (WILC_SPI_REG_BASE + 0xc) -#define WILC_SPI_SLAVE_DMA_COUNT (WILC_SPI_REG_BASE + 0x10) -#define WILC_SPI_TX_MODE (WILC_SPI_REG_BASE + 0x20) -#define WILC_SPI_PROTOCOL_CONFIG (WILC_SPI_REG_BASE + 0x24) -#define WILC_SPI_INTR_CTL (WILC_SPI_REG_BASE + 0x2c) +#define WILC_SPI_REG_BASE 0xe800 +#define WILC_SPI_CTL WILC_SPI_REG_BASE +#define WILC_SPI_MASTER_DMA_ADDR (WILC_SPI_REG_BASE + 0x4) +#define WILC_SPI_MASTER_DMA_COUNT (WILC_SPI_REG_BASE + 0x8) +#define WILC_SPI_SLAVE_DMA_ADDR (WILC_SPI_REG_BASE + 0xc) +#define WILC_SPI_SLAVE_DMA_COUNT (WILC_SPI_REG_BASE + 0x10) +#define WILC_SPI_TX_MODE (WILC_SPI_REG_BASE + 0x20) +#define WILC_SPI_PROTOCOL_CONFIG (WILC_SPI_REG_BASE + 0x24) +#define WILC_SPI_INTR_CTL (WILC_SPI_REG_BASE + 0x2c) -#define WILC_SPI_PROTOCOL_OFFSET (WILC_SPI_PROTOCOL_CONFIG - WILC_SPI_REG_BASE) +#define WILC_SPI_PROTOCOL_OFFSET (WILC_SPI_PROTOCOL_CONFIG - \ + WILC_SPI_REG_BASE) -#define WILC_AHB_DATA_MEM_BASE 0x30000 -#define WILC_AHB_SHARE_MEM_BASE 0xd0000 +#define WILC_AHB_DATA_MEM_BASE 0x30000 +#define WILC_AHB_SHARE_MEM_BASE 0xd0000 -#define WILC_VMM_TBL_RX_SHADOW_BASE WILC_AHB_SHARE_MEM_BASE -#define WILC_VMM_TBL_RX_SHADOW_SIZE (256) +#define WILC_VMM_TBL_RX_SHADOW_BASE WILC_AHB_SHARE_MEM_BASE +#define WILC_VMM_TBL_RX_SHADOW_SIZE 256 -#define WILC_GP_REG_0 0x149c -#define WILC_GP_REG_1 0x14a0 +#define WILC_GP_REG_0 0x149c +#define WILC_GP_REG_1 0x14a0 -#define rHAVE_SDIO_IRQ_GPIO_BIT (0) -#define rHAVE_USE_PMU_BIT (1) -#define rHAVE_SLEEP_CLK_SRC_RTC_BIT (2) -#define rHAVE_SLEEP_CLK_SRC_XO_BIT (3) -#define rHAVE_EXT_PA_INV_TX_RX_BIT (4) -#define rHAVE_LEGACY_RF_SETTINGS_BIT (5) -#define rHAVE_XTAL_24_BIT (6) -#define rHAVE_DISABLE_WILC_UART_BIT (7) +#define rHAVE_SDIO_IRQ_GPIO_BIT 0 +#define rHAVE_USE_PMU_BIT 1 +#define rHAVE_SLEEP_CLK_SRC_RTC_BIT 2 +#define rHAVE_SLEEP_CLK_SRC_XO_BIT 3 +#define rHAVE_EXT_PA_INV_TX_RX_BIT 4 +#define rHAVE_LEGACY_RF_SETTINGS_BIT 5 +#define rHAVE_XTAL_24_BIT 6 +#define rHAVE_DISABLE_WILC_UART_BIT 7 -#define WILC_HAVE_SDIO_IRQ_GPIO (1 << rHAVE_SDIO_IRQ_GPIO_BIT) -#define WILC_HAVE_USE_PMU (1 << rHAVE_USE_PMU_BIT) -#define WILC_HAVE_SLEEP_CLK_SRC_RTC (1 << rHAVE_SLEEP_CLK_SRC_RTC_BIT) -#define WILC_HAVE_SLEEP_CLK_SRC_XO (1 << rHAVE_SLEEP_CLK_SRC_XO_BIT) -#define WILC_HAVE_EXT_PA_INV_TX_RX (1 << rHAVE_EXT_PA_INV_TX_RX_BIT) -#define WILC_HAVE_LEGACY_RF_SETTINGS (1 << rHAVE_LEGACY_RF_SETTINGS_BIT) -#define WILC_HAVE_XTAL_24 (1 << rHAVE_XTAL_24_BIT) -#define WILC_HAVE_DISABLE_WILC_UART (1 << rHAVE_DISABLE_WILC_UART_BIT) +#define WILC_HAVE_SDIO_IRQ_GPIO (1 << rHAVE_SDIO_IRQ_GPIO_BIT) +#define WILC_HAVE_USE_PMU (1 << rHAVE_USE_PMU_BIT) +#define WILC_HAVE_SLEEP_CLK_SRC_RTC (1 << rHAVE_SLEEP_CLK_SRC_RTC_BIT) +#define WILC_HAVE_SLEEP_CLK_SRC_XO (1 << rHAVE_SLEEP_CLK_SRC_XO_BIT) +#define WILC_HAVE_EXT_PA_INV_TX_RX (1 << rHAVE_EXT_PA_INV_TX_RX_BIT) +#define WILC_HAVE_LEGACY_RF_SETTINGS (1 << rHAVE_LEGACY_RF_SETTINGS_BIT) +#define WILC_HAVE_XTAL_24 (1 << rHAVE_XTAL_24_BIT) +#define WILC_HAVE_DISABLE_WILC_UART (1 << rHAVE_DISABLE_WILC_UART_BIT) /******************************************** @@ -131,25 +135,25 @@ * Wlan Defines * ********************************************/ -#define WILC_CFG_PKT 1 -#define WILC_NET_PKT 0 -#define WILC_MGMT_PKT 2 +#define WILC_CFG_PKT 1 +#define WILC_NET_PKT 0 +#define WILC_MGMT_PKT 2 -#define WILC_CFG_SET 1 -#define WILC_CFG_QUERY 0 +#define WILC_CFG_SET 1 +#define WILC_CFG_QUERY 0 -#define WILC_CFG_RSP 1 -#define WILC_CFG_RSP_STATUS 2 -#define WILC_CFG_RSP_SCAN 3 +#define WILC_CFG_RSP 1 +#define WILC_CFG_RSP_STATUS 2 +#define WILC_CFG_RSP_SCAN 3 #ifdef WILC_SDIO -#define WILC_PLL_TO 4 +#define WILC_PLL_TO 4 #else -#define WILC_PLL_TO 2 +#define WILC_PLL_TO 2 #endif -#define ABORT_INT BIT(31) +#define ABORT_INT BIT(31) /*******************************************/ /* E0 and later Interrupt flags. */ @@ -165,15 +169,15 @@ /* 20: INT4 flag */ /* 21: INT5 flag */ /*******************************************/ -#define IRG_FLAGS_OFFSET 16 -#define IRQ_DMA_WD_CNT_MASK ((1ul << IRG_FLAGS_OFFSET) - 1) -#define INT_0 (1 << (IRG_FLAGS_OFFSET)) -#define INT_1 (1 << (IRG_FLAGS_OFFSET + 1)) -#define INT_2 (1 << (IRG_FLAGS_OFFSET + 2)) -#define INT_3 (1 << (IRG_FLAGS_OFFSET + 3)) -#define INT_4 (1 << (IRG_FLAGS_OFFSET + 4)) -#define INT_5 (1 << (IRG_FLAGS_OFFSET + 5)) -#define MAX_NUM_INT (6) +#define IRG_FLAGS_OFFSET 16 +#define IRQ_DMA_WD_CNT_MASK ((1ul << IRG_FLAGS_OFFSET) - 1) +#define INT_0 (1 << IRG_FLAGS_OFFSET) +#define INT_1 (1 << (IRG_FLAGS_OFFSET + 1)) +#define INT_2 (1 << (IRG_FLAGS_OFFSET + 2)) +#define INT_3 (1 << (IRG_FLAGS_OFFSET + 3)) +#define INT_4 (1 << (IRG_FLAGS_OFFSET + 4)) +#define INT_5 (1 << (IRG_FLAGS_OFFSET + 5)) +#define MAX_NUM_INT 6 /*******************************************/ /* E0 and later Interrupt flags. */ @@ -188,28 +192,28 @@ /* 7: Select VMM table 2 */ /* 8: Enable VMM */ /*******************************************/ -#define CLR_INT0 BIT(0) -#define CLR_INT1 BIT(1) -#define CLR_INT2 BIT(2) -#define CLR_INT3 BIT(3) -#define CLR_INT4 BIT(4) -#define CLR_INT5 BIT(5) -#define SEL_VMM_TBL0 BIT(6) -#define SEL_VMM_TBL1 BIT(7) -#define EN_VMM BIT(8) +#define CLR_INT0 BIT(0) +#define CLR_INT1 BIT(1) +#define CLR_INT2 BIT(2) +#define CLR_INT3 BIT(3) +#define CLR_INT4 BIT(4) +#define CLR_INT5 BIT(5) +#define SEL_VMM_TBL0 BIT(6) +#define SEL_VMM_TBL1 BIT(7) +#define EN_VMM BIT(8) -#define DATA_INT_EXT INT_0 -#define PLL_INT_EXT INT_1 -#define SLEEP_INT_EXT INT_2 -#define ALL_INT_EXT (DATA_INT_EXT | PLL_INT_EXT | SLEEP_INT_EXT) -#define NUM_INT_EXT (3) +#define DATA_INT_EXT INT_0 +#define PLL_INT_EXT INT_1 +#define SLEEP_INT_EXT INT_2 +#define ALL_INT_EXT (DATA_INT_EXT | PLL_INT_EXT | SLEEP_INT_EXT) +#define NUM_INT_EXT 3 -#define DATA_INT_CLR CLR_INT0 -#define PLL_INT_CLR CLR_INT1 -#define SLEEP_INT_CLR CLR_INT2 +#define DATA_INT_CLR CLR_INT0 +#define PLL_INT_CLR CLR_INT1 +#define SLEEP_INT_CLR CLR_INT2 -#define ENABLE_RX_VMM (SEL_VMM_TBL1 | EN_VMM) -#define ENABLE_TX_VMM (SEL_VMM_TBL0 | EN_VMM) +#define ENABLE_RX_VMM (SEL_VMM_TBL1 | EN_VMM) +#define ENABLE_TX_VMM (SEL_VMM_TBL0 | EN_VMM) /*time for expiring the semaphores of cfg packets*/ @@ -276,7 +280,7 @@ typedef struct { * ********************************************/ -#define MAX_CFG_FRAME_SIZE 1468 +#define MAX_CFG_FRAME_SIZE 1468 typedef struct { u8 ether_header[14]; From 97c14e8cd291b1dc60701a4c6b1b66c3271c26e0 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:19:57 +0900 Subject: [PATCH 286/843] staging: wilc1000: fixes prefer using the BIT macro This patch fixes the warning reported by checkpatch.pl for prefer using the BIT macro. And, removes unnecessary bit increase defines. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.h | 39 ++++++++++------------------ 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index ba7063020417..6ca254435846 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -110,25 +110,14 @@ #define WILC_GP_REG_0 0x149c #define WILC_GP_REG_1 0x14a0 -#define rHAVE_SDIO_IRQ_GPIO_BIT 0 -#define rHAVE_USE_PMU_BIT 1 -#define rHAVE_SLEEP_CLK_SRC_RTC_BIT 2 -#define rHAVE_SLEEP_CLK_SRC_XO_BIT 3 -#define rHAVE_EXT_PA_INV_TX_RX_BIT 4 -#define rHAVE_LEGACY_RF_SETTINGS_BIT 5 -#define rHAVE_XTAL_24_BIT 6 -#define rHAVE_DISABLE_WILC_UART_BIT 7 - - -#define WILC_HAVE_SDIO_IRQ_GPIO (1 << rHAVE_SDIO_IRQ_GPIO_BIT) -#define WILC_HAVE_USE_PMU (1 << rHAVE_USE_PMU_BIT) -#define WILC_HAVE_SLEEP_CLK_SRC_RTC (1 << rHAVE_SLEEP_CLK_SRC_RTC_BIT) -#define WILC_HAVE_SLEEP_CLK_SRC_XO (1 << rHAVE_SLEEP_CLK_SRC_XO_BIT) -#define WILC_HAVE_EXT_PA_INV_TX_RX (1 << rHAVE_EXT_PA_INV_TX_RX_BIT) -#define WILC_HAVE_LEGACY_RF_SETTINGS (1 << rHAVE_LEGACY_RF_SETTINGS_BIT) -#define WILC_HAVE_XTAL_24 (1 << rHAVE_XTAL_24_BIT) -#define WILC_HAVE_DISABLE_WILC_UART (1 << rHAVE_DISABLE_WILC_UART_BIT) - +#define WILC_HAVE_SDIO_IRQ_GPIO BIT(0) +#define WILC_HAVE_USE_PMU BIT(1) +#define WILC_HAVE_SLEEP_CLK_SRC_RTC BIT(2) +#define WILC_HAVE_SLEEP_CLK_SRC_XO BIT(3) +#define WILC_HAVE_EXT_PA_INV_TX_RX BIT(4) +#define WILC_HAVE_LEGACY_RF_SETTINGS BIT(5) +#define WILC_HAVE_XTAL_24 BIT(6) +#define WILC_HAVE_DISABLE_WILC_UART BIT(7) /******************************************** * @@ -171,12 +160,12 @@ /*******************************************/ #define IRG_FLAGS_OFFSET 16 #define IRQ_DMA_WD_CNT_MASK ((1ul << IRG_FLAGS_OFFSET) - 1) -#define INT_0 (1 << IRG_FLAGS_OFFSET) -#define INT_1 (1 << (IRG_FLAGS_OFFSET + 1)) -#define INT_2 (1 << (IRG_FLAGS_OFFSET + 2)) -#define INT_3 (1 << (IRG_FLAGS_OFFSET + 3)) -#define INT_4 (1 << (IRG_FLAGS_OFFSET + 4)) -#define INT_5 (1 << (IRG_FLAGS_OFFSET + 5)) +#define INT_0 BIT(IRG_FLAGS_OFFSET) +#define INT_1 BIT(IRG_FLAGS_OFFSET + 1) +#define INT_2 BIT(IRG_FLAGS_OFFSET + 2) +#define INT_3 BIT(IRG_FLAGS_OFFSET + 3) +#define INT_4 BIT(IRG_FLAGS_OFFSET + 4) +#define INT_5 BIT(IRG_FLAGS_OFFSET + 5) #define MAX_NUM_INT 6 /*******************************************/ From c222096361171782c5fb689b185d367d89396da9 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:19:58 +0900 Subject: [PATCH 287/843] staging: wilc1000: fixes please don't use multiple blank lines This patch fixes the checks reported by checkpatch.pl for Please don't use multiple blank lines. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 6ca254435846..74f6210c1291 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -1,11 +1,7 @@ #ifndef WILC_WLAN_H #define WILC_WLAN_H - - #define ISWILC1000(id) ((id & 0xfffff000) == 0x100000 ? 1 : 0) - - /******************************************** * * Mac eth header length @@ -140,8 +136,6 @@ #else #define WILC_PLL_TO 2 #endif - - #define ABORT_INT BIT(31) /*******************************************/ @@ -203,8 +197,6 @@ #define ENABLE_RX_VMM (SEL_VMM_TBL1 | EN_VMM) #define ENABLE_TX_VMM (SEL_VMM_TBL0 | EN_VMM) - - /*time for expiring the semaphores of cfg packets*/ #define CFG_PKTS_TIMEOUT 2000 /******************************************** From 14cdc0a14bf681ffb1ef2b7ba6edb66933300600 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:19:59 +0900 Subject: [PATCH 288/843] staging: wilc1000: remove typedef from wilc_cfg_frame_t This patch removes typedef from the struct wilc_cfg_frame_t and renames it to wilc_cfg_frame. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 4 ++-- drivers/staging/wilc1000/wilc_wlan.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 283c506b4f21..c61048b5c54e 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -11,7 +11,7 @@ typedef struct { wilc_wlan_io_func_t io_func; wilc_hif_func_t hif_func; int cfg_frame_in_use; - wilc_cfg_frame_t cfg_frame; + struct wilc_cfg_frame cfg_frame; u32 cfg_frame_offset; int cfg_seq_no; @@ -1462,7 +1462,7 @@ void wilc_wlan_cleanup(struct net_device *dev) static int wilc_wlan_cfg_commit(int type, u32 drv_handler) { wilc_wlan_dev_t *p = &g_wlan; - wilc_cfg_frame_t *cfg = &p->cfg_frame; + struct wilc_cfg_frame *cfg = &p->cfg_frame; int total_len = p->cfg_frame_offset + 4 + DRIVER_HANDLER_SIZE; int seq_no = p->cfg_seq_no % 256; int driver_handler = (u32)drv_handler; diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 74f6210c1291..d15c848d8a7b 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -263,13 +263,13 @@ typedef struct { #define MAX_CFG_FRAME_SIZE 1468 -typedef struct { +struct wilc_cfg_frame { u8 ether_header[14]; u8 ip_header[20]; u8 udp_header[8]; u8 wid_header[8]; u8 frame[MAX_CFG_FRAME_SIZE]; -} wilc_cfg_frame_t; +}; typedef struct { int (*wlan_tx)(u8 *, u32, wilc_tx_complete_func_t); From 0e354a8e650de974e03eeaa9a1cb1bc379e89968 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:20:00 +0900 Subject: [PATCH 289/843] staging: wilc1000: remove unused typedef wilc_wlan_cfg_func_t This patch removes unused typedef wilc_wlan_cfg_func_t of wilc_wlan.h. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index d15c848d8a7b..6c784fd591e6 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -271,10 +271,6 @@ struct wilc_cfg_frame { u8 frame[MAX_CFG_FRAME_SIZE]; }; -typedef struct { - int (*wlan_tx)(u8 *, u32, wilc_tx_complete_func_t); -} wilc_wlan_cfg_func_t; - typedef struct { int type; u32 seq_no; From bcddd48b7f1485abaf3a127c5de4d4da4a677ed5 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:20:01 +0900 Subject: [PATCH 290/843] staging: wilc1000: remove typedef from wilc_cfg_rsp_t This patch removes typedef from the struct wilc_cfg_rsp_t and renames it to wilc_cfg_rsp. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 2 +- drivers/staging/wilc1000/wilc_wlan.h | 4 ++-- drivers/staging/wilc1000/wilc_wlan_cfg.c | 2 +- drivers/staging/wilc1000/wilc_wlan_cfg.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index c61048b5c54e..7b8e70b391cd 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1023,7 +1023,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) has_packet = 1; } } else { - wilc_cfg_rsp_t rsp; + struct wilc_cfg_rsp rsp; wilc_wlan_cfg_indicate_rx(&buffer[pkt_offset + offset], pkt_len, &rsp); if (rsp.type == WILC_CFG_RSP) { diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 6c784fd591e6..368b7ff3c495 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -271,10 +271,10 @@ struct wilc_cfg_frame { u8 frame[MAX_CFG_FRAME_SIZE]; }; -typedef struct { +struct wilc_cfg_rsp { int type; u32 seq_no; -} wilc_cfg_rsp_t; +}; int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size); int wilc_wlan_start(void); diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c index a34a81cdeb5e..e23796392e9c 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.c +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c @@ -505,7 +505,7 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size) return ret; } -int wilc_wlan_cfg_indicate_rx(u8 *frame, int size, wilc_cfg_rsp_t *rsp) +int wilc_wlan_cfg_indicate_rx(u8 *frame, int size, struct wilc_cfg_rsp *rsp) { int ret = 1; u8 msg_type; diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.h b/drivers/staging/wilc1000/wilc_wlan_cfg.h index 30e60ec4d29f..443b2d5b6db8 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.h +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.h @@ -33,7 +33,7 @@ typedef struct { int wilc_wlan_cfg_set_wid(u8 *frame, u32 offset, u16 id, u8 *buf, int size); int wilc_wlan_cfg_get_wid(u8 *frame, u32 offset, u16 id); int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size); -int wilc_wlan_cfg_indicate_rx(u8 *frame, int size, wilc_cfg_rsp_t *rsp); +int wilc_wlan_cfg_indicate_rx(u8 *frame, int size, struct wilc_cfg_rsp *rsp); int wilc_wlan_cfg_init(wilc_debug_func func); #endif From 48d0aa97996c3653a2e3dd6db742fa89f3f3139a Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:20:02 +0900 Subject: [PATCH 291/843] staging: wilc1000: remove typedef from wilc_hif_func_t This patch removes typedef from the struct wilc_hif_func_t and renames it to wilc_hif_func. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_sdio.c | 2 +- drivers/staging/wilc1000/wilc_spi.c | 2 +- drivers/staging/wilc1000/wilc_wlan.c | 10 +++++----- drivers/staging/wilc1000/wilc_wlan.h | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index 300c571e4e2d..cfa76b26bb53 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -992,7 +992,7 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */) * ********************************************/ -wilc_hif_func_t hif_sdio = { +struct wilc_hif_func hif_sdio = { sdio_init, sdio_deinit, sdio_read_reg, diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index 599508beabf8..b09b3bde68c2 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -1256,7 +1256,7 @@ static int spi_sync_ext(int nint /* how mant interrupts to enable. */) * Global spi HIF function table * ********************************************/ -wilc_hif_func_t hif_spi = { +struct wilc_hif_func hif_spi = { spi_init, spi_deinit, spi_read_reg, diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 7b8e70b391cd..b6d784bcf98e 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -2,14 +2,14 @@ #include "wilc_wfi_netdevice.h" #include "wilc_wlan_cfg.h" -extern wilc_hif_func_t hif_sdio; -extern wilc_hif_func_t hif_spi; +extern struct wilc_hif_func hif_sdio; +extern struct wilc_hif_func hif_spi; u32 wilc_get_chipid(u8 update); typedef struct { int quit; wilc_wlan_io_func_t io_func; - wilc_hif_func_t hif_func; + struct wilc_hif_func hif_func; int cfg_frame_in_use; struct wilc_cfg_frame cfg_frame; u32 cfg_frame_offset; @@ -1665,7 +1665,7 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) goto _fail_; } memcpy((void *)&g_wlan.hif_func, &hif_sdio, - sizeof(wilc_hif_func_t)); + sizeof(struct wilc_hif_func)); } else { if ((inp->io_func.io_type & 0x1) == HIF_SPI) { if (!hif_spi.hif_init(inp, wilc_debug)) { @@ -1673,7 +1673,7 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) goto _fail_; } memcpy((void *)&g_wlan.hif_func, &hif_spi, - sizeof(wilc_hif_func_t)); + sizeof(struct wilc_hif_func)); } else { ret = -EIO; goto _fail_; diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 368b7ff3c495..ff4872f1e675 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -236,7 +236,7 @@ struct rxq_entry_t { * ********************************************/ -typedef struct { +struct wilc_hif_func { int (*hif_init)(wilc_wlan_inp_t *, wilc_debug_func); int (*hif_deinit)(void *); int (*hif_read_reg)(u32, u32 *); @@ -253,7 +253,7 @@ typedef struct { int (*hif_sync_ext)(int); void (*hif_set_max_bus_speed)(void); void (*hif_set_default_bus_speed)(void); -} wilc_hif_func_t; +}; /******************************************** * From 3eec50cf1a64f7239ee296d8be7e97eca754fc72 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:20:03 +0900 Subject: [PATCH 292/843] staging: wilc1000: rename Handle_SetChannel function This patch renames Handle_SetChannel function to handle_set_channel to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 7014915e30d1..16396e5604c6 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -323,7 +323,7 @@ static struct host_if_drv *get_handler_from_id(int id) return wfidrv_list[id]; } -static s32 Handle_SetChannel(struct host_if_drv *hif_drv, +static s32 handle_set_channel(struct host_if_drv *hif_drv, struct channel_attr *hif_set_ch) { s32 result = 0; @@ -2893,7 +2893,7 @@ static int hostIFthread(void *pvArg) break; case HOST_IF_MSG_SET_CHANNEL: - Handle_SetChannel(msg.drv, &msg.body.channel_info); + handle_set_channel(msg.drv, &msg.body.channel_info); break; case HOST_IF_MSG_DISCONNECT: From 23f2badd265a0065bde78aa9510f77be5cbea313 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:20:04 +0900 Subject: [PATCH 293/843] staging: wilc1000: rename Handle_SetWfiDrvHandler function This patch renames Handle_SetWfiDrvHandler function to handle_set_wfi_drv_handler to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 16396e5604c6..dcaf0eb782ac 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -347,8 +347,8 @@ static s32 handle_set_channel(struct host_if_drv *hif_drv, return result; } -static s32 Handle_SetWfiDrvHandler(struct host_if_drv *hif_drv, - struct drv_handler *hif_drv_handler) +static s32 handle_set_wfi_drv_handler(struct host_if_drv *hif_drv, + struct drv_handler *hif_drv_handler) { s32 result = 0; struct wid wid; @@ -2970,8 +2970,7 @@ static int hostIFthread(void *pvArg) break; case HOST_IF_MSG_SET_WFIDRV_HANDLER: - Handle_SetWfiDrvHandler(msg.drv, - &msg.body.drv); + handle_set_wfi_drv_handler(msg.drv, &msg.body.drv); break; case HOST_IF_MSG_SET_OPERATION_MODE: From 97b5c59134328f197d86087b08671384c6ecd6ca Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:20:05 +0900 Subject: [PATCH 294/843] staging: wilc1000: rename Handle_SetOperationMode function This patch renames Handle_SetOperationMode function to handle_set_operation_mode to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index dcaf0eb782ac..504763e07456 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -371,8 +371,8 @@ static s32 handle_set_wfi_drv_handler(struct host_if_drv *hif_drv, return result; } -static s32 Handle_SetOperationMode(struct host_if_drv *hif_drv, - struct op_mode *hif_op_mode) +static s32 handle_set_operation_mode(struct host_if_drv *hif_drv, + struct op_mode *hif_op_mode) { s32 result = 0; struct wid wid; @@ -2974,7 +2974,7 @@ static int hostIFthread(void *pvArg) break; case HOST_IF_MSG_SET_OPERATION_MODE: - Handle_SetOperationMode(msg.drv, &msg.body.mode); + handle_set_operation_mode(msg.drv, &msg.body.mode); break; case HOST_IF_MSG_SET_IPADDRESS: From a6e6d48b888b9bba10e05d7bd457c518718b1e99 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:20:06 +0900 Subject: [PATCH 295/843] staging: wilc1000: rename Handle_set_IPAddress function This patch renames Handle_set_IPAddress function to handle_set_ip_address to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 504763e07456..461272337dc9 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -396,7 +396,7 @@ static s32 handle_set_operation_mode(struct host_if_drv *hif_drv, return result; } -s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *ip_addr, u8 idx) +s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 *ip_addr, u8 idx) { s32 result = 0; struct wid wid; @@ -2979,7 +2979,9 @@ static int hostIFthread(void *pvArg) case HOST_IF_MSG_SET_IPADDRESS: PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); - Handle_set_IPAddress(msg.drv, msg.body.ip_info.ip_addr, msg.body.ip_info.idx); + handle_set_ip_address(msg.drv, + msg.body.ip_info.ip_addr, + msg.body.ip_info.idx); break; case HOST_IF_MSG_GET_IPADDRESS: From d4516952e0ac5121db2c3d0a0633356031d186d9 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:20:07 +0900 Subject: [PATCH 296/843] staging: wilc1000: rename Handle_get_IPAddress function This patch renames Handle_get_IPAddress function to handle_get_ip_address to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 drivers/staging/wilc1000/host_interface.c diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c old mode 100644 new mode 100755 index 461272337dc9..9c4c0b2b899b --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -430,7 +430,7 @@ s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 *ip_addr, u8 idx) return result; } -s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 idx) +s32 handle_get_ip_address(struct host_if_drv *hif_drv, u8 idx) { s32 result = 0; struct wid wid; @@ -2986,7 +2986,7 @@ static int hostIFthread(void *pvArg) case HOST_IF_MSG_GET_IPADDRESS: PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); - Handle_get_IPAddress(msg.drv, msg.body.ip_info.idx); + handle_get_ip_address(msg.drv, msg.body.ip_info.idx); break; case HOST_IF_MSG_SET_MAC_ADDRESS: From a82674216547605540b77f9545ae83c6ff00146c Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:20:08 +0900 Subject: [PATCH 297/843] staging: wilc1000: rename Handle_SetMacAddress function This patch renames Handle_SetMacAddress function to handle_set_mac_address to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) mode change 100755 => 100644 drivers/staging/wilc1000/host_interface.c diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c old mode 100755 new mode 100644 index 9c4c0b2b899b..2388e2d1be8f --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -464,8 +464,8 @@ s32 handle_get_ip_address(struct host_if_drv *hif_drv, u8 idx) return result; } -static s32 Handle_SetMacAddress(struct host_if_drv *hif_drv, - struct set_mac_addr *set_mac_addr) +static s32 handle_set_mac_address(struct host_if_drv *hif_drv, + struct set_mac_addr *set_mac_addr) { s32 result = 0; struct wid wid; @@ -2990,7 +2990,8 @@ static int hostIFthread(void *pvArg) break; case HOST_IF_MSG_SET_MAC_ADDRESS: - Handle_SetMacAddress(msg.drv, &msg.body.set_mac_info); + handle_set_mac_address(msg.drv, + &msg.body.set_mac_info); break; case HOST_IF_MSG_GET_MAC_ADDRESS: From b3bf8fd98494642871954e8c89a35c8959686236 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:20:09 +0900 Subject: [PATCH 298/843] staging: wilc1000: rename Handle_GetMacAddress function This patch renames Handle_GetMacAddress function to handle_get_mac_address to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) mode change 100644 => 100755 drivers/staging/wilc1000/host_interface.c diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c old mode 100644 new mode 100755 index 2388e2d1be8f..cbc53bc9e98c --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -494,8 +494,8 @@ static s32 handle_set_mac_address(struct host_if_drv *hif_drv, return result; } -static s32 Handle_GetMacAddress(struct host_if_drv *hif_drv, - struct get_mac_addr *get_mac_addr) +static s32 handle_get_mac_address(struct host_if_drv *hif_drv, + struct get_mac_addr *get_mac_addr) { s32 result = 0; struct wid wid; @@ -2995,7 +2995,8 @@ static int hostIFthread(void *pvArg) break; case HOST_IF_MSG_GET_MAC_ADDRESS: - Handle_GetMacAddress(msg.drv, &msg.body.get_mac_info); + handle_get_mac_address(msg.drv, + &msg.body.get_mac_info); break; case HOST_IF_MSG_REMAIN_ON_CHAN: From dc27666477e539881f49dc07bece967c0dff772d Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:20:10 +0900 Subject: [PATCH 299/843] staging: wilc1000: rename Handle_CfgParam function This patch renames Handle_CfgParam function to handle_cfg_param to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) mode change 100755 => 100644 drivers/staging/wilc1000/host_interface.c diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c old mode 100755 new mode 100644 index cbc53bc9e98c..4c91ae26fa74 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -517,8 +517,8 @@ static s32 handle_get_mac_address(struct host_if_drv *hif_drv, return result; } -static s32 Handle_CfgParam(struct host_if_drv *hif_drv, - struct cfg_param_attr *cfg_param_attr) +static s32 handle_cfg_param(struct host_if_drv *hif_drv, + struct cfg_param_attr *cfg_param_attr) { s32 result = 0; struct wid strWIDList[32]; @@ -2888,8 +2888,7 @@ static int hostIFthread(void *pvArg) break; case HOST_IF_MSG_CFG_PARAMS: - - Handle_CfgParam(msg.drv, &msg.body.cfg_info); + handle_cfg_param(msg.drv, &msg.body.cfg_info); break; case HOST_IF_MSG_SET_CHANNEL: From 13ca52ad77dfba19a52a681391c276c9213668b9 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:20:11 +0900 Subject: [PATCH 300/843] staging: wilc1000: rename strWIDList of handle_cfg_param function This patch renames strWIDList variable of handle_cfg_param function to wid_list to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 149 +++++++++++----------- 1 file changed, 74 insertions(+), 75 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 4c91ae26fa74..588a027e44d8 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -521,7 +521,7 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, struct cfg_param_attr *cfg_param_attr) { s32 result = 0; - struct wid strWIDList[32]; + struct wid wid_list[32]; u8 u8WidCnt = 0; down(&hif_drv->sem_cfg_values); @@ -530,10 +530,10 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, if (cfg_param_attr->cfg_attr_info.flag & BSS_TYPE) { if (cfg_param_attr->cfg_attr_info.bss_type < 6) { - strWIDList[u8WidCnt].id = WID_BSS_TYPE; - strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.bss_type; - strWIDList[u8WidCnt].type = WID_CHAR; - strWIDList[u8WidCnt].size = sizeof(char); + wid_list[u8WidCnt].id = WID_BSS_TYPE; + wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.bss_type; + wid_list[u8WidCnt].type = WID_CHAR; + wid_list[u8WidCnt].size = sizeof(char); hif_drv->cfg_values.bss_type = (u8)cfg_param_attr->cfg_attr_info.bss_type; } else { PRINT_ER("check value 6 over\n"); @@ -546,10 +546,10 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, if (cfg_param_attr->cfg_attr_info.auth_type == 1 || cfg_param_attr->cfg_attr_info.auth_type == 2 || cfg_param_attr->cfg_attr_info.auth_type == 5) { - strWIDList[u8WidCnt].id = WID_AUTH_TYPE; - strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.auth_type; - strWIDList[u8WidCnt].type = WID_CHAR; - strWIDList[u8WidCnt].size = sizeof(char); + wid_list[u8WidCnt].id = WID_AUTH_TYPE; + wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.auth_type; + wid_list[u8WidCnt].type = WID_CHAR; + wid_list[u8WidCnt].size = sizeof(char); hif_drv->cfg_values.auth_type = (u8)cfg_param_attr->cfg_attr_info.auth_type; } else { PRINT_ER("Impossible value \n"); @@ -561,10 +561,10 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, if (cfg_param_attr->cfg_attr_info.flag & AUTHEN_TIMEOUT) { if (cfg_param_attr->cfg_attr_info.auth_timeout > 0 && cfg_param_attr->cfg_attr_info.auth_timeout < 65536) { - strWIDList[u8WidCnt].id = WID_AUTH_TIMEOUT; - strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.auth_timeout; - strWIDList[u8WidCnt].type = WID_SHORT; - strWIDList[u8WidCnt].size = sizeof(u16); + wid_list[u8WidCnt].id = WID_AUTH_TIMEOUT; + wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.auth_timeout; + wid_list[u8WidCnt].type = WID_SHORT; + wid_list[u8WidCnt].size = sizeof(u16); hif_drv->cfg_values.auth_timeout = cfg_param_attr->cfg_attr_info.auth_timeout; } else { PRINT_ER("Range(1 ~ 65535) over\n"); @@ -575,10 +575,10 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, } if (cfg_param_attr->cfg_attr_info.flag & POWER_MANAGEMENT) { if (cfg_param_attr->cfg_attr_info.power_mgmt_mode < 5) { - strWIDList[u8WidCnt].id = WID_POWER_MANAGEMENT; - strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.power_mgmt_mode; - strWIDList[u8WidCnt].type = WID_CHAR; - strWIDList[u8WidCnt].size = sizeof(char); + wid_list[u8WidCnt].id = WID_POWER_MANAGEMENT; + wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.power_mgmt_mode; + wid_list[u8WidCnt].type = WID_CHAR; + wid_list[u8WidCnt].size = sizeof(char); hif_drv->cfg_values.power_mgmt_mode = (u8)cfg_param_attr->cfg_attr_info.power_mgmt_mode; } else { PRINT_ER("Invalide power mode\n"); @@ -590,10 +590,10 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, if (cfg_param_attr->cfg_attr_info.flag & RETRY_SHORT) { if (cfg_param_attr->cfg_attr_info.short_retry_limit > 0 && cfg_param_attr->cfg_attr_info.short_retry_limit < 256) { - strWIDList[u8WidCnt].id = WID_SHORT_RETRY_LIMIT; - strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.short_retry_limit; - strWIDList[u8WidCnt].type = WID_SHORT; - strWIDList[u8WidCnt].size = sizeof(u16); + wid_list[u8WidCnt].id = WID_SHORT_RETRY_LIMIT; + wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.short_retry_limit; + wid_list[u8WidCnt].type = WID_SHORT; + wid_list[u8WidCnt].size = sizeof(u16); hif_drv->cfg_values.short_retry_limit = cfg_param_attr->cfg_attr_info.short_retry_limit; } else { PRINT_ER("Range(1~256) over\n"); @@ -605,11 +605,10 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, if (cfg_param_attr->cfg_attr_info.flag & RETRY_LONG) { if (cfg_param_attr->cfg_attr_info.long_retry_limit > 0 && cfg_param_attr->cfg_attr_info.long_retry_limit < 256) { - strWIDList[u8WidCnt].id = WID_LONG_RETRY_LIMIT; - strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.long_retry_limit; - - strWIDList[u8WidCnt].type = WID_SHORT; - strWIDList[u8WidCnt].size = sizeof(u16); + wid_list[u8WidCnt].id = WID_LONG_RETRY_LIMIT; + wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.long_retry_limit; + wid_list[u8WidCnt].type = WID_SHORT; + wid_list[u8WidCnt].size = sizeof(u16); hif_drv->cfg_values.long_retry_limit = cfg_param_attr->cfg_attr_info.long_retry_limit; } else { PRINT_ER("Range(1~256) over\n"); @@ -621,10 +620,10 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, if (cfg_param_attr->cfg_attr_info.flag & FRAG_THRESHOLD) { if (cfg_param_attr->cfg_attr_info.frag_threshold > 255 && cfg_param_attr->cfg_attr_info.frag_threshold < 7937) { - strWIDList[u8WidCnt].id = WID_FRAG_THRESHOLD; - strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.frag_threshold; - strWIDList[u8WidCnt].type = WID_SHORT; - strWIDList[u8WidCnt].size = sizeof(u16); + wid_list[u8WidCnt].id = WID_FRAG_THRESHOLD; + wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.frag_threshold; + wid_list[u8WidCnt].type = WID_SHORT; + wid_list[u8WidCnt].size = sizeof(u16); hif_drv->cfg_values.frag_threshold = cfg_param_attr->cfg_attr_info.frag_threshold; } else { PRINT_ER("Threshold Range fail\n"); @@ -636,10 +635,10 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, if (cfg_param_attr->cfg_attr_info.flag & RTS_THRESHOLD) { if (cfg_param_attr->cfg_attr_info.rts_threshold > 255 && cfg_param_attr->cfg_attr_info.rts_threshold < 65536) { - strWIDList[u8WidCnt].id = WID_RTS_THRESHOLD; - strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.rts_threshold; - strWIDList[u8WidCnt].type = WID_SHORT; - strWIDList[u8WidCnt].size = sizeof(u16); + wid_list[u8WidCnt].id = WID_RTS_THRESHOLD; + wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.rts_threshold; + wid_list[u8WidCnt].type = WID_SHORT; + wid_list[u8WidCnt].size = sizeof(u16); hif_drv->cfg_values.rts_threshold = cfg_param_attr->cfg_attr_info.rts_threshold; } else { PRINT_ER("Threshold Range fail\n"); @@ -650,10 +649,10 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, } if (cfg_param_attr->cfg_attr_info.flag & PREAMBLE) { if (cfg_param_attr->cfg_attr_info.preamble_type < 3) { - strWIDList[u8WidCnt].id = WID_PREAMBLE; - strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.preamble_type; - strWIDList[u8WidCnt].type = WID_CHAR; - strWIDList[u8WidCnt].size = sizeof(char); + wid_list[u8WidCnt].id = WID_PREAMBLE; + wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.preamble_type; + wid_list[u8WidCnt].type = WID_CHAR; + wid_list[u8WidCnt].size = sizeof(char); hif_drv->cfg_values.preamble_type = cfg_param_attr->cfg_attr_info.preamble_type; } else { PRINT_ER("Preamle Range(0~2) over\n"); @@ -664,10 +663,10 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, } if (cfg_param_attr->cfg_attr_info.flag & SHORT_SLOT_ALLOWED) { if (cfg_param_attr->cfg_attr_info.short_slot_allowed < 2) { - strWIDList[u8WidCnt].id = WID_SHORT_SLOT_ALLOWED; - strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.short_slot_allowed; - strWIDList[u8WidCnt].type = WID_CHAR; - strWIDList[u8WidCnt].size = sizeof(char); + wid_list[u8WidCnt].id = WID_SHORT_SLOT_ALLOWED; + wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.short_slot_allowed; + wid_list[u8WidCnt].type = WID_CHAR; + wid_list[u8WidCnt].size = sizeof(char); hif_drv->cfg_values.short_slot_allowed = (u8)cfg_param_attr->cfg_attr_info.short_slot_allowed; } else { PRINT_ER("Short slot(2) over\n"); @@ -678,10 +677,10 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, } if (cfg_param_attr->cfg_attr_info.flag & TXOP_PROT_DISABLE) { if (cfg_param_attr->cfg_attr_info.txop_prot_disabled < 2) { - strWIDList[u8WidCnt].id = WID_11N_TXOP_PROT_DISABLE; - strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.txop_prot_disabled; - strWIDList[u8WidCnt].type = WID_CHAR; - strWIDList[u8WidCnt].size = sizeof(char); + wid_list[u8WidCnt].id = WID_11N_TXOP_PROT_DISABLE; + wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.txop_prot_disabled; + wid_list[u8WidCnt].type = WID_CHAR; + wid_list[u8WidCnt].size = sizeof(char); hif_drv->cfg_values.txop_prot_disabled = (u8)cfg_param_attr->cfg_attr_info.txop_prot_disabled; } else { PRINT_ER("TXOP prot disable\n"); @@ -693,10 +692,10 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, if (cfg_param_attr->cfg_attr_info.flag & BEACON_INTERVAL) { if (cfg_param_attr->cfg_attr_info.beacon_interval > 0 && cfg_param_attr->cfg_attr_info.beacon_interval < 65536) { - strWIDList[u8WidCnt].id = WID_BEACON_INTERVAL; - strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.beacon_interval; - strWIDList[u8WidCnt].type = WID_SHORT; - strWIDList[u8WidCnt].size = sizeof(u16); + wid_list[u8WidCnt].id = WID_BEACON_INTERVAL; + wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.beacon_interval; + wid_list[u8WidCnt].type = WID_SHORT; + wid_list[u8WidCnt].size = sizeof(u16); hif_drv->cfg_values.beacon_interval = cfg_param_attr->cfg_attr_info.beacon_interval; } else { PRINT_ER("Beacon interval(1~65535) fail\n"); @@ -708,10 +707,10 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, if (cfg_param_attr->cfg_attr_info.flag & DTIM_PERIOD) { if (cfg_param_attr->cfg_attr_info.dtim_period > 0 && cfg_param_attr->cfg_attr_info.dtim_period < 256) { - strWIDList[u8WidCnt].id = WID_DTIM_PERIOD; - strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.dtim_period; - strWIDList[u8WidCnt].type = WID_CHAR; - strWIDList[u8WidCnt].size = sizeof(char); + wid_list[u8WidCnt].id = WID_DTIM_PERIOD; + wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.dtim_period; + wid_list[u8WidCnt].type = WID_CHAR; + wid_list[u8WidCnt].size = sizeof(char); hif_drv->cfg_values.dtim_period = cfg_param_attr->cfg_attr_info.dtim_period; } else { PRINT_ER("DTIM range(1~255) fail\n"); @@ -722,10 +721,10 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, } if (cfg_param_attr->cfg_attr_info.flag & SITE_SURVEY) { if (cfg_param_attr->cfg_attr_info.site_survey_enabled < 3) { - strWIDList[u8WidCnt].id = WID_SITE_SURVEY; - strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.site_survey_enabled; - strWIDList[u8WidCnt].type = WID_CHAR; - strWIDList[u8WidCnt].size = sizeof(char); + wid_list[u8WidCnt].id = WID_SITE_SURVEY; + wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.site_survey_enabled; + wid_list[u8WidCnt].type = WID_CHAR; + wid_list[u8WidCnt].size = sizeof(char); hif_drv->cfg_values.site_survey_enabled = (u8)cfg_param_attr->cfg_attr_info.site_survey_enabled; } else { PRINT_ER("Site survey disable\n"); @@ -737,10 +736,10 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, if (cfg_param_attr->cfg_attr_info.flag & SITE_SURVEY_SCAN_TIME) { if (cfg_param_attr->cfg_attr_info.site_survey_scan_time > 0 && cfg_param_attr->cfg_attr_info.site_survey_scan_time < 65536) { - strWIDList[u8WidCnt].id = WID_SITE_SURVEY_SCAN_TIME; - strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.site_survey_scan_time; - strWIDList[u8WidCnt].type = WID_SHORT; - strWIDList[u8WidCnt].size = sizeof(u16); + wid_list[u8WidCnt].id = WID_SITE_SURVEY_SCAN_TIME; + wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.site_survey_scan_time; + wid_list[u8WidCnt].type = WID_SHORT; + wid_list[u8WidCnt].size = sizeof(u16); hif_drv->cfg_values.site_survey_scan_time = cfg_param_attr->cfg_attr_info.site_survey_scan_time; } else { PRINT_ER("Site survey scan time(1~65535) over\n"); @@ -752,10 +751,10 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, if (cfg_param_attr->cfg_attr_info.flag & ACTIVE_SCANTIME) { if (cfg_param_attr->cfg_attr_info.active_scan_time > 0 && cfg_param_attr->cfg_attr_info.active_scan_time < 65536) { - strWIDList[u8WidCnt].id = WID_ACTIVE_SCAN_TIME; - strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.active_scan_time; - strWIDList[u8WidCnt].type = WID_SHORT; - strWIDList[u8WidCnt].size = sizeof(u16); + wid_list[u8WidCnt].id = WID_ACTIVE_SCAN_TIME; + wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.active_scan_time; + wid_list[u8WidCnt].type = WID_SHORT; + wid_list[u8WidCnt].size = sizeof(u16); hif_drv->cfg_values.active_scan_time = cfg_param_attr->cfg_attr_info.active_scan_time; } else { PRINT_ER("Active scan time(1~65535) over\n"); @@ -767,10 +766,10 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, if (cfg_param_attr->cfg_attr_info.flag & PASSIVE_SCANTIME) { if (cfg_param_attr->cfg_attr_info.passive_scan_time > 0 && cfg_param_attr->cfg_attr_info.passive_scan_time < 65536) { - strWIDList[u8WidCnt].id = WID_PASSIVE_SCAN_TIME; - strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.passive_scan_time; - strWIDList[u8WidCnt].type = WID_SHORT; - strWIDList[u8WidCnt].size = sizeof(u16); + wid_list[u8WidCnt].id = WID_PASSIVE_SCAN_TIME; + wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.passive_scan_time; + wid_list[u8WidCnt].type = WID_SHORT; + wid_list[u8WidCnt].size = sizeof(u16); hif_drv->cfg_values.passive_scan_time = cfg_param_attr->cfg_attr_info.passive_scan_time; } else { PRINT_ER("Passive scan time(1~65535) over\n"); @@ -788,10 +787,10 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, || curr_tx_rate == MBPS_9 || curr_tx_rate == MBPS_12 || curr_tx_rate == MBPS_18 || curr_tx_rate == MBPS_24 || curr_tx_rate == MBPS_36 || curr_tx_rate == MBPS_48 || curr_tx_rate == MBPS_54) { - strWIDList[u8WidCnt].id = WID_CURRENT_TX_RATE; - strWIDList[u8WidCnt].val = (s8 *)&curr_tx_rate; - strWIDList[u8WidCnt].type = WID_SHORT; - strWIDList[u8WidCnt].size = sizeof(u16); + wid_list[u8WidCnt].id = WID_CURRENT_TX_RATE; + wid_list[u8WidCnt].val = (s8 *)&curr_tx_rate; + wid_list[u8WidCnt].type = WID_SHORT; + wid_list[u8WidCnt].size = sizeof(u16); hif_drv->cfg_values.curr_tx_rate = (u8)curr_tx_rate; } else { PRINT_ER("out of TX rate\n"); @@ -801,7 +800,7 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, u8WidCnt++; } - result = send_config_pkt(SET_CFG, strWIDList, u8WidCnt, + result = send_config_pkt(SET_CFG, wid_list, u8WidCnt, get_id_from_handler(hif_drv)); if (result) From 540c3e88ba5d06f64246e22f5b791d5ff5b97086 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Fri, 6 Nov 2015 11:20:12 +0900 Subject: [PATCH 301/843] staging: wilc1000: rename u8WidCnt of handle_cfg_param function This patch renames u8WidCnt variable of handle_cfg_param function to wid_cnt to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 184 +++++++++++----------- 1 file changed, 92 insertions(+), 92 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 588a027e44d8..1a334aec0eb7 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -522,7 +522,7 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, { s32 result = 0; struct wid wid_list[32]; - u8 u8WidCnt = 0; + u8 wid_cnt = 0; down(&hif_drv->sem_cfg_values); @@ -530,253 +530,253 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, if (cfg_param_attr->cfg_attr_info.flag & BSS_TYPE) { if (cfg_param_attr->cfg_attr_info.bss_type < 6) { - wid_list[u8WidCnt].id = WID_BSS_TYPE; - wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.bss_type; - wid_list[u8WidCnt].type = WID_CHAR; - wid_list[u8WidCnt].size = sizeof(char); + wid_list[wid_cnt].id = WID_BSS_TYPE; + wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.bss_type; + wid_list[wid_cnt].type = WID_CHAR; + wid_list[wid_cnt].size = sizeof(char); hif_drv->cfg_values.bss_type = (u8)cfg_param_attr->cfg_attr_info.bss_type; } else { PRINT_ER("check value 6 over\n"); result = -EINVAL; goto ERRORHANDLER; } - u8WidCnt++; + wid_cnt++; } if (cfg_param_attr->cfg_attr_info.flag & AUTH_TYPE) { if (cfg_param_attr->cfg_attr_info.auth_type == 1 || cfg_param_attr->cfg_attr_info.auth_type == 2 || cfg_param_attr->cfg_attr_info.auth_type == 5) { - wid_list[u8WidCnt].id = WID_AUTH_TYPE; - wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.auth_type; - wid_list[u8WidCnt].type = WID_CHAR; - wid_list[u8WidCnt].size = sizeof(char); + wid_list[wid_cnt].id = WID_AUTH_TYPE; + wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.auth_type; + wid_list[wid_cnt].type = WID_CHAR; + wid_list[wid_cnt].size = sizeof(char); hif_drv->cfg_values.auth_type = (u8)cfg_param_attr->cfg_attr_info.auth_type; } else { PRINT_ER("Impossible value \n"); result = -EINVAL; goto ERRORHANDLER; } - u8WidCnt++; + wid_cnt++; } if (cfg_param_attr->cfg_attr_info.flag & AUTHEN_TIMEOUT) { if (cfg_param_attr->cfg_attr_info.auth_timeout > 0 && cfg_param_attr->cfg_attr_info.auth_timeout < 65536) { - wid_list[u8WidCnt].id = WID_AUTH_TIMEOUT; - wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.auth_timeout; - wid_list[u8WidCnt].type = WID_SHORT; - wid_list[u8WidCnt].size = sizeof(u16); + wid_list[wid_cnt].id = WID_AUTH_TIMEOUT; + wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.auth_timeout; + wid_list[wid_cnt].type = WID_SHORT; + wid_list[wid_cnt].size = sizeof(u16); hif_drv->cfg_values.auth_timeout = cfg_param_attr->cfg_attr_info.auth_timeout; } else { PRINT_ER("Range(1 ~ 65535) over\n"); result = -EINVAL; goto ERRORHANDLER; } - u8WidCnt++; + wid_cnt++; } if (cfg_param_attr->cfg_attr_info.flag & POWER_MANAGEMENT) { if (cfg_param_attr->cfg_attr_info.power_mgmt_mode < 5) { - wid_list[u8WidCnt].id = WID_POWER_MANAGEMENT; - wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.power_mgmt_mode; - wid_list[u8WidCnt].type = WID_CHAR; - wid_list[u8WidCnt].size = sizeof(char); + wid_list[wid_cnt].id = WID_POWER_MANAGEMENT; + wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.power_mgmt_mode; + wid_list[wid_cnt].type = WID_CHAR; + wid_list[wid_cnt].size = sizeof(char); hif_drv->cfg_values.power_mgmt_mode = (u8)cfg_param_attr->cfg_attr_info.power_mgmt_mode; } else { PRINT_ER("Invalide power mode\n"); result = -EINVAL; goto ERRORHANDLER; } - u8WidCnt++; + wid_cnt++; } if (cfg_param_attr->cfg_attr_info.flag & RETRY_SHORT) { if (cfg_param_attr->cfg_attr_info.short_retry_limit > 0 && cfg_param_attr->cfg_attr_info.short_retry_limit < 256) { - wid_list[u8WidCnt].id = WID_SHORT_RETRY_LIMIT; - wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.short_retry_limit; - wid_list[u8WidCnt].type = WID_SHORT; - wid_list[u8WidCnt].size = sizeof(u16); + wid_list[wid_cnt].id = WID_SHORT_RETRY_LIMIT; + wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.short_retry_limit; + wid_list[wid_cnt].type = WID_SHORT; + wid_list[wid_cnt].size = sizeof(u16); hif_drv->cfg_values.short_retry_limit = cfg_param_attr->cfg_attr_info.short_retry_limit; } else { PRINT_ER("Range(1~256) over\n"); result = -EINVAL; goto ERRORHANDLER; } - u8WidCnt++; + wid_cnt++; } if (cfg_param_attr->cfg_attr_info.flag & RETRY_LONG) { if (cfg_param_attr->cfg_attr_info.long_retry_limit > 0 && cfg_param_attr->cfg_attr_info.long_retry_limit < 256) { - wid_list[u8WidCnt].id = WID_LONG_RETRY_LIMIT; - wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.long_retry_limit; - wid_list[u8WidCnt].type = WID_SHORT; - wid_list[u8WidCnt].size = sizeof(u16); + wid_list[wid_cnt].id = WID_LONG_RETRY_LIMIT; + wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.long_retry_limit; + wid_list[wid_cnt].type = WID_SHORT; + wid_list[wid_cnt].size = sizeof(u16); hif_drv->cfg_values.long_retry_limit = cfg_param_attr->cfg_attr_info.long_retry_limit; } else { PRINT_ER("Range(1~256) over\n"); result = -EINVAL; goto ERRORHANDLER; } - u8WidCnt++; + wid_cnt++; } if (cfg_param_attr->cfg_attr_info.flag & FRAG_THRESHOLD) { if (cfg_param_attr->cfg_attr_info.frag_threshold > 255 && cfg_param_attr->cfg_attr_info.frag_threshold < 7937) { - wid_list[u8WidCnt].id = WID_FRAG_THRESHOLD; - wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.frag_threshold; - wid_list[u8WidCnt].type = WID_SHORT; - wid_list[u8WidCnt].size = sizeof(u16); + wid_list[wid_cnt].id = WID_FRAG_THRESHOLD; + wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.frag_threshold; + wid_list[wid_cnt].type = WID_SHORT; + wid_list[wid_cnt].size = sizeof(u16); hif_drv->cfg_values.frag_threshold = cfg_param_attr->cfg_attr_info.frag_threshold; } else { PRINT_ER("Threshold Range fail\n"); result = -EINVAL; goto ERRORHANDLER; } - u8WidCnt++; + wid_cnt++; } if (cfg_param_attr->cfg_attr_info.flag & RTS_THRESHOLD) { if (cfg_param_attr->cfg_attr_info.rts_threshold > 255 && cfg_param_attr->cfg_attr_info.rts_threshold < 65536) { - wid_list[u8WidCnt].id = WID_RTS_THRESHOLD; - wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.rts_threshold; - wid_list[u8WidCnt].type = WID_SHORT; - wid_list[u8WidCnt].size = sizeof(u16); + wid_list[wid_cnt].id = WID_RTS_THRESHOLD; + wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.rts_threshold; + wid_list[wid_cnt].type = WID_SHORT; + wid_list[wid_cnt].size = sizeof(u16); hif_drv->cfg_values.rts_threshold = cfg_param_attr->cfg_attr_info.rts_threshold; } else { PRINT_ER("Threshold Range fail\n"); result = -EINVAL; goto ERRORHANDLER; } - u8WidCnt++; + wid_cnt++; } if (cfg_param_attr->cfg_attr_info.flag & PREAMBLE) { if (cfg_param_attr->cfg_attr_info.preamble_type < 3) { - wid_list[u8WidCnt].id = WID_PREAMBLE; - wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.preamble_type; - wid_list[u8WidCnt].type = WID_CHAR; - wid_list[u8WidCnt].size = sizeof(char); + wid_list[wid_cnt].id = WID_PREAMBLE; + wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.preamble_type; + wid_list[wid_cnt].type = WID_CHAR; + wid_list[wid_cnt].size = sizeof(char); hif_drv->cfg_values.preamble_type = cfg_param_attr->cfg_attr_info.preamble_type; } else { PRINT_ER("Preamle Range(0~2) over\n"); result = -EINVAL; goto ERRORHANDLER; } - u8WidCnt++; + wid_cnt++; } if (cfg_param_attr->cfg_attr_info.flag & SHORT_SLOT_ALLOWED) { if (cfg_param_attr->cfg_attr_info.short_slot_allowed < 2) { - wid_list[u8WidCnt].id = WID_SHORT_SLOT_ALLOWED; - wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.short_slot_allowed; - wid_list[u8WidCnt].type = WID_CHAR; - wid_list[u8WidCnt].size = sizeof(char); + wid_list[wid_cnt].id = WID_SHORT_SLOT_ALLOWED; + wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.short_slot_allowed; + wid_list[wid_cnt].type = WID_CHAR; + wid_list[wid_cnt].size = sizeof(char); hif_drv->cfg_values.short_slot_allowed = (u8)cfg_param_attr->cfg_attr_info.short_slot_allowed; } else { PRINT_ER("Short slot(2) over\n"); result = -EINVAL; goto ERRORHANDLER; } - u8WidCnt++; + wid_cnt++; } if (cfg_param_attr->cfg_attr_info.flag & TXOP_PROT_DISABLE) { if (cfg_param_attr->cfg_attr_info.txop_prot_disabled < 2) { - wid_list[u8WidCnt].id = WID_11N_TXOP_PROT_DISABLE; - wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.txop_prot_disabled; - wid_list[u8WidCnt].type = WID_CHAR; - wid_list[u8WidCnt].size = sizeof(char); + wid_list[wid_cnt].id = WID_11N_TXOP_PROT_DISABLE; + wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.txop_prot_disabled; + wid_list[wid_cnt].type = WID_CHAR; + wid_list[wid_cnt].size = sizeof(char); hif_drv->cfg_values.txop_prot_disabled = (u8)cfg_param_attr->cfg_attr_info.txop_prot_disabled; } else { PRINT_ER("TXOP prot disable\n"); result = -EINVAL; goto ERRORHANDLER; } - u8WidCnt++; + wid_cnt++; } if (cfg_param_attr->cfg_attr_info.flag & BEACON_INTERVAL) { if (cfg_param_attr->cfg_attr_info.beacon_interval > 0 && cfg_param_attr->cfg_attr_info.beacon_interval < 65536) { - wid_list[u8WidCnt].id = WID_BEACON_INTERVAL; - wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.beacon_interval; - wid_list[u8WidCnt].type = WID_SHORT; - wid_list[u8WidCnt].size = sizeof(u16); + wid_list[wid_cnt].id = WID_BEACON_INTERVAL; + wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.beacon_interval; + wid_list[wid_cnt].type = WID_SHORT; + wid_list[wid_cnt].size = sizeof(u16); hif_drv->cfg_values.beacon_interval = cfg_param_attr->cfg_attr_info.beacon_interval; } else { PRINT_ER("Beacon interval(1~65535) fail\n"); result = -EINVAL; goto ERRORHANDLER; } - u8WidCnt++; + wid_cnt++; } if (cfg_param_attr->cfg_attr_info.flag & DTIM_PERIOD) { if (cfg_param_attr->cfg_attr_info.dtim_period > 0 && cfg_param_attr->cfg_attr_info.dtim_period < 256) { - wid_list[u8WidCnt].id = WID_DTIM_PERIOD; - wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.dtim_period; - wid_list[u8WidCnt].type = WID_CHAR; - wid_list[u8WidCnt].size = sizeof(char); + wid_list[wid_cnt].id = WID_DTIM_PERIOD; + wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.dtim_period; + wid_list[wid_cnt].type = WID_CHAR; + wid_list[wid_cnt].size = sizeof(char); hif_drv->cfg_values.dtim_period = cfg_param_attr->cfg_attr_info.dtim_period; } else { PRINT_ER("DTIM range(1~255) fail\n"); result = -EINVAL; goto ERRORHANDLER; } - u8WidCnt++; + wid_cnt++; } if (cfg_param_attr->cfg_attr_info.flag & SITE_SURVEY) { if (cfg_param_attr->cfg_attr_info.site_survey_enabled < 3) { - wid_list[u8WidCnt].id = WID_SITE_SURVEY; - wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.site_survey_enabled; - wid_list[u8WidCnt].type = WID_CHAR; - wid_list[u8WidCnt].size = sizeof(char); + wid_list[wid_cnt].id = WID_SITE_SURVEY; + wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.site_survey_enabled; + wid_list[wid_cnt].type = WID_CHAR; + wid_list[wid_cnt].size = sizeof(char); hif_drv->cfg_values.site_survey_enabled = (u8)cfg_param_attr->cfg_attr_info.site_survey_enabled; } else { PRINT_ER("Site survey disable\n"); result = -EINVAL; goto ERRORHANDLER; } - u8WidCnt++; + wid_cnt++; } if (cfg_param_attr->cfg_attr_info.flag & SITE_SURVEY_SCAN_TIME) { if (cfg_param_attr->cfg_attr_info.site_survey_scan_time > 0 && cfg_param_attr->cfg_attr_info.site_survey_scan_time < 65536) { - wid_list[u8WidCnt].id = WID_SITE_SURVEY_SCAN_TIME; - wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.site_survey_scan_time; - wid_list[u8WidCnt].type = WID_SHORT; - wid_list[u8WidCnt].size = sizeof(u16); + wid_list[wid_cnt].id = WID_SITE_SURVEY_SCAN_TIME; + wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.site_survey_scan_time; + wid_list[wid_cnt].type = WID_SHORT; + wid_list[wid_cnt].size = sizeof(u16); hif_drv->cfg_values.site_survey_scan_time = cfg_param_attr->cfg_attr_info.site_survey_scan_time; } else { PRINT_ER("Site survey scan time(1~65535) over\n"); result = -EINVAL; goto ERRORHANDLER; } - u8WidCnt++; + wid_cnt++; } if (cfg_param_attr->cfg_attr_info.flag & ACTIVE_SCANTIME) { if (cfg_param_attr->cfg_attr_info.active_scan_time > 0 && cfg_param_attr->cfg_attr_info.active_scan_time < 65536) { - wid_list[u8WidCnt].id = WID_ACTIVE_SCAN_TIME; - wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.active_scan_time; - wid_list[u8WidCnt].type = WID_SHORT; - wid_list[u8WidCnt].size = sizeof(u16); + wid_list[wid_cnt].id = WID_ACTIVE_SCAN_TIME; + wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.active_scan_time; + wid_list[wid_cnt].type = WID_SHORT; + wid_list[wid_cnt].size = sizeof(u16); hif_drv->cfg_values.active_scan_time = cfg_param_attr->cfg_attr_info.active_scan_time; } else { PRINT_ER("Active scan time(1~65535) over\n"); result = -EINVAL; goto ERRORHANDLER; } - u8WidCnt++; + wid_cnt++; } if (cfg_param_attr->cfg_attr_info.flag & PASSIVE_SCANTIME) { if (cfg_param_attr->cfg_attr_info.passive_scan_time > 0 && cfg_param_attr->cfg_attr_info.passive_scan_time < 65536) { - wid_list[u8WidCnt].id = WID_PASSIVE_SCAN_TIME; - wid_list[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.passive_scan_time; - wid_list[u8WidCnt].type = WID_SHORT; - wid_list[u8WidCnt].size = sizeof(u16); + wid_list[wid_cnt].id = WID_PASSIVE_SCAN_TIME; + wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.passive_scan_time; + wid_list[wid_cnt].type = WID_SHORT; + wid_list[wid_cnt].size = sizeof(u16); hif_drv->cfg_values.passive_scan_time = cfg_param_attr->cfg_attr_info.passive_scan_time; } else { PRINT_ER("Passive scan time(1~65535) over\n"); result = -EINVAL; goto ERRORHANDLER; } - u8WidCnt++; + wid_cnt++; } if (cfg_param_attr->cfg_attr_info.flag & CURRENT_TX_RATE) { enum CURRENT_TXRATE curr_tx_rate = cfg_param_attr->cfg_attr_info.curr_tx_rate; @@ -787,20 +787,20 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, || curr_tx_rate == MBPS_9 || curr_tx_rate == MBPS_12 || curr_tx_rate == MBPS_18 || curr_tx_rate == MBPS_24 || curr_tx_rate == MBPS_36 || curr_tx_rate == MBPS_48 || curr_tx_rate == MBPS_54) { - wid_list[u8WidCnt].id = WID_CURRENT_TX_RATE; - wid_list[u8WidCnt].val = (s8 *)&curr_tx_rate; - wid_list[u8WidCnt].type = WID_SHORT; - wid_list[u8WidCnt].size = sizeof(u16); + wid_list[wid_cnt].id = WID_CURRENT_TX_RATE; + wid_list[wid_cnt].val = (s8 *)&curr_tx_rate; + wid_list[wid_cnt].type = WID_SHORT; + wid_list[wid_cnt].size = sizeof(u16); hif_drv->cfg_values.curr_tx_rate = (u8)curr_tx_rate; } else { PRINT_ER("out of TX rate\n"); result = -EINVAL; goto ERRORHANDLER; } - u8WidCnt++; + wid_cnt++; } - result = send_config_pkt(SET_CFG, wid_list, u8WidCnt, + result = send_config_pkt(SET_CFG, wid_list, wid_cnt, get_id_from_handler(hif_drv)); if (result) From cdb99231c4cb9ab3de2a0090a335d73b4ece0ea4 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:39:58 +0900 Subject: [PATCH 302/843] staging: wilc1000: separate hif_sdio and hif_spi into different module hif_sdio and hif_spi objects are compiled all the time even though one of SPI or SDIO is selected. This patch separates hif_sdio and hif_spi into different modules using ifdef define. After rework SPI and SDIO modules with only one hif interface, the define WILC_SDIO will be removed. This is first path of this series. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/Makefile | 6 ++--- drivers/staging/wilc1000/wilc_wlan.c | 36 +++++++++++++--------------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile index 64c2f1b83dfb..650123df0b4c 100644 --- a/drivers/staging/wilc1000/Makefile +++ b/drivers/staging/wilc1000/Makefile @@ -21,8 +21,8 @@ ccflags-$(CONFIG_WILC1000_DYNAMICALLY_ALLOCATE_MEMROY) += -DWILC_NORMAL_ALLOC wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \ wilc_msgqueue.o \ coreconfigurator.o host_interface.o \ - wilc_sdio.o wilc_spi.o wilc_wlan_cfg.o wilc_debugfs.o \ + wilc_wlan_cfg.o wilc_debugfs.o \ wilc_wlan.o -wilc1000-$(CONFIG_WILC1000_SDIO) += linux_wlan_sdio.o -wilc1000-$(CONFIG_WILC1000_SPI) += linux_wlan_spi.o +wilc1000-$(CONFIG_WILC1000_SDIO) += linux_wlan_sdio.o wilc_sdio.o +wilc1000-$(CONFIG_WILC1000_SPI) += linux_wlan_spi.o wilc_spi.o diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index b6d784bcf98e..2ce58702d705 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -2,8 +2,11 @@ #include "wilc_wfi_netdevice.h" #include "wilc_wlan_cfg.h" +#ifdef WILC_SDIO extern struct wilc_hif_func hif_sdio; +#else extern struct wilc_hif_func hif_spi; +#endif u32 wilc_get_chipid(u8 update); typedef struct { @@ -1659,26 +1662,21 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) memcpy((void *)&g_wlan.io_func, (void *)&inp->io_func, sizeof(wilc_wlan_io_func_t)); - if ((inp->io_func.io_type & 0x1) == HIF_SDIO) { - if (!hif_sdio.hif_init(inp, wilc_debug)) { - ret = -EIO; - goto _fail_; - } - memcpy((void *)&g_wlan.hif_func, &hif_sdio, - sizeof(struct wilc_hif_func)); - } else { - if ((inp->io_func.io_type & 0x1) == HIF_SPI) { - if (!hif_spi.hif_init(inp, wilc_debug)) { - ret = -EIO; - goto _fail_; - } - memcpy((void *)&g_wlan.hif_func, &hif_spi, - sizeof(struct wilc_hif_func)); - } else { - ret = -EIO; - goto _fail_; - } +#ifdef WILC_SDIO + if (!hif_sdio.hif_init(inp, wilc_debug)) { + ret = -EIO; + goto _fail_; } + memcpy((void *)&g_wlan.hif_func, &hif_sdio, + sizeof(struct wilc_hif_func)); +#else + if (!hif_spi.hif_init(inp, wilc_debug)) { + ret = -EIO; + goto _fail_; + } + memcpy((void *)&g_wlan.hif_func, &hif_spi, + sizeof(struct wilc_hif_func)); +#endif if (!wilc_wlan_cfg_init(wilc_debug)) { ret = -ENOBUFS; From 3ff2ac2c042bf23a6ad520fb483c5d3f89c3e1d0 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:39:59 +0900 Subject: [PATCH 303/843] staging: wilc1000: remove function pointer sdio_cmd52 This patch removes function pointer sdio_cmd52 of wilc_sdio_t and just call the function directly. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_sdio.c | 53 ++++++++++++++-------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index cfa76b26bb53..a2d631882fde 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -10,13 +10,13 @@ #include #include "wilc_wlan_if.h" #include "wilc_wlan.h" +#include "linux_wlan_sdio.h" #define WILC_SDIO_BLOCK_SIZE 512 typedef struct { void *os_context; u32 block_size; - int (*sdio_cmd52)(sdio_cmd52_t *); int (*sdio_cmd53)(sdio_cmd53_t *); int (*sdio_set_max_speed)(void); int (*sdio_set_default_speed)(void); @@ -51,21 +51,21 @@ static int sdio_set_func0_csa_address(u32 adr) cmd.raw = 0; cmd.address = 0x10c; cmd.data = (u8)adr; - if (!g_sdio.sdio_cmd52(&cmd)) { + if (!linux_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10c data...\n"); goto _fail_; } cmd.address = 0x10d; cmd.data = (u8)(adr >> 8); - if (!g_sdio.sdio_cmd52(&cmd)) { + if (!linux_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10d data...\n"); goto _fail_; } cmd.address = 0x10e; cmd.data = (u8)(adr >> 16); - if (!g_sdio.sdio_cmd52(&cmd)) { + if (!linux_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10e data...\n"); goto _fail_; } @@ -84,14 +84,14 @@ static int sdio_set_func0_block_size(u32 block_size) cmd.raw = 0; cmd.address = 0x10; cmd.data = (u8)block_size; - if (!g_sdio.sdio_cmd52(&cmd)) { + if (!linux_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10 data...\n"); goto _fail_; } cmd.address = 0x11; cmd.data = (u8)(block_size >> 8); - if (!g_sdio.sdio_cmd52(&cmd)) { + if (!linux_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x11 data...\n"); goto _fail_; } @@ -116,13 +116,13 @@ static int sdio_set_func1_block_size(u32 block_size) cmd.raw = 0; cmd.address = 0x110; cmd.data = (u8)block_size; - if (!g_sdio.sdio_cmd52(&cmd)) { + if (!linux_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x110 data...\n"); goto _fail_; } cmd.address = 0x111; cmd.data = (u8)(block_size >> 8); - if (!g_sdio.sdio_cmd52(&cmd)) { + if (!linux_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x111 data...\n"); goto _fail_; } @@ -143,7 +143,7 @@ static int sdio_clear_int(void) cmd.raw = 0; cmd.address = 0x4; cmd.data = 0; - g_sdio.sdio_cmd52(&cmd); + linux_sdio_cmd52(&cmd); return cmd.data; #else @@ -170,7 +170,7 @@ u32 sdio_xfer_cnt(void) cmd.raw = 0; cmd.address = 0x1C; cmd.data = 0; - g_sdio.sdio_cmd52(&cmd); + linux_sdio_cmd52(&cmd); cnt = cmd.data; cmd.read_write = 0; @@ -178,7 +178,7 @@ u32 sdio_xfer_cnt(void) cmd.raw = 0; cmd.address = 0x1D; cmd.data = 0; - g_sdio.sdio_cmd52(&cmd); + linux_sdio_cmd52(&cmd); cnt |= (cmd.data << 8); cmd.read_write = 0; @@ -186,7 +186,7 @@ u32 sdio_xfer_cnt(void) cmd.raw = 0; cmd.address = 0x1E; cmd.data = 0; - g_sdio.sdio_cmd52(&cmd); + linux_sdio_cmd52(&cmd); cnt |= (cmd.data << 16); return cnt; @@ -209,7 +209,7 @@ int sdio_check_bs(void) cmd.raw = 0; cmd.address = 0xc; cmd.data = 0; - if (!g_sdio.sdio_cmd52(&cmd)) { + if (!linux_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, get BS register...\n"); goto _fail_; } @@ -235,7 +235,7 @@ static int sdio_write_reg(u32 addr, u32 data) cmd.raw = 0; cmd.address = addr; cmd.data = data; - if (!g_sdio.sdio_cmd52(&cmd)) { + if (!linux_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd 52, read reg (%08x) ...\n", addr); goto _fail_; } @@ -363,7 +363,7 @@ static int sdio_read_reg(u32 addr, u32 *data) cmd.function = 0; cmd.raw = 0; cmd.address = addr; - if (!g_sdio.sdio_cmd52(&cmd)) { + if (!linux_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd 52, read reg (%08x) ...\n", addr); goto _fail_; } @@ -574,7 +574,6 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func) return 0; } - g_sdio.sdio_cmd52 = inp->io_func.u.sdio.sdio_cmd52; g_sdio.sdio_cmd53 = inp->io_func.u.sdio.sdio_cmd53; g_sdio.sdio_set_max_speed = inp->io_func.u.sdio.sdio_set_max_speed; g_sdio.sdio_set_default_speed = inp->io_func.u.sdio.sdio_set_default_speed; @@ -587,7 +586,7 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func) cmd.raw = 1; cmd.address = 0x100; cmd.data = 0x80; - if (!g_sdio.sdio_cmd52(&cmd)) { + if (!linux_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, enable csa...\n"); goto _fail_; } @@ -609,7 +608,7 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func) cmd.raw = 1; cmd.address = 0x2; cmd.data = 0x2; - if (!g_sdio.sdio_cmd52(&cmd)) { + if (!linux_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio] Fail cmd 52, set IOE register...\n"); goto _fail_; } @@ -624,7 +623,7 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func) loop = 3; do { cmd.data = 0; - if (!g_sdio.sdio_cmd52(&cmd)) { + if (!linux_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, get IOR register...\n"); goto _fail_; } @@ -653,7 +652,7 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func) cmd.raw = 1; cmd.address = 0x4; cmd.data = 0x3; - if (!g_sdio.sdio_cmd52(&cmd)) { + if (!linux_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, set IEN register...\n"); goto _fail_; } @@ -703,7 +702,7 @@ static int sdio_read_size(u32 *size) cmd.raw = 0; cmd.address = 0xf2; cmd.data = 0; - g_sdio.sdio_cmd52(&cmd); + linux_sdio_cmd52(&cmd); tmp = cmd.data; /* cmd.read_write = 0; */ @@ -711,7 +710,7 @@ static int sdio_read_size(u32 *size) /* cmd.raw = 0; */ cmd.address = 0xf3; cmd.data = 0; - g_sdio.sdio_cmd52(&cmd); + linux_sdio_cmd52(&cmd); tmp |= (cmd.data << 8); *size = tmp; @@ -733,7 +732,7 @@ static int sdio_read_int(u32 *int_status) cmd.function = 1; cmd.address = 0x04; cmd.data = 0; - g_sdio.sdio_cmd52(&cmd); + linux_sdio_cmd52(&cmd); if (cmd.data & BIT(0)) tmp |= INT_0; @@ -766,7 +765,7 @@ static int sdio_read_int(u32 *int_status) cmd.raw = 0; cmd.address = 0xf7; cmd.data = 0; - g_sdio.sdio_cmd52(&cmd); + linux_sdio_cmd52(&cmd); irq_flags = cmd.data & 0x1f; tmp |= ((irq_flags >> 0) << IRG_FLAGS_OFFSET); } @@ -813,7 +812,7 @@ static int sdio_clear_int_ext(u32 val) cmd.address = 0xf8; cmd.data = reg; - ret = g_sdio.sdio_cmd52(&cmd); + ret = linux_sdio_cmd52(&cmd); if (!ret) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0xf8 data (%d) ...\n", __LINE__); goto _fail_; @@ -842,7 +841,7 @@ static int sdio_clear_int_ext(u32 val) cmd.address = 0xf8; cmd.data = BIT(i); - ret = g_sdio.sdio_cmd52(&cmd); + ret = linux_sdio_cmd52(&cmd); if (!ret) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0xf8 data (%d) ...\n", __LINE__); goto _fail_; @@ -886,7 +885,7 @@ static int sdio_clear_int_ext(u32 val) cmd.raw = 0; cmd.address = 0xf6; cmd.data = vmm_ctl; - ret = g_sdio.sdio_cmd52(&cmd); + ret = linux_sdio_cmd52(&cmd); if (!ret) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0xf6 data (%d) ...\n", __LINE__); goto _fail_; From b2882ab32bd33280739b7c294a7567f45523e95d Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:00 +0900 Subject: [PATCH 304/843] staging: wilc1000: remove sdio_cmd52 of wilc_wlan_io_func_t This patch removes sdio_cmd52 of wilc_wlan_io_func_t which is not used. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 1 - drivers/staging/wilc1000/wilc_wlan_if.h | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index c94cb1362a55..ce5463e44e61 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -894,7 +894,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic) nwi->io_func.io_type = HIF_SDIO; nwi->io_func.io_init = linux_sdio_init; nwi->io_func.io_deinit = linux_sdio_deinit; - nwi->io_func.u.sdio.sdio_cmd52 = linux_sdio_cmd52; nwi->io_func.u.sdio.sdio_cmd53 = linux_sdio_cmd53; nwi->io_func.u.sdio.sdio_set_max_speed = linux_sdio_set_max_speed; nwi->io_func.u.sdio.sdio_set_default_speed = linux_sdio_set_default_speed; diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index 12cbc4bcac90..cd83098314dc 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -78,7 +78,6 @@ typedef struct { void (*io_deinit)(void *); union { struct { - int (*sdio_cmd52)(sdio_cmd52_t *); int (*sdio_cmd53)(sdio_cmd53_t *); int (*sdio_set_max_speed)(void); int (*sdio_set_default_speed)(void); From a960936efb4401df773f667e482d2c483ebda826 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:01 +0900 Subject: [PATCH 305/843] staging: wilc1000: remove function pointer sdio_cmd53 This patch removes function pointer sdio_cmd53 of wilc_sdio_t and just call the function directly. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_sdio.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index a2d631882fde..1176946d07d6 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -17,7 +17,6 @@ typedef struct { void *os_context; u32 block_size; - int (*sdio_cmd53)(sdio_cmd53_t *); int (*sdio_set_max_speed)(void); int (*sdio_set_default_speed)(void); wilc_debug_func dPrint; @@ -257,7 +256,7 @@ static int sdio_write_reg(u32 addr, u32 data) cmd.buffer = (u8 *)&data; cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */ - if (!g_sdio.sdio_cmd53(&cmd)) { + if (!linux_sdio_cmd53(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53, write reg (%08x)...\n", addr); goto _fail_; } @@ -320,7 +319,7 @@ static int sdio_write(u32 addr, u8 *buf, u32 size) if (!sdio_set_func0_csa_address(addr)) goto _fail_; } - if (!g_sdio.sdio_cmd53(&cmd)) { + if (!linux_sdio_cmd53(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block send...\n", addr); goto _fail_; } @@ -341,7 +340,7 @@ static int sdio_write(u32 addr, u8 *buf, u32 size) if (!sdio_set_func0_csa_address(addr)) goto _fail_; } - if (!g_sdio.sdio_cmd53(&cmd)) { + if (!linux_sdio_cmd53(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], bytes send...\n", addr); goto _fail_; } @@ -384,7 +383,7 @@ static int sdio_read_reg(u32 addr, u32 *data) cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */ - if (!g_sdio.sdio_cmd53(&cmd)) { + if (!linux_sdio_cmd53(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53, read reg (%08x)...\n", addr); goto _fail_; } @@ -451,7 +450,7 @@ static int sdio_read(u32 addr, u8 *buf, u32 size) if (!sdio_set_func0_csa_address(addr)) goto _fail_; } - if (!g_sdio.sdio_cmd53(&cmd)) { + if (!linux_sdio_cmd53(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block read...\n", addr); goto _fail_; } @@ -472,7 +471,7 @@ static int sdio_read(u32 addr, u8 *buf, u32 size) if (!sdio_set_func0_csa_address(addr)) goto _fail_; } - if (!g_sdio.sdio_cmd53(&cmd)) { + if (!linux_sdio_cmd53(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], bytes read...\n", addr); goto _fail_; } @@ -574,7 +573,6 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func) return 0; } - g_sdio.sdio_cmd53 = inp->io_func.u.sdio.sdio_cmd53; g_sdio.sdio_set_max_speed = inp->io_func.u.sdio.sdio_set_max_speed; g_sdio.sdio_set_default_speed = inp->io_func.u.sdio.sdio_set_default_speed; From 2d6151782d6cc41b25fbec6607e23daaa34ce24b Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:02 +0900 Subject: [PATCH 306/843] staging: wilc1000: remove sdio_cmd53 of wilc_wlan_io_func_t This patch removes sdio_cmd53 of wilc_wlan_io_func_t which is not used. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 1 - drivers/staging/wilc1000/wilc_wlan_if.h | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index ce5463e44e61..725831395395 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -894,7 +894,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic) nwi->io_func.io_type = HIF_SDIO; nwi->io_func.io_init = linux_sdio_init; nwi->io_func.io_deinit = linux_sdio_deinit; - nwi->io_func.u.sdio.sdio_cmd53 = linux_sdio_cmd53; nwi->io_func.u.sdio.sdio_set_max_speed = linux_sdio_set_max_speed; nwi->io_func.u.sdio.sdio_set_default_speed = linux_sdio_set_default_speed; #else diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index cd83098314dc..92cee4576612 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -78,7 +78,6 @@ typedef struct { void (*io_deinit)(void *); union { struct { - int (*sdio_cmd53)(sdio_cmd53_t *); int (*sdio_set_max_speed)(void); int (*sdio_set_default_speed)(void); } sdio; From 78d2f1a4b50c6460e9b82179ec301773b5757acb Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:03 +0900 Subject: [PATCH 307/843] staging: wilc1000: remove function pointer sdio_set_max_speed This patch removes function pointer sdio_set_max_speed of wilc_sdio_t and call the function directly. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_sdio.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index 1176946d07d6..0ce2eccb3618 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -17,7 +17,6 @@ typedef struct { void *os_context; u32 block_size; - int (*sdio_set_max_speed)(void); int (*sdio_set_default_speed)(void); wilc_debug_func dPrint; int nint; @@ -573,7 +572,6 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func) return 0; } - g_sdio.sdio_set_max_speed = inp->io_func.u.sdio.sdio_set_max_speed; g_sdio.sdio_set_default_speed = inp->io_func.u.sdio.sdio_set_default_speed; /** @@ -678,7 +676,7 @@ _fail_: static void sdio_set_max_speed(void) { - g_sdio.sdio_set_max_speed(); + linux_sdio_set_max_speed(); } static void sdio_set_default_speed(void) From f15179eb1f77b1b991273d5229b676ac630be1c0 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:04 +0900 Subject: [PATCH 308/843] staging: wilc1000: remove sdio_set_max_speed This patch removes sdio_set_max_speed of wilc_wlan_io_func_t which is not used any more. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 1 - drivers/staging/wilc1000/wilc_wlan_if.h | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 725831395395..9ecf30775852 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -894,7 +894,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic) nwi->io_func.io_type = HIF_SDIO; nwi->io_func.io_init = linux_sdio_init; nwi->io_func.io_deinit = linux_sdio_deinit; - nwi->io_func.u.sdio.sdio_set_max_speed = linux_sdio_set_max_speed; nwi->io_func.u.sdio.sdio_set_default_speed = linux_sdio_set_default_speed; #else nwi->io_func.io_type = HIF_SPI; diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index 92cee4576612..2caad2883b19 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -78,7 +78,6 @@ typedef struct { void (*io_deinit)(void *); union { struct { - int (*sdio_set_max_speed)(void); int (*sdio_set_default_speed)(void); } sdio; struct { From 544827f3807f8165f2736d4b3fbe89a33754b05e Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:05 +0900 Subject: [PATCH 309/843] staging: wilc1000: remove function pointer sdio_set_default_speed This patch removes function pointer sdio_set_default_speed of wilc_sdio_t and call linux_sdio_set_default_speed() directly. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_sdio.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index 0ce2eccb3618..6f488395e1b3 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -17,7 +17,6 @@ typedef struct { void *os_context; u32 block_size; - int (*sdio_set_default_speed)(void); wilc_debug_func dPrint; int nint; #define MAX_NUN_INT_THRPT_ENH2 (5) /* Max num interrupts allowed in registers 0xf7, 0xf8 */ @@ -572,8 +571,6 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func) return 0; } - g_sdio.sdio_set_default_speed = inp->io_func.u.sdio.sdio_set_default_speed; - /** * function 0 csa enable **/ @@ -681,7 +678,7 @@ static void sdio_set_max_speed(void) static void sdio_set_default_speed(void) { - g_sdio.sdio_set_default_speed(); + linux_sdio_set_default_speed(); } static int sdio_read_size(u32 *size) From 1c2cf24ce5fde01316bfaa0b03711651ab1a71bf Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:06 +0900 Subject: [PATCH 310/843] staging: wilc1000: remove varialbe sdio_set_default_speed This patch removes sdio_set_default_speed of wilc_wlan_io_func_t which is not used anymore and also remove struct sdio since it is empty. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 1 - drivers/staging/wilc1000/wilc_wlan_if.h | 3 --- 2 files changed, 4 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 9ecf30775852..b37ef4d02943 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -894,7 +894,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic) nwi->io_func.io_type = HIF_SDIO; nwi->io_func.io_init = linux_sdio_init; nwi->io_func.io_deinit = linux_sdio_deinit; - nwi->io_func.u.sdio.sdio_set_default_speed = linux_sdio_set_default_speed; #else nwi->io_func.io_type = HIF_SPI; nwi->io_func.io_init = linux_spi_init; diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index 2caad2883b19..4568457d9820 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -77,9 +77,6 @@ typedef struct { int (*io_init)(void *); void (*io_deinit)(void *); union { - struct { - int (*sdio_set_default_speed)(void); - } sdio; struct { int (*spi_max_speed)(void); int (*spi_tx)(u8 *, u32); From de11ee8b214e26aebe07729629246ef893d056cb Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:07 +0900 Subject: [PATCH 311/843] staging: wilc1000: call linux_sdio_init instead of io_init Just call linux_sdio_init instead of io_init function pointer. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_sdio.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index 6f488395e1b3..0d88b6e46a02 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -562,11 +562,9 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func) g_sdio.dPrint = func; g_sdio.os_context = inp->os_context.os_private; - if (inp->io_func.io_init) { - if (!inp->io_func.io_init(g_sdio.os_context)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed io init bus...\n"); - return 0; - } + if (!linux_sdio_init(g_sdio.os_context)) { + g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed io init bus...\n"); + return 0; } else { return 0; } From d4a7344b77c96748ca91368355f138de4e370879 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:08 +0900 Subject: [PATCH 312/843] staging: wilc1000: wilc_spi.c: add prefix wilc in all function name This patch add prefix wilc for all functions name because the function name such as spi_write, spi_read and spi_sync are same as linux spi function. Hence, this should be done before restructuring wilc_spi.c and linux_wlan_spi.c later. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_spi.c | 108 ++++++++++++++-------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index b09b3bde68c2..946bda77827f 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -25,8 +25,8 @@ typedef struct { static wilc_spi_t g_spi; -static int spi_read(u32, u8 *, u32); -static int spi_write(u32, u8 *, u32); +static int wilc_spi_read(u32, u8 *, u32); +static int wilc_spi_write(u32, u8 *, u32); /******************************************** * @@ -790,7 +790,7 @@ static int spi_internal_read(u32 adr, u32 *data) * ********************************************/ -static int spi_write_reg(u32 addr, u32 data) +static int wilc_spi_write_reg(u32 addr, u32 data) { int result = N_OK; u8 cmd = CMD_SINGLE_WRITE; @@ -813,7 +813,7 @@ static int spi_write_reg(u32 addr, u32 data) return result; } -static int spi_write(u32 addr, u8 *buf, u32 size) +static int wilc_spi_write(u32 addr, u8 *buf, u32 size) { int result; u8 cmd = CMD_DMA_EXT_WRITE; @@ -841,7 +841,7 @@ static int spi_write(u32 addr, u8 *buf, u32 size) return 1; } -static int spi_read_reg(u32 addr, u32 *data) +static int wilc_spi_read_reg(u32 addr, u32 *data) { int result = N_OK; u8 cmd = CMD_SINGLE_READ; @@ -867,7 +867,7 @@ static int spi_read_reg(u32 addr, u32 *data) return 1; } -static int spi_read(u32 addr, u8 *buf, u32 size) +static int wilc_spi_read(u32 addr, u8 *buf, u32 size) { u8 cmd = CMD_DMA_EXT_READ; int result; @@ -890,20 +890,20 @@ static int spi_read(u32 addr, u8 *buf, u32 size) * ********************************************/ -static int spi_clear_int(void) +static int wilc_spi_clear_int(void) { u32 reg; - if (!spi_read_reg(WILC_HOST_RX_CTRL_0, ®)) { + if (!wilc_spi_read_reg(WILC_HOST_RX_CTRL_0, ®)) { PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_HOST_RX_CTRL_0); return 0; } reg &= ~0x1; - spi_write_reg(WILC_HOST_RX_CTRL_0, reg); + wilc_spi_write_reg(WILC_HOST_RX_CTRL_0, reg); return 1; } -static int spi_deinit(void *pv) +static int wilc_spi_deinit(void *pv) { /** * TODO: @@ -911,7 +911,7 @@ static int spi_deinit(void *pv) return 1; } -static int spi_sync(void) +static int wilc_spi_sync(void) { u32 reg; int ret; @@ -919,13 +919,13 @@ static int spi_sync(void) /** * interrupt pin mux select **/ - ret = spi_read_reg(WILC_PIN_MUX_0, ®); + ret = wilc_spi_read_reg(WILC_PIN_MUX_0, ®); if (!ret) { PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_PIN_MUX_0); return 0; } reg |= BIT(8); - ret = spi_write_reg(WILC_PIN_MUX_0, reg); + ret = wilc_spi_write_reg(WILC_PIN_MUX_0, reg); if (!ret) { PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_PIN_MUX_0); return 0; @@ -934,13 +934,13 @@ static int spi_sync(void) /** * interrupt enable **/ - ret = spi_read_reg(WILC_INTR_ENABLE, ®); + ret = wilc_spi_read_reg(WILC_INTR_ENABLE, ®); if (!ret) { PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_INTR_ENABLE); return 0; } reg |= BIT(16); - ret = spi_write_reg(WILC_INTR_ENABLE, reg); + ret = wilc_spi_write_reg(WILC_INTR_ENABLE, reg); if (!ret) { PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_INTR_ENABLE); return 0; @@ -949,7 +949,7 @@ static int spi_sync(void) return 1; } -static int spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func) +static int wilc_spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func) { u32 reg; u32 chipid; @@ -958,7 +958,7 @@ static int spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func) if (isinit) { - if (!spi_read_reg(0x1000, &chipid)) { + if (!wilc_spi_read_reg(0x1000, &chipid)) { PRINT_ER("[wilc spi]: Fail cmd read chip id...\n"); return 0; } @@ -1015,7 +1015,7 @@ static int spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func) /** * make sure can read back chip id correctly **/ - if (!spi_read_reg(0x1000, &chipid)) { + if (!wilc_spi_read_reg(0x1000, &chipid)) { PRINT_ER("[wilc spi]: Fail cmd read chip id...\n"); return 0; } @@ -1028,16 +1028,16 @@ static int spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func) return 1; } -static void spi_max_bus_speed(void) +static void wilc_spi_max_bus_speed(void) { g_spi.spi_max_speed(); } -static void spi_default_bus_speed(void) +static void wilc_spi_default_bus_speed(void) { } -static int spi_read_size(u32 *size) +static int wilc_spi_read_size(u32 *size) { int ret; @@ -1048,7 +1048,7 @@ static int spi_read_size(u32 *size) u32 tmp; u32 byte_cnt; - ret = spi_read_reg(WILC_VMM_TO_HOST_SIZE, &byte_cnt); + ret = wilc_spi_read_reg(WILC_VMM_TO_HOST_SIZE, &byte_cnt); if (!ret) { PRINT_ER("[wilc spi]: Failed read WILC_VMM_TO_HOST_SIZE ...\n"); goto _fail_; @@ -1065,7 +1065,7 @@ _fail_: -static int spi_read_int(u32 *int_status) +static int wilc_spi_read_int(u32 *int_status) { int ret; @@ -1075,7 +1075,7 @@ static int spi_read_int(u32 *int_status) u32 tmp; u32 byte_cnt; - ret = spi_read_reg(WILC_VMM_TO_HOST_SIZE, &byte_cnt); + ret = wilc_spi_read_reg(WILC_VMM_TO_HOST_SIZE, &byte_cnt); if (!ret) { PRINT_ER("[wilc spi]: Failed read WILC_VMM_TO_HOST_SIZE ...\n"); goto _fail_; @@ -1091,11 +1091,11 @@ static int spi_read_int(u32 *int_status) happended = 0; - spi_read_reg(0x1a90, &irq_flags); + wilc_spi_read_reg(0x1a90, &irq_flags); tmp |= ((irq_flags >> 27) << IRG_FLAGS_OFFSET); if (g_spi.nint > 5) { - spi_read_reg(0x1a94, &irq_flags); + wilc_spi_read_reg(0x1a94, &irq_flags); tmp |= (((irq_flags >> 0) & 0x7) << (IRG_FLAGS_OFFSET + 5)); } @@ -1121,7 +1121,7 @@ _fail_: return ret; } -static int spi_clear_int_ext(u32 val) +static int wilc_spi_clear_int_ext(u32 val) { int ret; @@ -1138,13 +1138,13 @@ static int spi_clear_int_ext(u32 val) for (i = 0; i < g_spi.nint; i++) { /* No matter what you write 1 or 0, it will clear interrupt. */ if (flags & 1) - ret = spi_write_reg(0x10c8 + i * 4, 1); + ret = wilc_spi_write_reg(0x10c8 + i * 4, 1); if (!ret) break; flags >>= 1; } if (!ret) { - PRINT_ER("[wilc spi]: Failed spi_write_reg, set reg %x ...\n", 0x10c8 + i * 4); + PRINT_ER("[wilc spi]: Failed wilc_spi_write_reg, set reg %x ...\n", 0x10c8 + i * 4); goto _fail_; } for (i = g_spi.nint; i < MAX_NUM_INT; i++) { @@ -1165,7 +1165,7 @@ static int spi_clear_int_ext(u32 val) if ((val & SEL_VMM_TBL1) == SEL_VMM_TBL1) tbl_ctl |= BIT(1); - ret = spi_write_reg(WILC_VMM_TBL_CTL, tbl_ctl); + ret = wilc_spi_write_reg(WILC_VMM_TBL_CTL, tbl_ctl); if (!ret) { PRINT_ER("[wilc spi]: fail write reg vmm_tbl_ctl...\n"); goto _fail_; @@ -1175,7 +1175,7 @@ static int spi_clear_int_ext(u32 val) /** * enable vmm transfer. **/ - ret = spi_write_reg(WILC_VMM_CORE_CTL, 1); + ret = wilc_spi_write_reg(WILC_VMM_CORE_CTL, 1); if (!ret) { PRINT_ER("[wilc spi]: fail write reg vmm_core_ctl...\n"); goto _fail_; @@ -1187,7 +1187,7 @@ _fail_: return ret; } -static int spi_sync_ext(int nint /* how mant interrupts to enable. */) +static int wilc_spi_sync_ext(int nint /* how mant interrupts to enable. */) { u32 reg; int ret, i; @@ -1202,13 +1202,13 @@ static int spi_sync_ext(int nint /* how mant interrupts to enable. */) /** * interrupt pin mux select **/ - ret = spi_read_reg(WILC_PIN_MUX_0, ®); + ret = wilc_spi_read_reg(WILC_PIN_MUX_0, ®); if (!ret) { PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_PIN_MUX_0); return 0; } reg |= BIT(8); - ret = spi_write_reg(WILC_PIN_MUX_0, reg); + ret = wilc_spi_write_reg(WILC_PIN_MUX_0, reg); if (!ret) { PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_PIN_MUX_0); return 0; @@ -1217,7 +1217,7 @@ static int spi_sync_ext(int nint /* how mant interrupts to enable. */) /** * interrupt enable **/ - ret = spi_read_reg(WILC_INTR_ENABLE, ®); + ret = wilc_spi_read_reg(WILC_INTR_ENABLE, ®); if (!ret) { PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_INTR_ENABLE); return 0; @@ -1226,13 +1226,13 @@ static int spi_sync_ext(int nint /* how mant interrupts to enable. */) for (i = 0; (i < 5) && (nint > 0); i++, nint--) { reg |= (BIT((27 + i))); } - ret = spi_write_reg(WILC_INTR_ENABLE, reg); + ret = wilc_spi_write_reg(WILC_INTR_ENABLE, reg); if (!ret) { PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_INTR_ENABLE); return 0; } if (nint) { - ret = spi_read_reg(WILC_INTR2_ENABLE, ®); + ret = wilc_spi_read_reg(WILC_INTR2_ENABLE, ®); if (!ret) { PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_INTR2_ENABLE); return 0; @@ -1242,7 +1242,7 @@ static int spi_sync_ext(int nint /* how mant interrupts to enable. */) reg |= BIT(i); } - ret = spi_read_reg(WILC_INTR2_ENABLE, ®); + ret = wilc_spi_read_reg(WILC_INTR2_ENABLE, ®); if (!ret) { PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_INTR2_ENABLE); return 0; @@ -1257,20 +1257,20 @@ static int spi_sync_ext(int nint /* how mant interrupts to enable. */) * ********************************************/ struct wilc_hif_func hif_spi = { - spi_init, - spi_deinit, - spi_read_reg, - spi_write_reg, - spi_read, - spi_write, - spi_sync, - spi_clear_int, - spi_read_int, - spi_clear_int_ext, - spi_read_size, - spi_write, - spi_read, - spi_sync_ext, - spi_max_bus_speed, - spi_default_bus_speed, + wilc_spi_init, + wilc_spi_deinit, + wilc_spi_read_reg, + wilc_spi_write_reg, + wilc_spi_read, + wilc_spi_write, + wilc_spi_sync, + wilc_spi_clear_int, + wilc_spi_read_int, + wilc_spi_clear_int_ext, + wilc_spi_read_size, + wilc_spi_write, + wilc_spi_read, + wilc_spi_sync_ext, + wilc_spi_max_bus_speed, + wilc_spi_default_bus_speed, }; From 5334bad035d8caa6d8c88401293234d450beefe1 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:09 +0900 Subject: [PATCH 313/843] staging: wilc1000: remove function pointer spi_tx of wilc_spi_t This patch removes function pointer spi_tx of wilc_spi_t and call linux_spi_write directly. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_spi.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index 946bda77827f..fd0d762b9931 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -10,10 +10,10 @@ #include #include "wilc_wlan_if.h" #include "wilc_wlan.h" +#include "linux_wlan_spi.h" typedef struct { void *os_context; - int (*spi_tx)(u8 *, u32); int (*spi_rx)(u8 *, u32); int (*spi_trx)(u8 *, u8 *, u32); int (*spi_max_speed)(void); @@ -211,7 +211,7 @@ static int spi_cmd(u8 cmd, u32 adr, u32 data, u32 sz, u8 clockless) else len -= 1; - if (!g_spi.spi_tx(bc, len)) { + if (!linux_spi_write(bc, len)) { PRINT_ER("[wilc spi]: Failed cmd write, bus error...\n"); result = N_FAIL; } @@ -709,7 +709,7 @@ static int spi_data_write(u8 *b, u32 sz) order = 0x2; } cmd |= order; - if (!g_spi.spi_tx(&cmd, 1)) { + if (!linux_spi_write(&cmd, 1)) { PRINT_ER("[wilc spi]: Failed data block cmd write, bus error...\n"); result = N_FAIL; break; @@ -718,7 +718,7 @@ static int spi_data_write(u8 *b, u32 sz) /** * Write data **/ - if (!g_spi.spi_tx(&b[ix], nbytes)) { + if (!linux_spi_write(&b[ix], nbytes)) { PRINT_ER("[wilc spi]: Failed data block write, bus error...\n"); result = N_FAIL; break; @@ -728,7 +728,7 @@ static int spi_data_write(u8 *b, u32 sz) * Write Crc **/ if (!g_spi.crc_off) { - if (!g_spi.spi_tx(crc, 2)) { + if (!linux_spi_write(crc, 2)) { PRINT_ER("[wilc spi]: Failed data block crc write, bus error...\n"); result = N_FAIL; break; @@ -977,7 +977,6 @@ static int wilc_spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func) } else { return 0; } - g_spi.spi_tx = inp->io_func.u.spi.spi_tx; g_spi.spi_rx = inp->io_func.u.spi.spi_rx; g_spi.spi_trx = inp->io_func.u.spi.spi_trx; g_spi.spi_max_speed = inp->io_func.u.spi.spi_max_speed; From 6cad576a89a99b41ff8b40a618a756f8ea54cb45 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:10 +0900 Subject: [PATCH 314/843] staging: wilc1000: remove function pointer spi_tx of wilc_wlan_io_function_t This patch removes function pointer spi_tx of wilc_wlan_io_func_t because it is not used anymore. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 1 - drivers/staging/wilc1000/wilc_wlan_if.h | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index b37ef4d02943..fb2fea574bf7 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -898,7 +898,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic) nwi->io_func.io_type = HIF_SPI; nwi->io_func.io_init = linux_spi_init; nwi->io_func.io_deinit = linux_spi_deinit; - nwi->io_func.u.spi.spi_tx = linux_spi_write; nwi->io_func.u.spi.spi_rx = linux_spi_read; nwi->io_func.u.spi.spi_trx = linux_spi_write_read; nwi->io_func.u.spi.spi_max_speed = linux_spi_set_max_speed; diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index 4568457d9820..4c05a46a722b 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -79,7 +79,6 @@ typedef struct { union { struct { int (*spi_max_speed)(void); - int (*spi_tx)(u8 *, u32); int (*spi_rx)(u8 *, u32); int (*spi_trx)(u8 *, u8 *, u32); } spi; From d3d02320b4ea420e1c833a64a8fe3195eedb6fd3 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:11 +0900 Subject: [PATCH 315/843] staging: wilc1000: remove function pointer spi_rx of wilc_spi_t This patch removes function pointer spi_rx of wilc_spi_t and just call linux_spi_read instead. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_spi.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index fd0d762b9931..f584d7e6cc08 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -14,7 +14,6 @@ typedef struct { void *os_context; - int (*spi_rx)(u8 *, u32); int (*spi_trx)(u8 *, u8 *, u32); int (*spi_max_speed)(void); wilc_debug_func dPrint; @@ -231,13 +230,13 @@ static int spi_cmd_rsp(u8 cmd) if ((cmd == CMD_RESET) || (cmd == CMD_TERMINATE) || (cmd == CMD_REPEAT)) { - if (!g_spi.spi_rx(&rsp, 1)) { + if (!linux_spi_read(&rsp, 1)) { result = N_FAIL; goto _fail_; } } - if (!g_spi.spi_rx(&rsp, 1)) { + if (!linux_spi_read(&rsp, 1)) { PRINT_ER("[wilc spi]: Failed cmd response read, bus error...\n"); result = N_FAIL; goto _fail_; @@ -252,7 +251,7 @@ static int spi_cmd_rsp(u8 cmd) /** * State response **/ - if (!g_spi.spi_rx(&rsp, 1)) { + if (!linux_spi_read(&rsp, 1)) { PRINT_ER("[wilc spi]: Failed cmd state read, bus error...\n"); result = N_FAIL; goto _fail_; @@ -524,7 +523,7 @@ static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless) /** * Read bytes **/ - if (!g_spi.spi_rx(&b[ix], nbytes)) { + if (!linux_spi_read(&b[ix], nbytes)) { PRINT_ER("[wilc spi]: Failed data block read, bus error...\n"); result = N_FAIL; goto _error_; @@ -534,7 +533,7 @@ static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless) * Read Crc **/ if (!g_spi.crc_off) { - if (!g_spi.spi_rx(crc, 2)) { + if (!linux_spi_read(crc, 2)) { PRINT_ER("[wilc spi]: Failed data block crc read, bus error...\n"); result = N_FAIL; goto _error_; @@ -565,7 +564,7 @@ static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless) **/ retry = 10; do { - if (!g_spi.spi_rx(&rsp, 1)) { + if (!linux_spi_read(&rsp, 1)) { PRINT_ER("[wilc spi]: Failed data response read, bus error...\n"); result = N_FAIL; break; @@ -581,7 +580,7 @@ static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless) /** * Read bytes **/ - if (!g_spi.spi_rx(&b[ix], nbytes)) { + if (!linux_spi_read(&b[ix], nbytes)) { PRINT_ER("[wilc spi]: Failed data block read, bus error...\n"); result = N_FAIL; break; @@ -591,7 +590,7 @@ static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless) * Read Crc **/ if (!g_spi.crc_off) { - if (!g_spi.spi_rx(crc, 2)) { + if (!linux_spi_read(crc, 2)) { PRINT_ER("[wilc spi]: Failed data block crc read, bus error...\n"); result = N_FAIL; break; @@ -629,7 +628,7 @@ static int spi_data_read(u8 *b, u32 sz) **/ retry = 10; do { - if (!g_spi.spi_rx(&rsp, 1)) { + if (!linux_spi_read(&rsp, 1)) { PRINT_ER("[wilc spi]: Failed data response read, bus error...\n"); result = N_FAIL; break; @@ -650,7 +649,7 @@ static int spi_data_read(u8 *b, u32 sz) /** * Read bytes **/ - if (!g_spi.spi_rx(&b[ix], nbytes)) { + if (!linux_spi_read(&b[ix], nbytes)) { PRINT_ER("[wilc spi]: Failed data block read, bus error...\n"); result = N_FAIL; break; @@ -660,7 +659,7 @@ static int spi_data_read(u8 *b, u32 sz) * Read Crc **/ if (!g_spi.crc_off) { - if (!g_spi.spi_rx(crc, 2)) { + if (!linux_spi_read(crc, 2)) { PRINT_ER("[wilc spi]: Failed data block crc read, bus error...\n"); result = N_FAIL; break; @@ -977,7 +976,6 @@ static int wilc_spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func) } else { return 0; } - g_spi.spi_rx = inp->io_func.u.spi.spi_rx; g_spi.spi_trx = inp->io_func.u.spi.spi_trx; g_spi.spi_max_speed = inp->io_func.u.spi.spi_max_speed; From b4b87a0b1278c872b0873ce285b25e60ca5bbe42 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:12 +0900 Subject: [PATCH 316/843] staging: wilc1000: remove function pointer spi_rx of wilc_wlan_io_func_t This patch removes spi_rx of wilc_wlan_io_func_t and it's related codes since it is not used anymore. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 1 - drivers/staging/wilc1000/wilc_wlan_if.h | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index fb2fea574bf7..7a207658b98c 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -898,7 +898,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic) nwi->io_func.io_type = HIF_SPI; nwi->io_func.io_init = linux_spi_init; nwi->io_func.io_deinit = linux_spi_deinit; - nwi->io_func.u.spi.spi_rx = linux_spi_read; nwi->io_func.u.spi.spi_trx = linux_spi_write_read; nwi->io_func.u.spi.spi_max_speed = linux_spi_set_max_speed; #endif diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index 4c05a46a722b..b820a113ad51 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -79,7 +79,6 @@ typedef struct { union { struct { int (*spi_max_speed)(void); - int (*spi_rx)(u8 *, u32); int (*spi_trx)(u8 *, u8 *, u32); } spi; } u; From fd9bf7bd4fac7ccb7a967918fe2c88e0e9f4a37d Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:13 +0900 Subject: [PATCH 317/843] staging: wilc1000: remove function pointer spi_trx This patch removes function pointer spi_trx and call linux_spi_write_read directly. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_spi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index f584d7e6cc08..789635b8c230 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -14,7 +14,6 @@ typedef struct { void *os_context; - int (*spi_trx)(u8 *, u8 *, u32); int (*spi_max_speed)(void); wilc_debug_func dPrint; int crc_off; @@ -408,7 +407,7 @@ static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless) } rix = len; - if (!g_spi.spi_trx(wb, rb, len2)) { + if (!linux_spi_write_read(wb, rb, len2)) { PRINT_ER("[wilc spi]: Failed cmd write, bus error...\n"); result = N_FAIL; return result; @@ -976,7 +975,6 @@ static int wilc_spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func) } else { return 0; } - g_spi.spi_trx = inp->io_func.u.spi.spi_trx; g_spi.spi_max_speed = inp->io_func.u.spi.spi_max_speed; /** From 6f617f22cfdc8c9e19c763c22bfde6f9eef27308 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:14 +0900 Subject: [PATCH 318/843] staging: wilc1000: remove spi_trx of wilc_wlan_io_func_t This patch removes spi_trx of wilc_wlan_io_func_t which is not used anymore. Delete it's related codes also. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 1 - drivers/staging/wilc1000/wilc_wlan_if.h | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 7a207658b98c..935314c54851 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -898,7 +898,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic) nwi->io_func.io_type = HIF_SPI; nwi->io_func.io_init = linux_spi_init; nwi->io_func.io_deinit = linux_spi_deinit; - nwi->io_func.u.spi.spi_trx = linux_spi_write_read; nwi->io_func.u.spi.spi_max_speed = linux_spi_set_max_speed; #endif } diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index b820a113ad51..be73b02e107f 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -79,7 +79,6 @@ typedef struct { union { struct { int (*spi_max_speed)(void); - int (*spi_trx)(u8 *, u8 *, u32); } spi; } u; } wilc_wlan_io_func_t; From fae26065d2d62404add16e26818e2506bd864ae4 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:15 +0900 Subject: [PATCH 319/843] staging: wilc1000: remove function pointer spi_max_speed This patch removes function pointer spi_max_speed of wilc_spi_t and just call the function linux_spi_set_max_speed directly. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_spi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index 789635b8c230..bda7b10a52a0 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -14,7 +14,6 @@ typedef struct { void *os_context; - int (*spi_max_speed)(void); wilc_debug_func dPrint; int crc_off; int nint; @@ -975,7 +974,6 @@ static int wilc_spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func) } else { return 0; } - g_spi.spi_max_speed = inp->io_func.u.spi.spi_max_speed; /** * configure protocol @@ -1025,7 +1023,7 @@ static int wilc_spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func) static void wilc_spi_max_bus_speed(void) { - g_spi.spi_max_speed(); + linux_spi_set_max_speed(); } static void wilc_spi_default_bus_speed(void) From d8dd29dd3f9bca34c1a79c5ba3da1a0e48dfbdc9 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:16 +0900 Subject: [PATCH 320/843] staging: wilc1000: remove spi_max_speed of wilc_wlan_io_func_t This patch removes spi_max_speed of wilc_wlan_io_func_t which is not used anymore and removes union u and struct spi, which does not have members in it. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 1 - drivers/staging/wilc1000/wilc_wlan_if.h | 5 ----- 2 files changed, 6 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 935314c54851..3aa636aba66f 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -898,7 +898,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic) nwi->io_func.io_type = HIF_SPI; nwi->io_func.io_init = linux_spi_init; nwi->io_func.io_deinit = linux_spi_deinit; - nwi->io_func.u.spi.spi_max_speed = linux_spi_set_max_speed; #endif } diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index be73b02e107f..0f15795c95ec 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -76,11 +76,6 @@ typedef struct { int io_type; int (*io_init)(void *); void (*io_deinit)(void *); - union { - struct { - int (*spi_max_speed)(void); - } spi; - } u; } wilc_wlan_io_func_t; #define WILC_MAC_INDICATE_STATUS 0x1 From 62342c7af7dd5c0f9c3a8c2c57d9afdf53d92507 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:17 +0900 Subject: [PATCH 321/843] staging: wilc1000: remove function pointer io_init This patch removes function pointer io_init of wilc_wlan_io_func_t and it's related codes, and call the function linux_spi_init directly. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 2 -- drivers/staging/wilc1000/wilc_spi.c | 8 +++----- drivers/staging/wilc1000/wilc_wlan_if.h | 1 - 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 3aa636aba66f..119f55d8b756 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -892,11 +892,9 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic) #ifdef WILC_SDIO nwi->io_func.io_type = HIF_SDIO; - nwi->io_func.io_init = linux_sdio_init; nwi->io_func.io_deinit = linux_sdio_deinit; #else nwi->io_func.io_type = HIF_SPI; - nwi->io_func.io_init = linux_spi_init; nwi->io_func.io_deinit = linux_spi_deinit; #endif } diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index bda7b10a52a0..30b1744f98f1 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -966,11 +966,9 @@ static int wilc_spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func) g_spi.dPrint = func; g_spi.os_context = inp->os_context.os_private; - if (inp->io_func.io_init) { - if (!inp->io_func.io_init(g_spi.os_context)) { - PRINT_ER("[wilc spi]: Failed io init bus...\n"); - return 0; - } + if (!linux_spi_init(g_spi.os_context)) { + PRINT_ER("[wilc spi]: Failed io init bus...\n"); + return 0; } else { return 0; } diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index 0f15795c95ec..d0b5bc3161e0 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -74,7 +74,6 @@ typedef struct { typedef struct { int io_type; - int (*io_init)(void *); void (*io_deinit)(void *); } wilc_wlan_io_func_t; From 060a8a23f51c4ccc0ec70619e8f70d93870ef081 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:18 +0900 Subject: [PATCH 322/843] staging: wilc1000: remove unused function pointer io_deinit This patch removes function pointer io_deinit which is never used, and delete it's related codes also. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 2 -- drivers/staging/wilc1000/wilc_wlan_if.h | 1 - 2 files changed, 3 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 119f55d8b756..00bc890f1662 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -892,10 +892,8 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic) #ifdef WILC_SDIO nwi->io_func.io_type = HIF_SDIO; - nwi->io_func.io_deinit = linux_sdio_deinit; #else nwi->io_func.io_type = HIF_SPI; - nwi->io_func.io_deinit = linux_spi_deinit; #endif } diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index d0b5bc3161e0..b43e439651b3 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -74,7 +74,6 @@ typedef struct { typedef struct { int io_type; - void (*io_deinit)(void *); } wilc_wlan_io_func_t; #define WILC_MAC_INDICATE_STATUS 0x1 From 4bffadb0446cdc46153f9a3055da5cf2288833da Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:19 +0900 Subject: [PATCH 323/843] staging: wilc1000: linux_sdio_init: remove parameter pv This patch removes function parameter pv which is not used and modify it's related codes. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan_sdio.c | 2 +- drivers/staging/wilc1000/linux_wlan_sdio.h | 2 +- drivers/staging/wilc1000/wilc_sdio.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index bf05e227778c..e854d376878f 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -214,7 +214,7 @@ static int linux_sdio_get_speed(void) return local_sdio_func->card->host->ios.clock; } -int linux_sdio_init(void *pv) +int linux_sdio_init(void) { /** diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h b/drivers/staging/wilc1000/linux_wlan_sdio.h index 4b515f5108e7..6f42bc75b507 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.h +++ b/drivers/staging/wilc1000/linux_wlan_sdio.h @@ -3,7 +3,7 @@ extern struct sdio_driver wilc_bus; #include -int linux_sdio_init(void *); +int linux_sdio_init(void); void linux_sdio_deinit(void *); int linux_sdio_cmd52(sdio_cmd52_t *cmd); int linux_sdio_cmd53(sdio_cmd53_t *cmd); diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index 0d88b6e46a02..01a8e5b71c80 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -562,7 +562,7 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func) g_sdio.dPrint = func; g_sdio.os_context = inp->os_context.os_private; - if (!linux_sdio_init(g_sdio.os_context)) { + if (!linux_sdio_init()) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed io init bus...\n"); return 0; } else { From 3f644285a8bd19916e580e892685881522916bab Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:20 +0900 Subject: [PATCH 324/843] staging: wilc1000: linux_spi_init: remove parameter vp This patch removes function parameter vp which is not used and modify it's related codes. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 2 +- drivers/staging/wilc1000/linux_wlan_spi.c | 2 +- drivers/staging/wilc1000/linux_wlan_spi.h | 2 +- drivers/staging/wilc1000/wilc_spi.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 00bc890f1662..fcc669c7a10f 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1566,7 +1566,7 @@ int wilc_netdev_init(struct wilc **wilc) } #ifndef WILC_SDIO - if (!linux_spi_init(&g_linux_wlan->wilc_spidev)) { + if (!linux_spi_init()) { PRINT_ER("Can't initialize SPI\n"); return -1; } diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index 039d06192d6b..73c788f602c0 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -93,7 +93,7 @@ void linux_spi_deinit(void *vp) -int linux_spi_init(void *vp) +int linux_spi_init(void) { int ret = 1; static int called; diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h b/drivers/staging/wilc1000/linux_wlan_spi.h index 7356785296f9..b9561003ecf0 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.h +++ b/drivers/staging/wilc1000/linux_wlan_spi.h @@ -5,7 +5,7 @@ extern struct spi_device *wilc_spi_dev; extern struct spi_driver wilc_bus; -int linux_spi_init(void *vp); +int linux_spi_init(void); void linux_spi_deinit(void *vp); int linux_spi_write(u8 *b, u32 len); int linux_spi_read(u8 *rb, u32 rlen); diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index 30b1744f98f1..fe16d705e841 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -966,7 +966,7 @@ static int wilc_spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func) g_spi.dPrint = func; g_spi.os_context = inp->os_context.os_private; - if (!linux_spi_init(g_spi.os_context)) { + if (!linux_spi_init()) { PRINT_ER("[wilc spi]: Failed io init bus...\n"); return 0; } else { From 64ae414fe2bcdc86a347056e20d377376fa45b4f Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:21 +0900 Subject: [PATCH 325/843] staging: wilc1000: remove os_context This patch removes variable os_context of wilc_sdio_t and wilc_spi_t because os_context is not used, and delete it's related code. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_sdio.c | 2 -- drivers/staging/wilc1000/wilc_spi.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index 01a8e5b71c80..a5307a7602c5 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -15,7 +15,6 @@ #define WILC_SDIO_BLOCK_SIZE 512 typedef struct { - void *os_context; u32 block_size; wilc_debug_func dPrint; int nint; @@ -560,7 +559,6 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func) memset(&g_sdio, 0, sizeof(wilc_sdio_t)); g_sdio.dPrint = func; - g_sdio.os_context = inp->os_context.os_private; if (!linux_sdio_init()) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed io init bus...\n"); diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index fe16d705e841..5a6bbfd4f5da 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -13,7 +13,6 @@ #include "linux_wlan_spi.h" typedef struct { - void *os_context; wilc_debug_func dPrint; int crc_off; int nint; @@ -965,7 +964,6 @@ static int wilc_spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func) memset(&g_spi, 0, sizeof(wilc_spi_t)); g_spi.dPrint = func; - g_spi.os_context = inp->os_context.os_private; if (!linux_spi_init()) { PRINT_ER("[wilc spi]: Failed io init bus...\n"); return 0; From 9c800322a56610bbdd80e6a859c412e65c5fc6eb Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:22 +0900 Subject: [PATCH 326/843] staging: wilc1000: change parameter type of hif_init This patch changes parameter type wilc_wlan_inp_t with struct wilc and modify it's related code. Pass wilc to the functions as well. wilc will be used in later patch. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_sdio.c | 3 ++- drivers/staging/wilc1000/wilc_spi.c | 3 ++- drivers/staging/wilc1000/wilc_wlan.c | 8 ++++++-- drivers/staging/wilc1000/wilc_wlan.h | 4 ++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index a5307a7602c5..8aacf55e5eb8 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -11,6 +11,7 @@ #include "wilc_wlan_if.h" #include "wilc_wlan.h" #include "linux_wlan_sdio.h" +#include "wilc_wfi_netdevice.h" #define WILC_SDIO_BLOCK_SIZE 512 @@ -550,7 +551,7 @@ static int sdio_sync(void) return 1; } -static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func) +static int sdio_init(struct wilc *wilc, wilc_debug_func func) { sdio_cmd52_t cmd; int loop; diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index 5a6bbfd4f5da..3741836dad41 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -11,6 +11,7 @@ #include "wilc_wlan_if.h" #include "wilc_wlan.h" #include "linux_wlan_spi.h" +#include "wilc_wfi_netdevice.h" typedef struct { wilc_debug_func dPrint; @@ -945,7 +946,7 @@ static int wilc_spi_sync(void) return 1; } -static int wilc_spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func) +static int wilc_spi_init(struct wilc *wilc, wilc_debug_func func) { u32 reg; u32 chipid; diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 2ce58702d705..9d257b06c853 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1655,6 +1655,10 @@ _fail_: int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) { int ret = 0; + perInterface_wlan_t *nic = netdev_priv(dev); + struct wilc *wilc; + + wilc = nic->wilc; PRINT_D(INIT_DBG, "Initializing WILC_Wlan ...\n"); @@ -1663,14 +1667,14 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) sizeof(wilc_wlan_io_func_t)); #ifdef WILC_SDIO - if (!hif_sdio.hif_init(inp, wilc_debug)) { + if (!hif_sdio.hif_init(wilc, wilc_debug)) { ret = -EIO; goto _fail_; } memcpy((void *)&g_wlan.hif_func, &hif_sdio, sizeof(struct wilc_hif_func)); #else - if (!hif_spi.hif_init(inp, wilc_debug)) { + if (!hif_spi.hif_init(wilc, wilc_debug)) { ret = -EIO; goto _fail_; } diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index ff4872f1e675..64fd019595ce 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -235,9 +235,9 @@ struct rxq_entry_t { * Host IF Structure * ********************************************/ - +struct wilc; struct wilc_hif_func { - int (*hif_init)(wilc_wlan_inp_t *, wilc_debug_func); + int (*hif_init)(struct wilc *, wilc_debug_func); int (*hif_deinit)(void *); int (*hif_read_reg)(u32, u32 *); int (*hif_write_reg)(u32, u32); From f7a34d9ceb78ffa84eb71c4859193f022b87b5bf Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 6 Nov 2015 18:40:23 +0900 Subject: [PATCH 327/843] staging: wilc1000: remove os_private This patch removes unused variable os_private and delete struct wilc_wlan_os_context_t since there is no members in it. Remove it's related code also. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 2 -- drivers/staging/wilc1000/wilc_wlan_if.h | 5 ----- 2 files changed, 7 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index fcc669c7a10f..086f1dbfb157 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -888,8 +888,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic) { PRINT_D(INIT_DBG, "Linux to Wlan services ...\n"); - nwi->os_context.os_private = (void *)nic; - #ifdef WILC_SDIO nwi->io_func.io_type = HIF_SDIO; #else diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index b43e439651b3..5980ece49daa 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -84,11 +84,6 @@ typedef struct { #define WILC_MAC_INDICATE_SCAN 0x2 typedef struct { - void *os_private; -} wilc_wlan_os_context_t; - -typedef struct { - wilc_wlan_os_context_t os_context; wilc_wlan_io_func_t io_func; } wilc_wlan_inp_t; From 0a5298cbf316df263664b94e7afdeaccb7451216 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Fri, 6 Nov 2015 19:11:10 +0900 Subject: [PATCH 328/843] staging: wilc1000: fix return type of host_int_del_beacon This patch changes return type of host_int_del_beacon from s32 to int. The result variable gets return value from wilc_mq_send that has return type of int. It should be changed return type of this function as well as data type of result variable. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 1a334aec0eb7..08384b0954cc 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4518,9 +4518,9 @@ ERRORHANDLER: return result; } -s32 host_int_del_beacon(struct host_if_drv *hif_drv) +int host_int_del_beacon(struct host_if_drv *hif_drv) { - s32 result = 0; + int result = 0; struct host_if_msg msg; if (!hif_drv) { diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index f70da7556a81..4457f9c07afb 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -377,7 +377,7 @@ s32 host_int_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval, u8 *pu8Head, u32 u32TailLen, u8 *pu8tail); -s32 host_int_del_beacon(struct host_if_drv *hWFIDrv); +int host_int_del_beacon(struct host_if_drv *hWFIDrv); s32 host_int_add_station(struct host_if_drv *hWFIDrv, struct add_sta_param *pstrStaParams); s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, From b6694df6756e3784c38b9f8f0a9bcdb6f934e13c Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Fri, 6 Nov 2015 19:11:11 +0900 Subject: [PATCH 329/843] staging: wilc1000: fix parameter name of host_int_del_beacon This patch changes struct host_if_drv of host_int_del_beacon function declaration from hWFIDrv to hif_drv. With this change, first parameter name of this function declaration and definition has same name as hif_drv. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 4457f9c07afb..1a27b88facab 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -377,7 +377,7 @@ s32 host_int_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval, u8 *pu8Head, u32 u32TailLen, u8 *pu8tail); -int host_int_del_beacon(struct host_if_drv *hWFIDrv); +int host_int_del_beacon(struct host_if_drv *hif_drv); s32 host_int_add_station(struct host_if_drv *hWFIDrv, struct add_sta_param *pstrStaParams); s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, From 79a0c0a8c4db5809854ce9419486f2cfd01212e5 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Fri, 6 Nov 2015 19:11:12 +0900 Subject: [PATCH 330/843] staging: wilc1000: fix return type of host_int_del_station This patch changes return type of host_int_del_station from s32 to int. The result variable gets return value from wilc_mq_send that has return type of int. It should be changed return type of this function as well as data type of result variable. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 08384b0954cc..0729811dfeb2 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4576,9 +4576,9 @@ s32 host_int_add_station(struct host_if_drv *hif_drv, return result; } -s32 host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr) +int host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr) { - s32 result = 0; + int result = 0; struct host_if_msg msg; struct del_sta *pstrDelStationMsg = &msg.body.del_sta_info; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 1a27b88facab..76e7c2f01566 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -382,7 +382,7 @@ s32 host_int_add_station(struct host_if_drv *hWFIDrv, struct add_sta_param *pstrStaParams); s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]); -s32 host_int_del_station(struct host_if_drv *hWFIDrv, const u8 *pu8MacAddr); +int host_int_del_station(struct host_if_drv *hWFIDrv, const u8 *pu8MacAddr); s32 host_int_edit_station(struct host_if_drv *hWFIDrv, struct add_sta_param *pstrStaParams); s32 host_int_set_power_mgmt(struct host_if_drv *hWFIDrv, From 994e7dc9134ee418eda48cf744e44ab19d3de4f8 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Fri, 6 Nov 2015 19:11:13 +0900 Subject: [PATCH 331/843] staging: wilc1000: fix parameter name of host_int_del_station This patch changes struct host_if_drv of host_int_del_station function declaration from hWFIDrv to hif_drv. With this change, first parameter name of this function declaration and definition has same name as hif_drv. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 76e7c2f01566..9d747469aae2 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -382,7 +382,7 @@ s32 host_int_add_station(struct host_if_drv *hWFIDrv, struct add_sta_param *pstrStaParams); s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]); -int host_int_del_station(struct host_if_drv *hWFIDrv, const u8 *pu8MacAddr); +int host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr); s32 host_int_edit_station(struct host_if_drv *hWFIDrv, struct add_sta_param *pstrStaParams); s32 host_int_set_power_mgmt(struct host_if_drv *hWFIDrv, From c9c4eb415d9541e3c48fc3103462e668c15c4870 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Fri, 6 Nov 2015 19:11:14 +0900 Subject: [PATCH 332/843] staging: wilc1000: rename pu8MacAddr in host_int_del_station This patch changes pu8MacAddr to mac_addr that is second argument of this function to avoid camelcase. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 6 +++--- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 0729811dfeb2..0e7d3db86a2a 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4576,7 +4576,7 @@ s32 host_int_add_station(struct host_if_drv *hif_drv, return result; } -int host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr) +int host_int_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr) { int result = 0; struct host_if_msg msg; @@ -4594,10 +4594,10 @@ int host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr) msg.id = HOST_IF_MSG_DEL_STATION; msg.drv = hif_drv; - if (!pu8MacAddr) + if (!mac_addr) eth_broadcast_addr(pstrDelStationMsg->mac_addr); else - memcpy(pstrDelStationMsg->mac_addr, pu8MacAddr, ETH_ALEN); + memcpy(pstrDelStationMsg->mac_addr, mac_addr, ETH_ALEN); result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 9d747469aae2..80562b5e57fb 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -382,7 +382,7 @@ s32 host_int_add_station(struct host_if_drv *hWFIDrv, struct add_sta_param *pstrStaParams); s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]); -int host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr); +int host_int_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr); s32 host_int_edit_station(struct host_if_drv *hWFIDrv, struct add_sta_param *pstrStaParams); s32 host_int_set_power_mgmt(struct host_if_drv *hWFIDrv, From c87fbede0fc852753c74e554206023b5d98b7cd7 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Fri, 6 Nov 2015 19:11:15 +0900 Subject: [PATCH 333/843] staging: wilc1000: rename pstrDelStationMsg in host_int_del_station This patch renames pstrDelStationMsg to del_sta_info to avoid camelcase. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 0e7d3db86a2a..047bb373f72d 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4580,7 +4580,7 @@ int host_int_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr) { int result = 0; struct host_if_msg msg; - struct del_sta *pstrDelStationMsg = &msg.body.del_sta_info; + struct del_sta *del_sta_info = &msg.body.del_sta_info; if (!hif_drv) { PRINT_ER("driver is null\n"); @@ -4595,9 +4595,9 @@ int host_int_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr) msg.drv = hif_drv; if (!mac_addr) - eth_broadcast_addr(pstrDelStationMsg->mac_addr); + eth_broadcast_addr(del_sta_info->mac_addr); else - memcpy(pstrDelStationMsg->mac_addr, mac_addr, ETH_ALEN); + memcpy(del_sta_info->mac_addr, mac_addr, ETH_ALEN); result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) From 18cfbd334e83e4716cabc7b278eb6aa52f0f97c0 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Fri, 6 Nov 2015 19:11:16 +0900 Subject: [PATCH 334/843] staging: wilc1000: fix return type of host_int_add_station This patch changes return type of host_int_add_station from s32 to int. The result variable gets return value from wilc_mq_send that has return type of int. It should be changed return type of this function as well as data type of result variable. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 047bb373f72d..10e394acd635 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4539,10 +4539,10 @@ int host_int_del_beacon(struct host_if_drv *hif_drv) return result; } -s32 host_int_add_station(struct host_if_drv *hif_drv, +int host_int_add_station(struct host_if_drv *hif_drv, struct add_sta_param *pstrStaParams) { - s32 result = 0; + int result = 0; struct host_if_msg msg; struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 80562b5e57fb..81ebfcf5bfd9 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -378,7 +378,7 @@ s32 host_int_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval, u32 u32TailLen, u8 *pu8tail); int host_int_del_beacon(struct host_if_drv *hif_drv); -s32 host_int_add_station(struct host_if_drv *hWFIDrv, +int host_int_add_station(struct host_if_drv *hWFIDrv, struct add_sta_param *pstrStaParams); s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]); From 261de713b9e4c55057d7053a08fe148519ee710c Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Fri, 6 Nov 2015 19:11:17 +0900 Subject: [PATCH 335/843] staging: wilc1000: fix parameter name of host_int_add_station This patch changes struct host_if_drv of host_int_add_station function declaration from hWFIDrv to hif_drv. With this change, first parameter of this function declaration and definition has same name as hif_drv. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 81ebfcf5bfd9..adb201be7af3 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -378,7 +378,7 @@ s32 host_int_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval, u32 u32TailLen, u8 *pu8tail); int host_int_del_beacon(struct host_if_drv *hif_drv); -int host_int_add_station(struct host_if_drv *hWFIDrv, +int host_int_add_station(struct host_if_drv *hif_drv, struct add_sta_param *pstrStaParams); s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]); From e33785470d26fdae12f453426cc5bb68771a69c3 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Fri, 6 Nov 2015 19:11:18 +0900 Subject: [PATCH 336/843] staging: wilc1000: rename pstrStaParams in host_int_add_station This patch renames pstrStaParams to sta_param to avoid camelcase. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 6 +++--- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 10e394acd635..cce95177b515 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4540,7 +4540,7 @@ int host_int_del_beacon(struct host_if_drv *hif_drv) } int host_int_add_station(struct host_if_drv *hif_drv, - struct add_sta_param *pstrStaParams) + struct add_sta_param *sta_param) { int result = 0; struct host_if_msg msg; @@ -4558,14 +4558,14 @@ int host_int_add_station(struct host_if_drv *hif_drv, msg.id = HOST_IF_MSG_ADD_STATION; msg.drv = hif_drv; - memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param)); + memcpy(pstrAddStationMsg, sta_param, sizeof(struct add_sta_param)); if (pstrAddStationMsg->rates_len > 0) { u8 *rates = kmalloc(pstrAddStationMsg->rates_len, GFP_KERNEL); if (!rates) return -ENOMEM; - memcpy(rates, pstrStaParams->rates, + memcpy(rates, sta_param->rates, pstrAddStationMsg->rates_len); pstrAddStationMsg->rates = rates; } diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index adb201be7af3..57e1d424afdc 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -379,7 +379,7 @@ s32 host_int_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval, u8 *pu8tail); int host_int_del_beacon(struct host_if_drv *hif_drv); int host_int_add_station(struct host_if_drv *hif_drv, - struct add_sta_param *pstrStaParams); + struct add_sta_param *sta_param); s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]); int host_int_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr); From 773e02e696b1926d85627a901375453d46d12262 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Fri, 6 Nov 2015 19:11:19 +0900 Subject: [PATCH 337/843] staging: wilc1000: rename pstrAddStationMsg in host_int_add_station This patch renames pstrAddStationMsg to add_sta_info to avoid camelcase. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index cce95177b515..b870809037b1 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4544,7 +4544,7 @@ int host_int_add_station(struct host_if_drv *hif_drv, { int result = 0; struct host_if_msg msg; - struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info; + struct add_sta_param *add_sta_info = &msg.body.add_sta_info; if (!hif_drv) { PRINT_ER("driver is null\n"); @@ -4558,16 +4558,16 @@ int host_int_add_station(struct host_if_drv *hif_drv, msg.id = HOST_IF_MSG_ADD_STATION; msg.drv = hif_drv; - memcpy(pstrAddStationMsg, sta_param, sizeof(struct add_sta_param)); - if (pstrAddStationMsg->rates_len > 0) { - u8 *rates = kmalloc(pstrAddStationMsg->rates_len, GFP_KERNEL); + memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param)); + if (add_sta_info->rates_len > 0) { + u8 *rates = kmalloc(add_sta_info->rates_len, GFP_KERNEL); if (!rates) return -ENOMEM; memcpy(rates, sta_param->rates, - pstrAddStationMsg->rates_len); - pstrAddStationMsg->rates = rates; + add_sta_info->rates_len); + add_sta_info->rates = rates; } result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); From 7897bd00f6b5e69443ceffc7900faaafc23455b0 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Fri, 6 Nov 2015 19:11:20 +0900 Subject: [PATCH 338/843] staging: wilc1000: use kmemdup in host_int_add_station This patch replaces kmalloc followed by memcpy with kmemdup. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index b870809037b1..db7060f2ba12 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4560,13 +4560,11 @@ int host_int_add_station(struct host_if_drv *hif_drv, memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param)); if (add_sta_info->rates_len > 0) { - u8 *rates = kmalloc(add_sta_info->rates_len, GFP_KERNEL); - + u8 *rates = kmemdup(sta_param->rates, + add_sta_info->rates_len, + GFP_KERNEL); if (!rates) return -ENOMEM; - - memcpy(rates, sta_param->rates, - add_sta_info->rates_len); add_sta_info->rates = rates; } From 9062305b902d9daadf1ca34d32df40858d82a2c9 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Fri, 6 Nov 2015 19:11:21 +0900 Subject: [PATCH 339/843] staging: wilc1000: remove rates variable in host_int_add_station Instead of using rates variable, it is used as add_sta_info->rates directly. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index db7060f2ba12..d5b7725ec2bf 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4560,12 +4560,11 @@ int host_int_add_station(struct host_if_drv *hif_drv, memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param)); if (add_sta_info->rates_len > 0) { - u8 *rates = kmemdup(sta_param->rates, - add_sta_info->rates_len, - GFP_KERNEL); - if (!rates) + add_sta_info->rates = kmemdup(sta_param->rates, + add_sta_info->rates_len, + GFP_KERNEL); + if (!add_sta_info->rates) return -ENOMEM; - add_sta_info->rates = rates; } result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); From 9e10af4787ac5164345c89ba5118686b4463857d Mon Sep 17 00:00:00 2001 From: Ira Weiny Date: Fri, 30 Oct 2015 18:58:40 -0400 Subject: [PATCH 340/843] staging/rdma/hfi1: Remove file pointer macros Remove the following macros in favor of explicit use of struct hfi1_filedata and various sub structures. ctxt_fp subctxt_fp tidcursor_fp user_sdma_pkt_fp user_sdma_comp_fp Reviewed-by: Mitko Haralanov Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/file_ops.c | 124 ++++++++++++++------------ drivers/staging/rdma/hfi1/hfi.h | 12 --- drivers/staging/rdma/hfi1/user_sdma.c | 34 +++---- 3 files changed, 84 insertions(+), 86 deletions(-) diff --git a/drivers/staging/rdma/hfi1/file_ops.c b/drivers/staging/rdma/hfi1/file_ops.c index aae9826ec62b..f78bcf673252 100644 --- a/drivers/staging/rdma/hfi1/file_ops.c +++ b/drivers/staging/rdma/hfi1/file_ops.c @@ -204,7 +204,8 @@ static ssize_t hfi1_file_write(struct file *fp, const char __user *data, size_t count, loff_t *offset) { const struct hfi1_cmd __user *ucmd; - struct hfi1_ctxtdata *uctxt = ctxt_fp(fp); + struct hfi1_filedata *fd = fp->private_data; + struct hfi1_ctxtdata *uctxt = fd->uctxt; struct hfi1_cmd cmd; struct hfi1_user_info uinfo; struct hfi1_tid_info tinfo; @@ -338,17 +339,17 @@ static ssize_t hfi1_file_write(struct file *fp, const char __user *data, ret = exp_tid_free(fp, &tinfo); break; case HFI1_CMD_RECV_CTRL: - ret = manage_rcvq(uctxt, subctxt_fp(fp), (int)user_val); + ret = manage_rcvq(uctxt, fd->subctxt, (int)user_val); break; case HFI1_CMD_POLL_TYPE: uctxt->poll_type = (typeof(uctxt->poll_type))user_val; break; case HFI1_CMD_ACK_EVENT: - ret = user_event_ack(uctxt, subctxt_fp(fp), user_val); + ret = user_event_ack(uctxt, fd->subctxt, user_val); break; case HFI1_CMD_SET_PKEY: if (HFI1_CAP_IS_USET(PKEY_CHECK)) - ret = set_ctxt_pkey(uctxt, subctxt_fp(fp), user_val); + ret = set_ctxt_pkey(uctxt, fd->subctxt, user_val); else ret = -EPERM; break; @@ -431,13 +432,13 @@ bail: static ssize_t hfi1_write_iter(struct kiocb *kiocb, struct iov_iter *from) { - struct hfi1_user_sdma_pkt_q *pq; - struct hfi1_user_sdma_comp_q *cq; + struct hfi1_filedata *fd = kiocb->ki_filp->private_data; + struct hfi1_user_sdma_pkt_q *pq = fd->pq; + struct hfi1_user_sdma_comp_q *cq = fd->cq; int ret = 0, done = 0, reqs = 0; unsigned long dim = from->nr_segs; - if (!user_sdma_comp_fp(kiocb->ki_filp) || - !user_sdma_pkt_fp(kiocb->ki_filp)) { + if (!cq || !pq) { ret = -EIO; goto done; } @@ -448,10 +449,7 @@ static ssize_t hfi1_write_iter(struct kiocb *kiocb, struct iov_iter *from) } hfi1_cdbg(SDMA, "SDMA request from %u:%u (%lu)", - ctxt_fp(kiocb->ki_filp)->ctxt, subctxt_fp(kiocb->ki_filp), - dim); - pq = user_sdma_pkt_fp(kiocb->ki_filp); - cq = user_sdma_comp_fp(kiocb->ki_filp); + fd->uctxt->ctxt, fd->subctxt, dim); if (atomic_read(&pq->n_reqs) == pq->n_max_reqs) { ret = -ENOSPC; @@ -476,7 +474,8 @@ done: static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma) { - struct hfi1_ctxtdata *uctxt; + struct hfi1_filedata *fd = fp->private_data; + struct hfi1_ctxtdata *uctxt = fd->uctxt; struct hfi1_devdata *dd; unsigned long flags, pfn; u64 token = vma->vm_pgoff << PAGE_SHIFT, @@ -486,7 +485,6 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma) int ret = 0; u16 ctxt; - uctxt = ctxt_fp(fp); if (!is_valid_mmap(token) || !uctxt || !(vma->vm_flags & VM_SHARED)) { ret = -EINVAL; @@ -496,7 +494,7 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma) ctxt = HFI1_MMAP_TOKEN_GET(CTXT, token); subctxt = HFI1_MMAP_TOKEN_GET(SUBCTXT, token); type = HFI1_MMAP_TOKEN_GET(TYPE, token); - if (ctxt != uctxt->ctxt || subctxt != subctxt_fp(fp)) { + if (ctxt != uctxt->ctxt || subctxt != fd->subctxt) { ret = -EINVAL; goto done; } @@ -660,13 +658,12 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma) vmf = 1; break; case SDMA_COMP: { - struct hfi1_user_sdma_comp_q *cq; + struct hfi1_user_sdma_comp_q *cq = fd->cq; - if (!user_sdma_comp_fp(fp)) { + if (!cq) { ret = -EFAULT; goto done; } - cq = user_sdma_comp_fp(fp); memaddr = (u64)cq->comps; memlen = ALIGN(sizeof(*cq->comps) * cq->nentries, PAGE_SIZE); flags |= VM_IO | VM_DONTEXPAND; @@ -680,7 +677,7 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma) if ((vma->vm_end - vma->vm_start) != memlen) { hfi1_cdbg(PROC, "%u:%u Memory size mismatch %lu:%lu", - uctxt->ctxt, subctxt_fp(fp), + uctxt->ctxt, fd->subctxt, (vma->vm_end - vma->vm_start), memlen); ret = -EINVAL; goto done; @@ -730,7 +727,7 @@ static unsigned int hfi1_poll(struct file *fp, struct poll_table_struct *pt) struct hfi1_ctxtdata *uctxt; unsigned pollflag; - uctxt = ctxt_fp(fp); + uctxt = ((struct hfi1_filedata *)fp->private_data)->uctxt; if (!uctxt) pollflag = POLLERR; else if (uctxt->poll_type == HFI1_POLL_TYPE_URGENT) @@ -930,6 +927,7 @@ static int find_shared_ctxt(struct file *fp, { int devmax, ndev, i; int ret = 0; + struct hfi1_filedata *fd = fp->private_data; devmax = hfi1_count_units(NULL, NULL); @@ -959,10 +957,10 @@ static int find_shared_ctxt(struct file *fp, ret = -EINVAL; goto done; } - ctxt_fp(fp) = uctxt; - subctxt_fp(fp) = uctxt->cnt++; - uctxt->subpid[subctxt_fp(fp)] = current->pid; - uctxt->active_slaves |= 1 << subctxt_fp(fp); + fd->uctxt = uctxt; + fd->subctxt = uctxt->cnt++; + uctxt->subpid[fd->subctxt] = current->pid; + uctxt->active_slaves |= 1 << fd->subctxt; ret = 1; goto done; } @@ -975,6 +973,7 @@ done: static int allocate_ctxt(struct file *fp, struct hfi1_devdata *dd, struct hfi1_user_info *uinfo) { + struct hfi1_filedata *fd = fp->private_data; struct hfi1_ctxtdata *uctxt; unsigned ctxt; int ret; @@ -1022,7 +1021,7 @@ static int allocate_ctxt(struct file *fp, struct hfi1_devdata *dd, * This has to be done here so the rest of the sub-contexts find the * proper master. */ - if (uinfo->subctxt_cnt && !subctxt_fp(fp)) { + if (uinfo->subctxt_cnt && !fd->subctxt) { ret = init_subctxts(uctxt, uinfo); /* * On error, we don't need to disable and de-allocate the @@ -1042,7 +1041,7 @@ static int allocate_ctxt(struct file *fp, struct hfi1_devdata *dd, spin_lock_init(&uctxt->sdma_qlock); hfi1_stats.sps_ctxts++; dd->freectxts--; - ctxt_fp(fp) = uctxt; + fd->uctxt = uctxt; return 0; } @@ -1106,7 +1105,8 @@ static int user_init(struct file *fp) { int ret; unsigned int rcvctrl_ops = 0; - struct hfi1_ctxtdata *uctxt = ctxt_fp(fp); + struct hfi1_filedata *fd = fp->private_data; + struct hfi1_ctxtdata *uctxt = fd->uctxt; /* make sure that the context has already been setup */ if (!test_bit(HFI1_CTXT_SETUP_DONE, &uctxt->event_flags)) { @@ -1118,7 +1118,7 @@ static int user_init(struct file *fp) * Subctxts don't need to initialize anything since master * has done it. */ - if (subctxt_fp(fp)) { + if (fd->subctxt) { ret = wait_event_interruptible(uctxt->wait, !test_bit(HFI1_CTXT_MASTER_UNINIT, &uctxt->event_flags)); @@ -1178,8 +1178,8 @@ done: static int get_ctxt_info(struct file *fp, void __user *ubase, __u32 len) { struct hfi1_ctxt_info cinfo; - struct hfi1_ctxtdata *uctxt = ctxt_fp(fp); struct hfi1_filedata *fd = fp->private_data; + struct hfi1_ctxtdata *uctxt = fd->uctxt; int ret = 0; memset(&cinfo, 0, sizeof(cinfo)); @@ -1189,7 +1189,7 @@ static int get_ctxt_info(struct file *fp, void __user *ubase, __u32 len) cinfo.num_active = hfi1_count_active_units(); cinfo.unit = uctxt->dd->unit; cinfo.ctxt = uctxt->ctxt; - cinfo.subctxt = subctxt_fp(fp); + cinfo.subctxt = fd->subctxt; cinfo.rcvtids = roundup(uctxt->egrbufs.alloced, uctxt->dd->rcv_entries.group_size) + uctxt->expected_count; @@ -1201,10 +1201,10 @@ static int get_ctxt_info(struct file *fp, void __user *ubase, __u32 len) cinfo.egrtids = uctxt->egrbufs.alloced; cinfo.rcvhdrq_cnt = uctxt->rcvhdrq_cnt; cinfo.rcvhdrq_entsize = uctxt->rcvhdrqentsize << 2; - cinfo.sdma_ring_size = user_sdma_comp_fp(fp)->nentries; + cinfo.sdma_ring_size = fd->cq->nentries; cinfo.rcvegr_size = uctxt->egrbufs.rcvtid_size; - trace_hfi1_ctxt_info(uctxt->dd, uctxt->ctxt, subctxt_fp(fp), cinfo); + trace_hfi1_ctxt_info(uctxt->dd, uctxt->ctxt, fd->subctxt, cinfo); if (copy_to_user(ubase, &cinfo, sizeof(cinfo))) ret = -EFAULT; done: @@ -1213,7 +1213,8 @@ done: static int setup_ctxt(struct file *fp) { - struct hfi1_ctxtdata *uctxt = ctxt_fp(fp); + struct hfi1_filedata *fd = fp->private_data; + struct hfi1_ctxtdata *uctxt = fd->uctxt; struct hfi1_devdata *dd = uctxt->dd; int ret = 0; @@ -1222,7 +1223,7 @@ static int setup_ctxt(struct file *fp) * programming of eager buffers. This is done if context sharing * is not requested or by the master process. */ - if (!uctxt->subctxt_cnt || !subctxt_fp(fp)) { + if (!uctxt->subctxt_cnt || !fd->subctxt) { ret = hfi1_init_ctxt(uctxt->sc); if (ret) goto done; @@ -1234,7 +1235,7 @@ static int setup_ctxt(struct file *fp) ret = hfi1_setup_eagerbufs(uctxt); if (ret) goto done; - if (uctxt->subctxt_cnt && !subctxt_fp(fp)) { + if (uctxt->subctxt_cnt && !fd->subctxt) { ret = setup_subctxt(uctxt); if (ret) goto done; @@ -1277,7 +1278,7 @@ static int setup_ctxt(struct file *fp) uctxt->tidusemap[uctxt->tidmapcnt - 1] = ~((1ULL << (uctxt->numtidgroups % BITS_PER_LONG)) - 1); - trace_hfi1_exp_tid_map(uctxt->ctxt, subctxt_fp(fp), 0, + trace_hfi1_exp_tid_map(uctxt->ctxt, fd->subctxt, 0, uctxt->tidusemap, uctxt->tidmapcnt); } ret = hfi1_user_sdma_alloc_queues(uctxt, fp); @@ -1292,7 +1293,8 @@ done: static int get_base_info(struct file *fp, void __user *ubase, __u32 len) { struct hfi1_base_info binfo; - struct hfi1_ctxtdata *uctxt = ctxt_fp(fp); + struct hfi1_filedata *fd = fp->private_data; + struct hfi1_ctxtdata *uctxt = fd->uctxt; struct hfi1_devdata *dd = uctxt->dd; ssize_t sz; unsigned offset; @@ -1314,50 +1316,50 @@ static int get_base_info(struct file *fp, void __user *ubase, __u32 len) offset = ((u64)uctxt->sc->hw_free - (u64)dd->cr_base[uctxt->numa_id].va) % PAGE_SIZE; binfo.sc_credits_addr = HFI1_MMAP_TOKEN(PIO_CRED, uctxt->ctxt, - subctxt_fp(fp), offset); + fd->subctxt, offset); binfo.pio_bufbase = HFI1_MMAP_TOKEN(PIO_BUFS, uctxt->ctxt, - subctxt_fp(fp), + fd->subctxt, uctxt->sc->base_addr); binfo.pio_bufbase_sop = HFI1_MMAP_TOKEN(PIO_BUFS_SOP, uctxt->ctxt, - subctxt_fp(fp), + fd->subctxt, uctxt->sc->base_addr); binfo.rcvhdr_bufbase = HFI1_MMAP_TOKEN(RCV_HDRQ, uctxt->ctxt, - subctxt_fp(fp), + fd->subctxt, uctxt->rcvhdrq); binfo.rcvegr_bufbase = HFI1_MMAP_TOKEN(RCV_EGRBUF, uctxt->ctxt, - subctxt_fp(fp), + fd->subctxt, uctxt->egrbufs.rcvtids[0].phys); binfo.sdma_comp_bufbase = HFI1_MMAP_TOKEN(SDMA_COMP, uctxt->ctxt, - subctxt_fp(fp), 0); + fd->subctxt, 0); /* * user regs are at * (RXE_PER_CONTEXT_USER + (ctxt * RXE_PER_CONTEXT_SIZE)) */ binfo.user_regbase = HFI1_MMAP_TOKEN(UREGS, uctxt->ctxt, - subctxt_fp(fp), 0); + fd->subctxt, 0); offset = offset_in_page((((uctxt->ctxt - dd->first_user_ctxt) * - HFI1_MAX_SHARED_CTXTS) + subctxt_fp(fp)) * + HFI1_MAX_SHARED_CTXTS) + fd->subctxt) * sizeof(*dd->events)); binfo.events_bufbase = HFI1_MMAP_TOKEN(EVENTS, uctxt->ctxt, - subctxt_fp(fp), + fd->subctxt, offset); binfo.status_bufbase = HFI1_MMAP_TOKEN(STATUS, uctxt->ctxt, - subctxt_fp(fp), + fd->subctxt, dd->status); if (HFI1_CAP_IS_USET(DMA_RTAIL)) binfo.rcvhdrtail_base = HFI1_MMAP_TOKEN(RTAIL, uctxt->ctxt, - subctxt_fp(fp), 0); + fd->subctxt, 0); if (uctxt->subctxt_cnt) { binfo.subctxt_uregbase = HFI1_MMAP_TOKEN(SUBCTXT_UREGS, uctxt->ctxt, - subctxt_fp(fp), 0); + fd->subctxt, 0); binfo.subctxt_rcvhdrbuf = HFI1_MMAP_TOKEN(SUBCTXT_RCV_HDRQ, uctxt->ctxt, - subctxt_fp(fp), 0); + fd->subctxt, 0); binfo.subctxt_rcvegrbuf = HFI1_MMAP_TOKEN(SUBCTXT_EGRBUF, uctxt->ctxt, - subctxt_fp(fp), 0); + fd->subctxt, 0); } sz = (len < sizeof(binfo)) ? len : sizeof(binfo); if (copy_to_user(ubase, &binfo, sz)) @@ -1368,7 +1370,8 @@ static int get_base_info(struct file *fp, void __user *ubase, __u32 len) static unsigned int poll_urgent(struct file *fp, struct poll_table_struct *pt) { - struct hfi1_ctxtdata *uctxt = ctxt_fp(fp); + struct hfi1_filedata *fd = fp->private_data; + struct hfi1_ctxtdata *uctxt = fd->uctxt; struct hfi1_devdata *dd = uctxt->dd; unsigned pollflag; @@ -1390,7 +1393,8 @@ static unsigned int poll_urgent(struct file *fp, static unsigned int poll_next(struct file *fp, struct poll_table_struct *pt) { - struct hfi1_ctxtdata *uctxt = ctxt_fp(fp); + struct hfi1_filedata *fd = fp->private_data; + struct hfi1_ctxtdata *uctxt = fd->uctxt; struct hfi1_devdata *dd = uctxt->dd; unsigned pollflag; @@ -1562,7 +1566,8 @@ static inline unsigned num_free_groups(unsigned long map, u16 *start) static int exp_tid_setup(struct file *fp, struct hfi1_tid_info *tinfo) { int ret = 0; - struct hfi1_ctxtdata *uctxt = ctxt_fp(fp); + struct hfi1_filedata *fd = fp->private_data; + struct hfi1_ctxtdata *uctxt = fd->uctxt; struct hfi1_devdata *dd = uctxt->dd; unsigned tid, mapped = 0, npages, ngroups, exp_groups, tidpairs = uctxt->expected_count / 2; @@ -1718,7 +1723,7 @@ static int exp_tid_setup(struct file *fp, struct hfi1_tid_info *tinfo) pages[pmapped], 0, tidsize, PCI_DMA_FROMDEVICE); trace_hfi1_exp_rcv_set(uctxt->ctxt, - subctxt_fp(fp), + fd->subctxt, tid, vaddr, phys[pmapped], pages[pmapped]); @@ -1763,7 +1768,7 @@ static int exp_tid_setup(struct file *fp, struct hfi1_tid_info *tinfo) (((useidx & 0xffffff) << 16) | ((bitidx + bits_used) & 0xffffff))); } - trace_hfi1_exp_tid_map(uctxt->ctxt, subctxt_fp(fp), 0, uctxt->tidusemap, + trace_hfi1_exp_tid_map(uctxt->ctxt, fd->subctxt, 0, uctxt->tidusemap, uctxt->tidmapcnt); done: @@ -1792,7 +1797,8 @@ bail: static int exp_tid_free(struct file *fp, struct hfi1_tid_info *tinfo) { - struct hfi1_ctxtdata *uctxt = ctxt_fp(fp); + struct hfi1_filedata *fd = fp->private_data; + struct hfi1_ctxtdata *uctxt = fd->uctxt; struct hfi1_devdata *dd = uctxt->dd; unsigned long tidmap[uctxt->tidmapcnt]; struct page **pages; @@ -1828,7 +1834,7 @@ static int exp_tid_free(struct file *fp, struct hfi1_tid_info *tinfo) hfi1_put_tid(dd, tid, PT_INVALID, 0, 0); trace_hfi1_exp_rcv_free(uctxt->ctxt, - subctxt_fp(fp), + fd->subctxt, tid, phys[i], pages[i]); pci_unmap_page(dd->pcidev, phys[i], @@ -1845,7 +1851,7 @@ static int exp_tid_free(struct file *fp, struct hfi1_tid_info *tinfo) map &= ~(1ULL<ctxt, subctxt_fp(fp), 1, uctxt->tidusemap, + trace_hfi1_exp_tid_map(uctxt->ctxt, fd->subctxt, 1, uctxt->tidusemap, uctxt->tidmapcnt); done: return ret; diff --git a/drivers/staging/rdma/hfi1/hfi.h b/drivers/staging/rdma/hfi1/hfi.h index 73bd966f9e41..31c11852d4c0 100644 --- a/drivers/staging/rdma/hfi1/hfi.h +++ b/drivers/staging/rdma/hfi1/hfi.h @@ -1423,18 +1423,6 @@ int snoop_send_pio_handler(struct hfi1_qp *qp, struct ahg_ib_header *ibhdr, void snoop_inline_pio_send(struct hfi1_devdata *dd, struct pio_buf *pbuf, u64 pbc, const void *from, size_t count); -/* for use in system calls, where we want to know device type, etc. */ -#define ctxt_fp(fp) \ - (((struct hfi1_filedata *)(fp)->private_data)->uctxt) -#define subctxt_fp(fp) \ - (((struct hfi1_filedata *)(fp)->private_data)->subctxt) -#define tidcursor_fp(fp) \ - (((struct hfi1_filedata *)(fp)->private_data)->tidcursor) -#define user_sdma_pkt_fp(fp) \ - (((struct hfi1_filedata *)(fp)->private_data)->pq) -#define user_sdma_comp_fp(fp) \ - (((struct hfi1_filedata *)(fp)->private_data)->cq) - static inline struct hfi1_devdata *dd_from_ppd(struct hfi1_pportdata *ppd) { return ppd->dd; diff --git a/drivers/staging/rdma/hfi1/user_sdma.c b/drivers/staging/rdma/hfi1/user_sdma.c index 36c838dcf023..be7a4e53335f 100644 --- a/drivers/staging/rdma/hfi1/user_sdma.c +++ b/drivers/staging/rdma/hfi1/user_sdma.c @@ -352,6 +352,7 @@ static void sdma_kmem_cache_ctor(void *obj) int hfi1_user_sdma_alloc_queues(struct hfi1_ctxtdata *uctxt, struct file *fp) { + struct hfi1_filedata *fd; int ret = 0; unsigned memsize; char buf[64]; @@ -365,6 +366,8 @@ int hfi1_user_sdma_alloc_queues(struct hfi1_ctxtdata *uctxt, struct file *fp) goto done; } + fd = fp->private_data; + if (!hfi1_sdma_comp_ring_size) { ret = -EINVAL; goto done; @@ -384,7 +387,7 @@ int hfi1_user_sdma_alloc_queues(struct hfi1_ctxtdata *uctxt, struct file *fp) INIT_LIST_HEAD(&pq->list); pq->dd = dd; pq->ctxt = uctxt->ctxt; - pq->subctxt = subctxt_fp(fp); + pq->subctxt = fd->subctxt; pq->n_max_reqs = hfi1_sdma_comp_ring_size; pq->state = SDMA_PKT_Q_INACTIVE; atomic_set(&pq->n_reqs, 0); @@ -393,7 +396,7 @@ int hfi1_user_sdma_alloc_queues(struct hfi1_ctxtdata *uctxt, struct file *fp) activate_packet_queue); pq->reqidx = 0; snprintf(buf, 64, "txreq-kmem-cache-%u-%u-%u", dd->unit, uctxt->ctxt, - subctxt_fp(fp)); + fd->subctxt); pq->txreq_cache = kmem_cache_create(buf, sizeof(struct user_sdma_txreq), L1_CACHE_BYTES, @@ -404,7 +407,7 @@ int hfi1_user_sdma_alloc_queues(struct hfi1_ctxtdata *uctxt, struct file *fp) uctxt->ctxt); goto pq_txreq_nomem; } - user_sdma_pkt_fp(fp) = pq; + fd->pq = pq; cq = kzalloc(sizeof(*cq), GFP_KERNEL); if (!cq) goto cq_nomem; @@ -416,7 +419,7 @@ int hfi1_user_sdma_alloc_queues(struct hfi1_ctxtdata *uctxt, struct file *fp) goto cq_comps_nomem; cq->nentries = hfi1_sdma_comp_ring_size; - user_sdma_comp_fp(fp) = cq; + fd->cq = cq; spin_lock_irqsave(&uctxt->sdma_qlock, flags); list_add(&pq->list, &uctxt->sdma_queues); @@ -431,7 +434,7 @@ pq_txreq_nomem: kfree(pq->reqs); pq_reqs_nomem: kfree(pq); - user_sdma_pkt_fp(fp) = NULL; + fd->pq = NULL; pq_nomem: ret = -ENOMEM; done: @@ -485,9 +488,10 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec, unsigned long dim, unsigned long *count) { int ret = 0, i = 0, sent; - struct hfi1_ctxtdata *uctxt = ctxt_fp(fp); - struct hfi1_user_sdma_pkt_q *pq = user_sdma_pkt_fp(fp); - struct hfi1_user_sdma_comp_q *cq = user_sdma_comp_fp(fp); + struct hfi1_filedata *fd = fp->private_data; + struct hfi1_ctxtdata *uctxt = fd->uctxt; + struct hfi1_user_sdma_pkt_q *pq = fd->pq; + struct hfi1_user_sdma_comp_q *cq = fd->cq; struct hfi1_devdata *dd = pq->dd; unsigned long idx = 0; u8 pcount = initial_pkt_count; @@ -499,7 +503,7 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec, hfi1_cdbg( SDMA, "[%u:%u:%u] First vector not big enough for header %lu/%lu", - dd->unit, uctxt->ctxt, subctxt_fp(fp), + dd->unit, uctxt->ctxt, fd->subctxt, iovec[idx].iov_len, sizeof(info) + sizeof(req->hdr)); ret = -EINVAL; goto done; @@ -507,15 +511,15 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec, ret = copy_from_user(&info, iovec[idx].iov_base, sizeof(info)); if (ret) { hfi1_cdbg(SDMA, "[%u:%u:%u] Failed to copy info QW (%d)", - dd->unit, uctxt->ctxt, subctxt_fp(fp), ret); + dd->unit, uctxt->ctxt, fd->subctxt, ret); ret = -EFAULT; goto done; } - trace_hfi1_sdma_user_reqinfo(dd, uctxt->ctxt, subctxt_fp(fp), + trace_hfi1_sdma_user_reqinfo(dd, uctxt->ctxt, fd->subctxt, (u16 *)&info); if (cq->comps[info.comp_idx].status == QUEUED) { hfi1_cdbg(SDMA, "[%u:%u:%u] Entry %u is in QUEUED state", - dd->unit, uctxt->ctxt, subctxt_fp(fp), + dd->unit, uctxt->ctxt, fd->subctxt, info.comp_idx); ret = -EBADSLT; goto done; @@ -523,7 +527,7 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec, if (!info.fragsize) { hfi1_cdbg(SDMA, "[%u:%u:%u:%u] Request does not specify fragsize", - dd->unit, uctxt->ctxt, subctxt_fp(fp), info.comp_idx); + dd->unit, uctxt->ctxt, fd->subctxt, info.comp_idx); ret = -EINVAL; goto done; } @@ -532,7 +536,7 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec, * "allocate" the request entry. */ hfi1_cdbg(SDMA, "[%u:%u:%u] Using req/comp entry %u\n", dd->unit, - uctxt->ctxt, subctxt_fp(fp), info.comp_idx); + uctxt->ctxt, fd->subctxt, info.comp_idx); req = pq->reqs + info.comp_idx; memset(req, 0, sizeof(*req)); /* Mark the request as IN_USE before we start filling it in. */ @@ -659,7 +663,7 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec, /* Have to select the engine */ req->sde = sdma_select_engine_vl(dd, - (u32)(uctxt->ctxt + subctxt_fp(fp)), + (u32)(uctxt->ctxt + fd->subctxt), vl); if (!req->sde || !sdma_running(req->sde)) { ret = -ECOMM; From 3bd4dce1366fefe6575b841816e595f54e8e9752 Mon Sep 17 00:00:00 2001 From: Mitko Haralanov Date: Fri, 30 Oct 2015 18:58:41 -0400 Subject: [PATCH 341/843] staging/rdma/hfi1: Clean up macro indentation In preparation for implementing Expected TID caching we do some simple clean up of header file macros. Signed-off-by: Mitko Haralanov Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/common.h | 15 ++++++++------- include/uapi/rdma/hfi/hfi1_user.h | 26 +++++++++++++------------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/drivers/staging/rdma/hfi1/common.h b/drivers/staging/rdma/hfi1/common.h index 5e203239c5b0..5dd92720faae 100644 --- a/drivers/staging/rdma/hfi1/common.h +++ b/drivers/staging/rdma/hfi1/common.h @@ -132,13 +132,14 @@ * HFI1_CAP_RESERVED_MASK bits. */ #define HFI1_CAP_WRITABLE_MASK (HFI1_CAP_SDMA_AHG | \ - HFI1_CAP_HDRSUPP | \ - HFI1_CAP_MULTI_PKT_EGR | \ - HFI1_CAP_NODROP_RHQ_FULL | \ - HFI1_CAP_NODROP_EGR_FULL | \ - HFI1_CAP_ALLOW_PERM_JKEY | \ - HFI1_CAP_STATIC_RATE_CTRL | \ - HFI1_CAP_PRINT_UNIMPL) + HFI1_CAP_HDRSUPP | \ + HFI1_CAP_MULTI_PKT_EGR | \ + HFI1_CAP_NODROP_RHQ_FULL | \ + HFI1_CAP_NODROP_EGR_FULL | \ + HFI1_CAP_ALLOW_PERM_JKEY | \ + HFI1_CAP_STATIC_RATE_CTRL | \ + HFI1_CAP_PRINT_UNIMPL | \ + HFI1_CAP_TID_UNMAP) /* * A set of capability bits that are "global" and are not allowed to be * set in the user bitmask. diff --git a/include/uapi/rdma/hfi/hfi1_user.h b/include/uapi/rdma/hfi/hfi1_user.h index 599562fe5d57..a2fc6cbfe414 100644 --- a/include/uapi/rdma/hfi/hfi1_user.h +++ b/include/uapi/rdma/hfi/hfi1_user.h @@ -127,13 +127,13 @@ #define HFI1_CMD_TID_UPDATE 4 /* update expected TID entries */ #define HFI1_CMD_TID_FREE 5 /* free expected TID entries */ #define HFI1_CMD_CREDIT_UPD 6 /* force an update of PIO credit */ -#define HFI1_CMD_SDMA_STATUS_UPD 7 /* force update of SDMA status ring */ +#define HFI1_CMD_SDMA_STATUS_UPD 7 /* force update of SDMA status ring */ #define HFI1_CMD_RECV_CTRL 8 /* control receipt of packets */ #define HFI1_CMD_POLL_TYPE 9 /* set the kind of polling we want */ #define HFI1_CMD_ACK_EVENT 10 /* ack & clear user status bits */ -#define HFI1_CMD_SET_PKEY 11 /* set context's pkey */ -#define HFI1_CMD_CTXT_RESET 12 /* reset context's HW send context */ +#define HFI1_CMD_SET_PKEY 11 /* set context's pkey */ +#define HFI1_CMD_CTXT_RESET 12 /* reset context's HW send context */ /* separate EPROM commands from normal PSM commands */ #define HFI1_CMD_EP_INFO 64 /* read EPROM device ID */ #define HFI1_CMD_EP_ERASE_CHIP 65 /* erase whole EPROM */ @@ -144,18 +144,18 @@ #define HFI1_CMD_EP_WRITE_P0 70 /* write EPROM partition 0 */ #define HFI1_CMD_EP_WRITE_P1 71 /* write EPROM partition 1 */ -#define _HFI1_EVENT_FROZEN_BIT 0 -#define _HFI1_EVENT_LINKDOWN_BIT 1 -#define _HFI1_EVENT_LID_CHANGE_BIT 2 -#define _HFI1_EVENT_LMC_CHANGE_BIT 3 -#define _HFI1_EVENT_SL2VL_CHANGE_BIT 4 +#define _HFI1_EVENT_FROZEN_BIT 0 +#define _HFI1_EVENT_LINKDOWN_BIT 1 +#define _HFI1_EVENT_LID_CHANGE_BIT 2 +#define _HFI1_EVENT_LMC_CHANGE_BIT 3 +#define _HFI1_EVENT_SL2VL_CHANGE_BIT 4 #define _HFI1_MAX_EVENT_BIT _HFI1_EVENT_SL2VL_CHANGE_BIT -#define HFI1_EVENT_FROZEN (1UL << _HFI1_EVENT_FROZEN_BIT) -#define HFI1_EVENT_LINKDOWN_BIT (1UL << _HFI1_EVENT_LINKDOWN_BIT) -#define HFI1_EVENT_LID_CHANGE_BIT (1UL << _HFI1_EVENT_LID_CHANGE_BIT) -#define HFI1_EVENT_LMC_CHANGE_BIT (1UL << _HFI1_EVENT_LMC_CHANGE_BIT) -#define HFI1_EVENT_SL2VL_CHANGE_BIT (1UL << _HFI1_EVENT_SL2VL_CHANGE_BIT) +#define HFI1_EVENT_FROZEN (1UL << _HFI1_EVENT_FROZEN_BIT) +#define HFI1_EVENT_LINKDOWN (1UL << _HFI1_EVENT_LINKDOWN_BIT) +#define HFI1_EVENT_LID_CHANGE (1UL << _HFI1_EVENT_LID_CHANGE_BIT) +#define HFI1_EVENT_LMC_CHANGE (1UL << _HFI1_EVENT_LMC_CHANGE_BIT) +#define HFI1_EVENT_SL2VL_CHANGE (1UL << _HFI1_EVENT_SL2VL_CHANGE_BIT) /* * These are the status bits readable (in ASCII form, 64bit value) From 49efd866193253f8b0322b73791b473e8e4eb688 Mon Sep 17 00:00:00 2001 From: Mitko Haralanov Date: Fri, 30 Oct 2015 18:58:42 -0400 Subject: [PATCH 342/843] staging/rdma/hfi1: Remove unnecessary include files These includes were not used in file_ops.c Signed-off-by: Mitko Haralanov Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/file_ops.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/staging/rdma/hfi1/file_ops.c b/drivers/staging/rdma/hfi1/file_ops.c index f78bcf673252..b8aeef0e0d39 100644 --- a/drivers/staging/rdma/hfi1/file_ops.c +++ b/drivers/staging/rdma/hfi1/file_ops.c @@ -47,20 +47,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -#include #include #include -#include #include -#include #include -#include -#include -#include -#include -#include -#include -#include #include "hfi.h" #include "pio.h" From 701e441d82689c21afd699b229d338783f3463b1 Mon Sep 17 00:00:00 2001 From: Mitko Haralanov Date: Fri, 30 Oct 2015 18:58:43 -0400 Subject: [PATCH 343/843] staging/rdma/hfi1: Move macros to a common header In preparation of implementing TID caching move EXP_TID macros to a common header user_exp_rcv.h Signed-off-by: Mitko Haralanov Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/file_ops.c | 13 +---- drivers/staging/rdma/hfi1/user_exp_rcv.h | 74 ++++++++++++++++++++++++ drivers/staging/rdma/hfi1/user_sdma.h | 10 +--- 3 files changed, 76 insertions(+), 21 deletions(-) create mode 100644 drivers/staging/rdma/hfi1/user_exp_rcv.h diff --git a/drivers/staging/rdma/hfi1/file_ops.c b/drivers/staging/rdma/hfi1/file_ops.c index b8aeef0e0d39..3b15eb4d5bf9 100644 --- a/drivers/staging/rdma/hfi1/file_ops.c +++ b/drivers/staging/rdma/hfi1/file_ops.c @@ -58,6 +58,7 @@ #include "common.h" #include "trace.h" #include "user_sdma.h" +#include "user_exp_rcv.h" #include "eprom.h" #undef pr_fmt @@ -160,18 +161,6 @@ enum mmap_types { HFI1_MMAP_TOKEN_SET(SUBCTXT, subctxt) | \ HFI1_MMAP_TOKEN_SET(OFFSET, (offset_in_page(addr)))) -#define EXP_TID_SET(field, value) \ - (((value) & EXP_TID_TID##field##_MASK) << \ - EXP_TID_TID##field##_SHIFT) -#define EXP_TID_CLEAR(tid, field) { \ - (tid) &= ~(EXP_TID_TID##field##_MASK << \ - EXP_TID_TID##field##_SHIFT); \ - } -#define EXP_TID_RESET(tid, field, value) do { \ - EXP_TID_CLEAR(tid, field); \ - (tid) |= EXP_TID_SET(field, value); \ - } while (0) - #define dbg(fmt, ...) \ pr_info(fmt, ##__VA_ARGS__) diff --git a/drivers/staging/rdma/hfi1/user_exp_rcv.h b/drivers/staging/rdma/hfi1/user_exp_rcv.h new file mode 100644 index 000000000000..4f4876e1d353 --- /dev/null +++ b/drivers/staging/rdma/hfi1/user_exp_rcv.h @@ -0,0 +1,74 @@ +#ifndef _HFI1_USER_EXP_RCV_H +#define _HFI1_USER_EXP_RCV_H +/* + * + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * GPL LICENSE SUMMARY + * + * Copyright(c) 2015 Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * BSD LICENSE + * + * Copyright(c) 2015 Intel Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * - Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#define EXP_TID_TIDLEN_MASK 0x7FFULL +#define EXP_TID_TIDLEN_SHIFT 0 +#define EXP_TID_TIDCTRL_MASK 0x3ULL +#define EXP_TID_TIDCTRL_SHIFT 20 +#define EXP_TID_TIDIDX_MASK 0x3FFULL +#define EXP_TID_TIDIDX_SHIFT 22 +#define EXP_TID_GET(tid, field) \ + (((tid) >> EXP_TID_TID##field##_SHIFT) & EXP_TID_TID##field##_MASK) + +#define EXP_TID_SET(field, value) \ + (((value) & EXP_TID_TID##field##_MASK) << \ + EXP_TID_TID##field##_SHIFT) +#define EXP_TID_CLEAR(tid, field) ({ \ + (tid) &= ~(EXP_TID_TID##field##_MASK << \ + EXP_TID_TID##field##_SHIFT); \ + }) +#define EXP_TID_RESET(tid, field, value) do { \ + EXP_TID_CLEAR(tid, field); \ + (tid) |= EXP_TID_SET(field, (value)); \ + } while (0) + +#endif /* _HFI1_USER_EXP_RCV_H */ diff --git a/drivers/staging/rdma/hfi1/user_sdma.h b/drivers/staging/rdma/hfi1/user_sdma.h index fa4422553e23..0046ffa774fe 100644 --- a/drivers/staging/rdma/hfi1/user_sdma.h +++ b/drivers/staging/rdma/hfi1/user_sdma.h @@ -52,15 +52,7 @@ #include "common.h" #include "iowait.h" - -#define EXP_TID_TIDLEN_MASK 0x7FFULL -#define EXP_TID_TIDLEN_SHIFT 0 -#define EXP_TID_TIDCTRL_MASK 0x3ULL -#define EXP_TID_TIDCTRL_SHIFT 20 -#define EXP_TID_TIDIDX_MASK 0x7FFULL -#define EXP_TID_TIDIDX_SHIFT 22 -#define EXP_TID_GET(tid, field) \ - (((tid) >> EXP_TID_TID##field##_SHIFT) & EXP_TID_TID##field##_MASK) +#include "user_exp_rcv.h" extern uint extended_psn; From 3e7ccca08dbe46665ca432d09a5472d80aaadb6f Mon Sep 17 00:00:00 2001 From: Arthur Kepner Date: Wed, 4 Nov 2015 21:10:09 -0500 Subject: [PATCH 344/843] staging/rdma/hfi1: don't cache "prescan head" When HFI1_CAP_DMA_RTAIL is toggled off the "prescan head" can get out of sync with the receive context's "head". This happens when, after prescan_rxq() newly arrived packets are then received, and processed by an RX interrupt handler. This is an unavoidable race, and to avoid getting out of sync we always start prescanning at the current "rcd->head" entry. Reviewed-by: Mike Marciniszyn Reviewed-by: Dennis Dalessandro Signed-off-by: Arthur Kepner Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/driver.c | 13 +++---------- drivers/staging/rdma/hfi1/hfi.h | 13 ------------- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/drivers/staging/rdma/hfi1/driver.c b/drivers/staging/rdma/hfi1/driver.c index ce69141b56cb..cfcbe417fde9 100644 --- a/drivers/staging/rdma/hfi1/driver.c +++ b/drivers/staging/rdma/hfi1/driver.c @@ -509,14 +509,10 @@ static inline void init_ps_mdata(struct ps_mdata *mdata, mdata->rsize = packet->rsize; mdata->maxcnt = packet->maxcnt; - if (rcd->ps_state.initialized == 0) { - mdata->ps_head = packet->rhqoff; - rcd->ps_state.initialized++; - } else - mdata->ps_head = rcd->ps_state.ps_head; + mdata->ps_head = packet->rhqoff; if (HFI1_CAP_IS_KSET(DMA_RTAIL)) { - mdata->ps_tail = packet->hdrqtail; + mdata->ps_tail = get_rcvhdrtail(rcd); mdata->ps_seq = 0; /* not used with DMA_RTAIL */ } else { mdata->ps_tail = 0; /* used only with DMA_RTAIL*/ @@ -533,12 +529,9 @@ static inline int ps_done(struct ps_mdata *mdata, u64 rhf) static inline void update_ps_mdata(struct ps_mdata *mdata) { - struct hfi1_ctxtdata *rcd = mdata->rcd; - mdata->ps_head += mdata->rsize; - if (mdata->ps_head > mdata->maxcnt) + if (mdata->ps_head >= mdata->maxcnt) mdata->ps_head = 0; - rcd->ps_state.ps_head = mdata->ps_head; if (!HFI1_CAP_IS_KSET(DMA_RTAIL)) { if (++mdata->ps_seq > 13) mdata->ps_seq = 1; diff --git a/drivers/staging/rdma/hfi1/hfi.h b/drivers/staging/rdma/hfi1/hfi.h index 31c11852d4c0..70891fbf89b0 100644 --- a/drivers/staging/rdma/hfi1/hfi.h +++ b/drivers/staging/rdma/hfi1/hfi.h @@ -139,15 +139,6 @@ extern const struct pci_error_handlers hfi1_pci_err_handler; struct hfi1_opcode_stats_perctx; #endif -/* - * struct ps_state keeps state associated with RX queue "prescanning" - * (prescanning for FECNs, and BECNs), if prescanning is in use. - */ -struct ps_state { - u32 ps_head; - int initialized; -}; - struct ctxt_eager_bufs { ssize_t size; /* total size of eager buffers */ u32 count; /* size of buffers array */ @@ -302,10 +293,6 @@ struct hfi1_ctxtdata { struct list_head sdma_queues; spinlock_t sdma_qlock; -#ifdef CONFIG_PRESCAN_RXQ - struct ps_state ps_state; -#endif /* CONFIG_PRESCAN_RXQ */ - /* * The interrupt handler for a particular receive context can vary * throughout it's lifetime. This is not a lock protected data member so From 977940b85e3c3b6b5b8ffbc1235b23e35284382f Mon Sep 17 00:00:00 2001 From: Arthur Kepner Date: Wed, 4 Nov 2015 21:10:10 -0500 Subject: [PATCH 345/843] staging/rdma/hfi1: optionally prescan rx queue for {B, F}ECNs - UC, RC To more rapidly respond to Explicit Congestion Notifications, prescan the receive queue, and process FECNs, and BECNs first. When a UC, or RC packet containing a FECN, or BECN is found, immediately react to the ECN (either by returning a CNP, or adjusting the injection rate). Afterward, the packet will be processed normally. Reviewed-by: Mike Marciniszyn Reviewed-by: Dennis Dalessandro Signed-off-by: Arthur Kepner Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/driver.c | 64 +++++++++++++++--------------- drivers/staging/rdma/hfi1/rc.c | 10 ++--- drivers/staging/rdma/hfi1/uc.c | 15 ++++--- drivers/staging/rdma/hfi1/verbs.c | 39 +++++++++++++++--- 4 files changed, 80 insertions(+), 48 deletions(-) diff --git a/drivers/staging/rdma/hfi1/driver.c b/drivers/staging/rdma/hfi1/driver.c index cfcbe417fde9..9a4ec09af020 100644 --- a/drivers/staging/rdma/hfi1/driver.c +++ b/drivers/staging/rdma/hfi1/driver.c @@ -436,59 +436,58 @@ static inline void init_packet(struct hfi1_ctxtdata *rcd, #ifndef CONFIG_PRESCAN_RXQ static void prescan_rxq(struct hfi1_packet *packet) {} -#else /* CONFIG_PRESCAN_RXQ */ +#else /* !CONFIG_PRESCAN_RXQ */ static int prescan_receive_queue; static void process_ecn(struct hfi1_qp *qp, struct hfi1_ib_header *hdr, struct hfi1_other_headers *ohdr, - u64 rhf, struct ib_grh *grh) + u64 rhf, u32 bth1, struct ib_grh *grh) { struct hfi1_ibport *ibp = to_iport(qp->ibqp.device, qp->port_num); - u32 bth1; + u32 rqpn = 0; + u16 rlid; u8 sc5, svc_type; - int is_fecn, is_becn; switch (qp->ibqp.qp_type) { + case IB_QPT_SMI: + case IB_QPT_GSI: case IB_QPT_UD: + rlid = be16_to_cpu(hdr->lrh[3]); + rqpn = be32_to_cpu(ohdr->u.ud.deth[1]) & HFI1_QPN_MASK; svc_type = IB_CC_SVCTYPE_UD; break; - case IB_QPT_UC: /* LATER */ - case IB_QPT_RC: /* LATER */ + case IB_QPT_UC: + rlid = qp->remote_ah_attr.dlid; + rqpn = qp->remote_qpn; + svc_type = IB_CC_SVCTYPE_UC; + break; + case IB_QPT_RC: + rlid = qp->remote_ah_attr.dlid; + rqpn = qp->remote_qpn; + svc_type = IB_CC_SVCTYPE_RC; + break; default: return; } - is_fecn = (be32_to_cpu(ohdr->bth[1]) >> HFI1_FECN_SHIFT) & - HFI1_FECN_MASK; - is_becn = (be32_to_cpu(ohdr->bth[1]) >> HFI1_BECN_SHIFT) & - HFI1_BECN_MASK; - sc5 = (be16_to_cpu(hdr->lrh[0]) >> 12) & 0xf; if (rhf_dc_info(rhf)) sc5 |= 0x10; - if (is_fecn) { - u32 src_qpn = be32_to_cpu(ohdr->u.ud.deth[1]) & HFI1_QPN_MASK; + if (bth1 & HFI1_FECN_SMASK) { u16 pkey = (u16)be32_to_cpu(ohdr->bth[0]); u16 dlid = be16_to_cpu(hdr->lrh[1]); - u16 slid = be16_to_cpu(hdr->lrh[3]); - return_cnp(ibp, qp, src_qpn, pkey, dlid, slid, sc5, grh); + return_cnp(ibp, qp, rqpn, pkey, dlid, rlid, sc5, grh); } - if (is_becn) { + if (bth1 & HFI1_BECN_SMASK) { struct hfi1_pportdata *ppd = ppd_from_ibp(ibp); - u32 lqpn = be32_to_cpu(ohdr->bth[1]) & HFI1_QPN_MASK; + u32 lqpn = bth1 & HFI1_QPN_MASK; u8 sl = ibp->sc_to_sl[sc5]; - process_becn(ppd, sl, 0, lqpn, 0, svc_type); + process_becn(ppd, sl, rlid, lqpn, rqpn, svc_type); } - - /* turn off BECN, or FECN */ - bth1 = be32_to_cpu(ohdr->bth[1]); - bth1 &= ~(HFI1_FECN_MASK << HFI1_FECN_SHIFT); - bth1 &= ~(HFI1_BECN_MASK << HFI1_BECN_SHIFT); - ohdr->bth[1] = cpu_to_be32(bth1); } struct ps_mdata { @@ -508,7 +507,6 @@ static inline void init_ps_mdata(struct ps_mdata *mdata, mdata->rcd = rcd; mdata->rsize = packet->rsize; mdata->maxcnt = packet->maxcnt; - mdata->ps_head = packet->rhqoff; if (HFI1_CAP_IS_KSET(DMA_RTAIL)) { @@ -564,7 +562,7 @@ static void prescan_rxq(struct hfi1_packet *packet) struct hfi1_other_headers *ohdr; struct ib_grh *grh = NULL; u64 rhf = rhf_to_cpu(rhf_addr); - u32 etype = rhf_rcv_type(rhf), qpn; + u32 etype = rhf_rcv_type(rhf), qpn, bth1; int is_ecn = 0; u8 lnh; @@ -586,15 +584,13 @@ static void prescan_rxq(struct hfi1_packet *packet) } else goto next; /* just in case */ - is_ecn |= be32_to_cpu(ohdr->bth[1]) & - (HFI1_FECN_MASK << HFI1_FECN_SHIFT); - is_ecn |= be32_to_cpu(ohdr->bth[1]) & - (HFI1_BECN_MASK << HFI1_BECN_SHIFT); + bth1 = be32_to_cpu(ohdr->bth[1]); + is_ecn = !!(bth1 & (HFI1_FECN_SMASK | HFI1_BECN_SMASK)); if (!is_ecn) goto next; - qpn = be32_to_cpu(ohdr->bth[1]) & HFI1_QPN_MASK; + qpn = bth1 & HFI1_QPN_MASK; rcu_read_lock(); qp = hfi1_lookup_qpn(ibp, qpn); @@ -603,8 +599,12 @@ static void prescan_rxq(struct hfi1_packet *packet) goto next; } - process_ecn(qp, hdr, ohdr, rhf, grh); + process_ecn(qp, hdr, ohdr, rhf, bth1, grh); rcu_read_unlock(); + + /* turn off BECN, FECN */ + bth1 &= ~(HFI1_FECN_SMASK | HFI1_BECN_SMASK); + ohdr->bth[1] = cpu_to_be32(bth1); next: update_ps_mdata(&mdata); } diff --git a/drivers/staging/rdma/hfi1/rc.c b/drivers/staging/rdma/hfi1/rc.c index 5fc93bb312f1..fd23907f18fe 100644 --- a/drivers/staging/rdma/hfi1/rc.c +++ b/drivers/staging/rdma/hfi1/rc.c @@ -1978,7 +1978,7 @@ void hfi1_rc_rcv(struct hfi1_packet *packet) } psn = be32_to_cpu(ohdr->bth[2]); - opcode = bth0 >> 24; + opcode = (bth0 >> 24) & 0xff; /* * Process responses (ACKs) before anything else. Note that the @@ -2391,19 +2391,19 @@ void hfi1_rc_hdrerr( struct hfi1_ibport *ibp = to_iport(qp->ibqp.device, qp->port_num); int diff; u32 opcode; - u32 psn; + u32 psn, bth0; /* Check for GRH */ ohdr = &hdr->u.oth; if (has_grh) ohdr = &hdr->u.l.oth; - opcode = be32_to_cpu(ohdr->bth[0]); - if (hfi1_ruc_check_hdr(ibp, hdr, has_grh, qp, opcode)) + bth0 = be32_to_cpu(ohdr->bth[0]); + if (hfi1_ruc_check_hdr(ibp, hdr, has_grh, qp, bth0)) return; psn = be32_to_cpu(ohdr->bth[2]); - opcode >>= 24; + opcode = (bth0 >> 24) & 0xff; /* Only deal with RDMA Writes for now */ if (opcode < IB_OPCODE_RC_RDMA_READ_RESPONSE_FIRST) { diff --git a/drivers/staging/rdma/hfi1/uc.c b/drivers/staging/rdma/hfi1/uc.c index 6095039c4485..4f2a7889a852 100644 --- a/drivers/staging/rdma/hfi1/uc.c +++ b/drivers/staging/rdma/hfi1/uc.c @@ -268,7 +268,7 @@ void hfi1_uc_rcv(struct hfi1_packet *packet) u32 tlen = packet->tlen; struct hfi1_qp *qp = packet->qp; struct hfi1_other_headers *ohdr = packet->ohdr; - u32 opcode; + u32 bth0, opcode; u32 hdrsize = packet->hlen; u32 psn; u32 pad; @@ -278,10 +278,9 @@ void hfi1_uc_rcv(struct hfi1_packet *packet) int has_grh = rcv_flags & HFI1_HAS_GRH; int ret; u32 bth1; - struct ib_grh *grh = NULL; - opcode = be32_to_cpu(ohdr->bth[0]); - if (hfi1_ruc_check_hdr(ibp, hdr, has_grh, qp, opcode)) + bth0 = be32_to_cpu(ohdr->bth[0]); + if (hfi1_ruc_check_hdr(ibp, hdr, has_grh, qp, bth0)) return; bth1 = be32_to_cpu(ohdr->bth[1]); @@ -303,6 +302,7 @@ void hfi1_uc_rcv(struct hfi1_packet *packet) } if (bth1 & HFI1_FECN_SMASK) { + struct ib_grh *grh = NULL; u16 pkey = (u16)be32_to_cpu(ohdr->bth[0]); u16 slid = be16_to_cpu(hdr->lrh[3]); u16 dlid = be16_to_cpu(hdr->lrh[1]); @@ -310,13 +310,16 @@ void hfi1_uc_rcv(struct hfi1_packet *packet) u8 sc5; sc5 = ibp->sl_to_sc[qp->remote_ah_attr.sl]; + if (has_grh) + grh = &hdr->u.l.grh; - return_cnp(ibp, qp, src_qp, pkey, dlid, slid, sc5, grh); + return_cnp(ibp, qp, src_qp, pkey, dlid, slid, sc5, + grh); } } psn = be32_to_cpu(ohdr->bth[2]); - opcode >>= 24; + opcode = (bth0 >> 24) & 0xff; /* Compare the PSN verses the expected PSN. */ if (unlikely(cmp_psn(psn, qp->r_psn) != 0)) { diff --git a/drivers/staging/rdma/hfi1/verbs.c b/drivers/staging/rdma/hfi1/verbs.c index 9beb0aa876f0..ea1d9e6303e2 100644 --- a/drivers/staging/rdma/hfi1/verbs.c +++ b/drivers/staging/rdma/hfi1/verbs.c @@ -2152,11 +2152,40 @@ void hfi1_schedule_send(struct hfi1_qp *qp) void hfi1_cnp_rcv(struct hfi1_packet *packet) { struct hfi1_ibport *ibp = &packet->rcd->ppd->ibport_data; + struct hfi1_pportdata *ppd = ppd_from_ibp(ibp); + struct hfi1_ib_header *hdr = packet->hdr; + struct hfi1_qp *qp = packet->qp; + u32 lqpn, rqpn = 0; + u16 rlid = 0; + u8 sl, sc5, sc4_bit, svc_type; + bool sc4_set = has_sc4_bit(packet); - if (packet->qp->ibqp.qp_type == IB_QPT_UC) - hfi1_uc_rcv(packet); - else if (packet->qp->ibqp.qp_type == IB_QPT_UD) - hfi1_ud_rcv(packet); - else + switch (packet->qp->ibqp.qp_type) { + case IB_QPT_UC: + rlid = qp->remote_ah_attr.dlid; + rqpn = qp->remote_qpn; + svc_type = IB_CC_SVCTYPE_UC; + break; + case IB_QPT_RC: + rlid = qp->remote_ah_attr.dlid; + rqpn = qp->remote_qpn; + svc_type = IB_CC_SVCTYPE_RC; + break; + case IB_QPT_SMI: + case IB_QPT_GSI: + case IB_QPT_UD: + svc_type = IB_CC_SVCTYPE_UD; + break; + default: ibp->n_pkt_drops++; + return; + } + + sc4_bit = sc4_set << 4; + sc5 = (be16_to_cpu(hdr->lrh[0]) >> 12) & 0xf; + sc5 |= sc4_bit; + sl = ibp->sc_to_sl[sc5]; + lqpn = qp->ibqp.qp_num; + + process_becn(ppd, sl, rlid, lqpn, rqpn, svc_type); } From e3a45e4063601336f5759734d65fcee1b73d001f Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Thu, 5 Nov 2015 02:25:58 +0530 Subject: [PATCH 346/843] staging: rdma: amso1100: c2: Remove wrapper function This patch removes the c2_print_macaddr() wrapper function which calls the pr_debug standard kernel function only. c2_print_macaddr() has been replaced by directly calling pr_debug(). Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/amso1100/c2.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rdma/amso1100/c2.c b/drivers/staging/rdma/amso1100/c2.c index 35ac536b2d45..af043f023c7d 100644 --- a/drivers/staging/rdma/amso1100/c2.c +++ b/drivers/staging/rdma/amso1100/c2.c @@ -87,11 +87,6 @@ static struct pci_device_id c2_pci_table[] = { MODULE_DEVICE_TABLE(pci, c2_pci_table); -static void c2_print_macaddr(struct net_device *netdev) -{ - pr_debug("%s: MAC %pM, IRQ %u\n", netdev->name, netdev->dev_addr, netdev->irq); -} - static void c2_set_rxbufsize(struct c2_port *c2_port) { struct net_device *netdev = c2_port->netdev; @@ -908,7 +903,8 @@ static struct net_device *c2_devinit(struct c2_dev *c2dev, /* Validate the MAC address */ if (!is_valid_ether_addr(netdev->dev_addr)) { pr_debug("Invalid MAC Address\n"); - c2_print_macaddr(netdev); + pr_debug("%s: MAC %pM, IRQ %u\n", netdev->name, + netdev->dev_addr, netdev->irq); free_netdev(netdev); return NULL; } @@ -1142,7 +1138,8 @@ static int c2_probe(struct pci_dev *pcidev, const struct pci_device_id *ent) } /* Print out the MAC address */ - c2_print_macaddr(netdev); + pr_debug("%s: MAC %pM, IRQ %u\n", netdev->name, netdev->dev_addr, + netdev->irq); ret = c2_rnic_init(c2dev); if (ret) { From cb32649d087d513bb6e0f90dda0a686a6662b519 Mon Sep 17 00:00:00 2001 From: Sunny Kumar Date: Fri, 6 Nov 2015 10:06:43 +0530 Subject: [PATCH 347/843] staging: rdma: hfi1 : Prefer using the BIT macro This patch replaces bit shifting on 1 with the BIT(x) macro Signed-off-by: Sunny Kumar Acked-by: Mike Marciniszyn Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/user_sdma.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rdma/hfi1/user_sdma.c b/drivers/staging/rdma/hfi1/user_sdma.c index be7a4e53335f..41408f82afe8 100644 --- a/drivers/staging/rdma/hfi1/user_sdma.c +++ b/drivers/staging/rdma/hfi1/user_sdma.c @@ -146,8 +146,8 @@ MODULE_PARM_DESC(sdma_comp_size, "Size of User SDMA completion ring. Default: 12 #define KDETH_OM_MAX_SIZE (1 << ((KDETH_OM_LARGE / KDETH_OM_SMALL) + 1)) /* Last packet in the request */ -#define TXREQ_FLAGS_REQ_LAST_PKT (1 << 0) -#define TXREQ_FLAGS_IOVEC_LAST_PKT (1 << 0) +#define TXREQ_FLAGS_REQ_LAST_PKT BIT(0) +#define TXREQ_FLAGS_IOVEC_LAST_PKT BIT(0) #define SDMA_REQ_IN_USE 0 #define SDMA_REQ_FOR_THREAD 1 @@ -156,9 +156,9 @@ MODULE_PARM_DESC(sdma_comp_size, "Size of User SDMA completion ring. Default: 12 #define SDMA_REQ_HAS_ERROR 4 #define SDMA_REQ_DONE_ERROR 5 -#define SDMA_PKT_Q_INACTIVE (1 << 0) -#define SDMA_PKT_Q_ACTIVE (1 << 1) -#define SDMA_PKT_Q_DEFERRED (1 << 2) +#define SDMA_PKT_Q_INACTIVE BIT(0) +#define SDMA_PKT_Q_ACTIVE BIT(1) +#define SDMA_PKT_Q_DEFERRED BIT(2) /* * Maximum retry attempts to submit a TX request From 5f4179e04b31441b0b7995d14320a457aafba01b Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 29 Oct 2015 02:54:09 +0200 Subject: [PATCH 348/843] staging: lustre: ldlm_extent.c: replace IS_PO2 by is_power_of_2 Replaces IS_PO2 by is_power_of_2. It is more accurate to use is_power_of_2 since it returns 1 for numbers that are powers of 2 only whereas IS_PO2 returns 1 for 0 and numbers that are powers of 2. Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c index c787888eb8af..9c70f31ea56e 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c @@ -149,7 +149,7 @@ static inline int lock_mode_to_index(ldlm_mode_t mode) int index; LASSERT(mode != 0); - LASSERT(IS_PO2(mode)); + LASSERT(is_power_of_2(mode)); for (index = -1; mode; index++) mode >>= 1; LASSERT(index < LCK_MODE_NUM); From 57b573d14b0fb9f83575a2cf155862d251c8f0d1 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 29 Oct 2015 02:57:33 +0200 Subject: [PATCH 349/843] staging: lustre: workitem.c: replace IS_PO2 by is_power_of_2 Replaces IS_PO2 by is_power_of_2. It is more accurate to use is_power_of_2 since it returns 1 for numbers that are powers of 2 only whereas IS_PO2 returns 1 for 0 and numbers that are powers of 2. Reviewed-by: Andreas Dilger Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/workitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/libcfs/workitem.c b/drivers/staging/lustre/lustre/libcfs/workitem.c index e1143a566ac4..268dd6851af4 100644 --- a/drivers/staging/lustre/lustre/libcfs/workitem.c +++ b/drivers/staging/lustre/lustre/libcfs/workitem.c @@ -325,7 +325,7 @@ cfs_wi_sched_destroy(struct cfs_wi_sched *sched) spin_lock(&cfs_wi_data.wi_glock); while (sched->ws_nthreads > 0) { - CDEBUG(IS_PO2(++i) ? D_WARNING : D_NET, + CDEBUG(is_power_of_2(++i) ? D_WARNING : D_NET, "waiting for %d threads of WI sched[%s] to terminate\n", sched->ws_nthreads, sched->ws_name); From b3367164f4ff8ff2c1aa8bd79c7548f113b62b83 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Thu, 29 Oct 2015 02:59:27 +0200 Subject: [PATCH 350/843] staging: lustre: selftest.h: replace IS_PO2 by is_power_of_2 Replaces IS_PO2 by is_power_of_2. It is more accurate to use is_power_of_2 since it returns 1 for numbers that are powers of 2 only whereas IS_PO2 returns 1 for 0 and numbers that are powers of 2. Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/selftest/selftest.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index 0c0f177debc8..870498339538 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -585,7 +585,7 @@ swi_state2str (int state) do { \ int __I = 2; \ while (!(cond)) { \ - CDEBUG(IS_PO2(++__I) ? D_WARNING : D_NET, \ + CDEBUG(is_power_of_2(++__I) ? D_WARNING : D_NET, \ fmt, ## __VA_ARGS__); \ spin_unlock(&(lock)); \ \ From a4be078d7818e8712cb5d78b95542877a6f75071 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 4 Nov 2015 01:16:16 +0300 Subject: [PATCH 351/843] staging: lustre: remove unused variable The "->lr_lvb_data" struct member is never used. Delete it. Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 -- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 0e75a15fe0d4..138479a9edc1 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -872,8 +872,6 @@ struct ldlm_resource { */ struct mutex lr_lvb_mutex; int lr_lvb_len; - /** protected by lr_lock */ - void *lr_lvb_data; /** When the resource was considered as contended. */ unsigned long lr_contention_time; diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index c0a54bf406ca..b55a4f0eb1d5 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -1154,8 +1154,6 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent, CERROR("%s: lvbo_init failed for resource %#llx:%#llx: rc = %d\n", ns->ns_obd->obd_name, name->name[0], name->name[1], rc); - kfree(res->lr_lvb_data); - res->lr_lvb_data = NULL; res->lr_lvb_len = rc; mutex_unlock(&res->lr_lvb_mutex); ldlm_resource_putref(res); From cf02dfef8a3de0e45e4907a374dbc53890cc9ee5 Mon Sep 17 00:00:00 2001 From: Liang Zhen Date: Wed, 4 Nov 2015 13:39:57 -0500 Subject: [PATCH 352/843] staging: lustre: wrong parameter to cfs_hash_keycpy cfs_hash_rehash_key() passed wrong parameter to cfs_hash_keycpy, hnode should be the second parameter not the third one. Signed-off-by: Liang Zhen Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4362 Reviewed-on: http://review.whamcloud.com/8509 Reviewed-by: Bobi Jam Reviewed-by: Johann Lombardi Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index 98c19b6cd174..8800d64780bf 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -2005,7 +2005,7 @@ void cfs_hash_rehash_key(struct cfs_hash *hs, const void *old_key, } /* overwrite key inside locks, otherwise may screw up with * other operations, i.e: rehash */ - cfs_hash_keycpy(hs, new_key, hnode); + cfs_hash_keycpy(hs, hnode, new_key); cfs_hash_multi_bd_unlock(hs, bds, 3, 1); cfs_hash_unlock(hs, 0); From 5b26f052fb31561717f889fff09604907be62080 Mon Sep 17 00:00:00 2001 From: frank zago Date: Wed, 4 Nov 2015 13:39:58 -0500 Subject: [PATCH 353/843] staging: lustre: remove unnecessary EXPORT_SYMBOL in libcfs A lot of symbols don't need to be exported at all because they are only used in the module they belong to. Signed-off-by: frank zago Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5829 Reviewed-on: http://review.whamcloud.com/13319 Reviewed-by: James Simmons Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/debug.c | 10 ---------- drivers/staging/lustre/lustre/libcfs/hash.c | 10 ---------- drivers/staging/lustre/lustre/libcfs/libcfs_mem.c | 2 -- .../staging/lustre/lustre/libcfs/linux/linux-debug.c | 1 - 4 files changed, 23 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c b/drivers/staging/lustre/lustre/libcfs/debug.c index 1d1c67164418..4272a7c959d7 100644 --- a/drivers/staging/lustre/lustre/libcfs/debug.c +++ b/drivers/staging/lustre/lustre/libcfs/debug.c @@ -94,17 +94,14 @@ static struct kernel_param_ops param_ops_debugmb = { static unsigned int libcfs_debug_mb; module_param(libcfs_debug_mb, debugmb, 0644); MODULE_PARM_DESC(libcfs_debug_mb, "Total debug buffer size."); -EXPORT_SYMBOL(libcfs_debug_mb); unsigned int libcfs_printk = D_CANTMASK; module_param(libcfs_printk, uint, 0644); MODULE_PARM_DESC(libcfs_printk, "Lustre kernel debug console mask"); -EXPORT_SYMBOL(libcfs_printk); unsigned int libcfs_console_ratelimit = 1; module_param(libcfs_console_ratelimit, uint, 0644); MODULE_PARM_DESC(libcfs_console_ratelimit, "Lustre kernel debug console ratelimit (0 to disable)"); -EXPORT_SYMBOL(libcfs_console_ratelimit); static int param_set_delay_minmax(const char *val, const struct kernel_param *kp, @@ -135,9 +132,7 @@ static int param_get_delay(char *buffer, const struct kernel_param *kp) } unsigned int libcfs_console_max_delay; -EXPORT_SYMBOL(libcfs_console_max_delay); unsigned int libcfs_console_min_delay; -EXPORT_SYMBOL(libcfs_console_min_delay); static int param_set_console_max_delay(const char *val, const struct kernel_param *kp) @@ -207,10 +202,8 @@ static struct kernel_param_ops param_ops_uintpos = { unsigned int libcfs_console_backoff = CDEBUG_DEFAULT_BACKOFF; module_param(libcfs_console_backoff, uintpos, 0644); MODULE_PARM_DESC(libcfs_console_backoff, "Lustre kernel debug console backoff factor"); -EXPORT_SYMBOL(libcfs_console_backoff); unsigned int libcfs_debug_binary = 1; -EXPORT_SYMBOL(libcfs_debug_binary); unsigned int libcfs_stack = 3 * THREAD_SIZE / 4; EXPORT_SYMBOL(libcfs_stack); @@ -221,7 +214,6 @@ EXPORT_SYMBOL(libcfs_catastrophe); unsigned int libcfs_panic_on_lbug = 1; module_param(libcfs_panic_on_lbug, uint, 0644); MODULE_PARM_DESC(libcfs_panic_on_lbug, "Lustre kernel panic on LBUG"); -EXPORT_SYMBOL(libcfs_panic_on_lbug); static wait_queue_head_t debug_ctlwq; @@ -572,5 +564,3 @@ void libcfs_debug_set_level(unsigned int debug_level) debug_level); libcfs_debug = debug_level; } - -EXPORT_SYMBOL(libcfs_debug_set_level); diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index 8800d64780bf..f23a11ddc979 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -593,7 +593,6 @@ cfs_hash_bd_move_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd_old, if (unlikely(nbkt->hsb_version == 0)) nbkt->hsb_version++; } -EXPORT_SYMBOL(cfs_hash_bd_move_locked); enum { /** always set, for sanity (avoid ZERO intent) */ @@ -830,21 +829,18 @@ cfs_hash_dual_bd_get(struct cfs_hash *hs, const void *key, cfs_hash_bd_order(&bds[0], &bds[1]); } -EXPORT_SYMBOL(cfs_hash_dual_bd_get); void cfs_hash_dual_bd_lock(struct cfs_hash *hs, struct cfs_hash_bd *bds, int excl) { cfs_hash_multi_bd_lock(hs, bds, 2, excl); } -EXPORT_SYMBOL(cfs_hash_dual_bd_lock); void cfs_hash_dual_bd_unlock(struct cfs_hash *hs, struct cfs_hash_bd *bds, int excl) { cfs_hash_multi_bd_unlock(hs, bds, 2, excl); } -EXPORT_SYMBOL(cfs_hash_dual_bd_unlock); struct hlist_node * cfs_hash_dual_bd_lookup_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, @@ -852,7 +848,6 @@ cfs_hash_dual_bd_lookup_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, { return cfs_hash_multi_bd_lookup_locked(hs, bds, 2, key); } -EXPORT_SYMBOL(cfs_hash_dual_bd_lookup_locked); struct hlist_node * cfs_hash_dual_bd_findadd_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, @@ -862,7 +857,6 @@ cfs_hash_dual_bd_findadd_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, return cfs_hash_multi_bd_findadd_locked(hs, bds, 2, key, hnode, noref); } -EXPORT_SYMBOL(cfs_hash_dual_bd_findadd_locked); struct hlist_node * cfs_hash_dual_bd_finddel_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, @@ -870,7 +864,6 @@ cfs_hash_dual_bd_finddel_locked(struct cfs_hash *hs, struct cfs_hash_bd *bds, { return cfs_hash_multi_bd_finddel_locked(hs, bds, 2, key, hnode); } -EXPORT_SYMBOL(cfs_hash_dual_bd_finddel_locked); static void cfs_hash_buckets_free(struct cfs_hash_bucket **buckets, @@ -1792,7 +1785,6 @@ cfs_hash_rehash_cancel_locked(struct cfs_hash *hs) cfs_hash_lock(hs, 1); } } -EXPORT_SYMBOL(cfs_hash_rehash_cancel_locked); void cfs_hash_rehash_cancel(struct cfs_hash *hs) @@ -1801,7 +1793,6 @@ cfs_hash_rehash_cancel(struct cfs_hash *hs) cfs_hash_rehash_cancel_locked(hs); cfs_hash_unlock(hs, 1); } -EXPORT_SYMBOL(cfs_hash_rehash_cancel); int cfs_hash_rehash(struct cfs_hash *hs, int do_rehash) @@ -1831,7 +1822,6 @@ cfs_hash_rehash(struct cfs_hash *hs, int do_rehash) return cfs_hash_rehash_worker(&hs->hs_rehash_wi); } -EXPORT_SYMBOL(cfs_hash_rehash); static int cfs_hash_rehash_bd(struct cfs_hash *hs, struct cfs_hash_bd *old) diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_mem.c b/drivers/staging/lustre/lustre/libcfs/libcfs_mem.c index f4e08daba4d9..27cf86106363 100644 --- a/drivers/staging/lustre/lustre/libcfs/libcfs_mem.c +++ b/drivers/staging/lustre/lustre/libcfs/libcfs_mem.c @@ -134,7 +134,6 @@ cfs_percpt_current(void *vars) return arr->va_ptrs[cpt]; } -EXPORT_SYMBOL(cfs_percpt_current); void * cfs_percpt_index(void *vars, int idx) @@ -146,7 +145,6 @@ cfs_percpt_index(void *vars, int idx) LASSERT(idx >= 0 && idx < arr->va_count); return arr->va_ptrs[idx]; } -EXPORT_SYMBOL(cfs_percpt_index); /* * free variable array, see more detail in cfs_array_alloc diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c index 8689ea757c99..59c7bf3cbc1f 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c @@ -195,6 +195,5 @@ void libcfs_unregister_panic_notifier(void) atomic_notifier_chain_unregister(&panic_notifier_list, &libcfs_panic_notifier); } -EXPORT_SYMBOL(libcfs_run_upcall); EXPORT_SYMBOL(libcfs_run_lbug_upcall); EXPORT_SYMBOL(lbug_with_loc); From 30a0a431e043b378bbf75e0f88d700812d24ef80 Mon Sep 17 00:00:00 2001 From: frank zago Date: Wed, 4 Nov 2015 13:39:59 -0500 Subject: [PATCH 354/843] staging: lustre: remove libcfs_debug_set_level prototype from libcfs_private.h The function libcfs_debug_set_level is used only internally so no reason to expose it in libcfs_private.h. This is broken out from LU-5829 patch http://review.whamcloud.com/13319. Signed-off-by: frank zago Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/include/linux/libcfs/libcfs_private.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h index f0b0423a716b..d6273e143324 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h @@ -185,8 +185,6 @@ int libcfs_debug_cleanup(void); int libcfs_debug_clear_buffer(void); int libcfs_debug_mark_buffer(const char *text); -void libcfs_debug_set_level(unsigned int debug_level); - /* * allocate per-cpu-partition data, returned value is an array of pointers, * variable can be indexed by CPU ID. From 9563fe8a2de9db5eb087fe0e48ec335ee66f8f41 Mon Sep 17 00:00:00 2001 From: Dmitry Eremin Date: Wed, 4 Nov 2015 13:40:00 -0500 Subject: [PATCH 355/843] staging: lustre: fix buffer overflow of string buffer Buffer overflow of string buffer due to non null terminated string. Use strlcpy() when it's justifiable. Use sizeof(var) instead of constants. Signed-off-by: Dmitry Eremin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629 Reviewed-on: http://review.whamcloud.com/9389 Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 9 +++++---- drivers/staging/lustre/lnet/lnet/config.c | 14 ++++++++------ drivers/staging/lustre/lnet/selftest/conrpc.c | 4 ++-- drivers/staging/lustre/lnet/selftest/console.c | 6 ++++-- .../staging/lustre/lustre/include/lustre_disk.h | 1 + drivers/staging/lustre/lustre/libcfs/debug.c | 6 +++--- drivers/staging/lustre/lustre/libcfs/hash.c | 3 +-- drivers/staging/lustre/lustre/libcfs/workitem.c | 4 ++-- drivers/staging/lustre/lustre/llite/dir.c | 2 +- drivers/staging/lustre/lustre/lov/lov_pool.c | 3 +-- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 10 +++++++--- drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 1 + drivers/staging/lustre/lustre/ptlrpc/sec_config.c | 3 +-- 13 files changed, 37 insertions(+), 29 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index ecfe73302350..46a24b4ead09 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -2621,8 +2621,8 @@ ksocknal_enumerate_interfaces(ksock_net_t *net) net->ksnn_interfaces[j].ksni_ipaddr = ip; net->ksnn_interfaces[j].ksni_netmask = mask; - strncpy(&net->ksnn_interfaces[j].ksni_name[0], - names[i], IFNAMSIZ); + strlcpy(net->ksnn_interfaces[j].ksni_name, + names[i], sizeof(net->ksnn_interfaces[j].ksni_name)); j++; } @@ -2805,8 +2805,9 @@ ksocknal_startup(lnet_ni_t *ni) goto fail_1; } - strncpy(&net->ksnn_interfaces[i].ksni_name[0], - ni->ni_interfaces[i], IFNAMSIZ); + strlcpy(net->ksnn_interfaces[i].ksni_name, + ni->ni_interfaces[i], + sizeof(net->ksnn_interfaces[i].ksni_name)); } net->ksnn_ninterfaces = i; } diff --git a/drivers/staging/lustre/lnet/lnet/config.c b/drivers/staging/lustre/lnet/lnet/config.c index 4e8b54b86c7d..5390ee9963ab 100644 --- a/drivers/staging/lustre/lnet/lnet/config.c +++ b/drivers/staging/lustre/lnet/lnet/config.c @@ -650,8 +650,8 @@ lnet_parse_route(char *str, int *im_a_router) INIT_LIST_HEAD(&nets); /* save a copy of the string for error messages */ - strncpy(cmd, str, sizeof(cmd) - 1); - cmd[sizeof(cmd) - 1] = 0; + strncpy(cmd, str, sizeof(cmd)); + cmd[sizeof(cmd) - 1] = '\0'; sep = str; for (;;) { @@ -972,11 +972,13 @@ lnet_splitnets(char *source, struct list_head *nets) return 0; offset += (int)(sep - tb->ltb_text); - tb2 = lnet_new_text_buf(strlen(sep)); + len = strlen(sep); + tb2 = lnet_new_text_buf(len); if (tb2 == NULL) return -ENOMEM; - strcpy(tb2->ltb_text, sep); + strncpy(tb2->ltb_text, sep, len); + tb2->ltb_text[len] = '\0'; list_add_tail(&tb2->ltb_list, nets); tb = tb2; @@ -1021,8 +1023,8 @@ lnet_match_networks(char **networksp, char *ip2nets, __u32 *ipaddrs, int nip) tb = list_entry(raw_entries.next, struct lnet_text_buf_t, ltb_list); - strncpy(source, tb->ltb_text, sizeof(source)-1); - source[sizeof(source)-1] = 0; + strncpy(source, tb->ltb_text, sizeof(source)); + source[sizeof(source)-1] = '\0'; /* replace ltb_text with the network(s) add on match */ rc = lnet_match_network_tokens(tb->ltb_text, ipaddrs, nip); diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index 64a0335934f3..1066c70434b1 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -612,8 +612,8 @@ lstcon_sesrpc_prep(lstcon_node_t *nd, int transop, msrq = &(*crpc)->crp_rpc->crpc_reqstmsg.msg_body.mksn_reqst; msrq->mksn_sid = console_session.ses_id; msrq->mksn_force = console_session.ses_force; - strncpy(msrq->mksn_name, console_session.ses_name, - strlen(console_session.ses_name)); + strlcpy(msrq->mksn_name, console_session.ses_name, + sizeof(msrq->mksn_name)); break; case LST_TRANS_SESEND: diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index 6862c9a15556..5619fc430e8d 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -1731,7 +1731,8 @@ lstcon_session_new(char *name, int key, unsigned feats, console_session.ses_feats_updated = 0; console_session.ses_timeout = (timeout <= 0) ? LST_CONSOLE_TIMEOUT : timeout; - strcpy(console_session.ses_name, name); + strlcpy(console_session.ses_name, name, + sizeof(console_session.ses_name)); rc = lstcon_batch_add(LST_DEFAULT_BATCH); if (rc != 0) @@ -1951,7 +1952,8 @@ lstcon_acceptor_handle(struct srpc_server_rpc *rpc) if (grp->grp_userland == 0) grp->grp_userland = 1; - strcpy(jrep->join_session, console_session.ses_name); + strlcpy(jrep->join_session, console_session.ses_name, + sizeof(jrep->join_session)); jrep->join_timeout = console_session.ses_timeout; jrep->join_status = 0; diff --git a/drivers/staging/lustre/lustre/include/lustre_disk.h b/drivers/staging/lustre/lustre/include/lustre_disk.h index 5e1ac129a681..7c6933ffc9c1 100644 --- a/drivers/staging/lustre/lustre/include/lustre_disk.h +++ b/drivers/staging/lustre/lustre/include/lustre_disk.h @@ -68,6 +68,7 @@ everything as string options */ #define LMD_MAGIC 0xbdacbd03 +#define LMD_PARAMS_MAXLEN 4096 /* gleaned from the mount command - no persistent info here */ struct lustre_mount_data { diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c b/drivers/staging/lustre/lustre/libcfs/debug.c index 4272a7c959d7..e56785a48242 100644 --- a/drivers/staging/lustre/lustre/libcfs/debug.c +++ b/drivers/staging/lustre/lustre/libcfs/debug.c @@ -504,9 +504,9 @@ int libcfs_debug_init(unsigned long bufsize) } if (libcfs_debug_file_path != NULL) { - strncpy(libcfs_debug_file_path_arr, - libcfs_debug_file_path, PATH_MAX-1); - libcfs_debug_file_path_arr[PATH_MAX - 1] = '\0'; + strlcpy(libcfs_debug_file_path_arr, + libcfs_debug_file_path, + sizeof(libcfs_debug_file_path_arr)); } /* If libcfs_debug_mb is set to an invalid value or uninitialized diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index f23a11ddc979..d285117af3ad 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -1037,8 +1037,7 @@ cfs_hash_create(char *name, unsigned cur_bits, unsigned max_bits, if (hs == NULL) return NULL; - strncpy(hs->hs_name, name, len); - hs->hs_name[len - 1] = '\0'; + strlcpy(hs->hs_name, name, len); hs->hs_flags = flags; atomic_set(&hs->hs_refcount, 1); diff --git a/drivers/staging/lustre/lustre/libcfs/workitem.c b/drivers/staging/lustre/lustre/libcfs/workitem.c index 268dd6851af4..6d988084dbb6 100644 --- a/drivers/staging/lustre/lustre/libcfs/workitem.c +++ b/drivers/staging/lustre/lustre/libcfs/workitem.c @@ -360,8 +360,8 @@ cfs_wi_sched_create(char *name, struct cfs_cpt_table *cptab, if (sched == NULL) return -ENOMEM; - strncpy(sched->ws_name, name, CFS_WS_NAME_LEN); - sched->ws_name[CFS_WS_NAME_LEN - 1] = '\0'; + strlcpy(sched->ws_name, name, CFS_WS_NAME_LEN); + sched->ws_cptab = cptab; sched->ws_cpt = cpt; diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 5c9502b5b358..951259a98323 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -641,7 +641,7 @@ static int ll_send_mgc_param(struct obd_export *mgc, char *string) if (!msp) return -ENOMEM; - strncpy(msp->mgs_param, string, MGS_PARAM_MAXLEN); + strlcpy(msp->mgs_param, string, sizeof(msp->mgs_param)); rc = obd_set_info_async(NULL, mgc, sizeof(KEY_SET_INFO), KEY_SET_INFO, sizeof(struct mgs_send_param), msp, NULL); if (rc) diff --git a/drivers/staging/lustre/lustre/lov/lov_pool.c b/drivers/staging/lustre/lustre/lov/lov_pool.c index b03827ef6514..b43ce6cd64c2 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pool.c +++ b/drivers/staging/lustre/lustre/lov/lov_pool.c @@ -412,8 +412,7 @@ int lov_pool_new(struct obd_device *obd, char *poolname) if (!new_pool) return -ENOMEM; - strncpy(new_pool->pool_name, poolname, LOV_MAXPOOLNAME); - new_pool->pool_name[LOV_MAXPOOLNAME] = '\0'; + strlcpy(new_pool->pool_name, poolname, sizeof(new_pool->pool_name)); new_pool->pool_lobd = obd; /* ref count init to 1 because when created a pool is always used * up to deletion diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c index 48003d5325e3..7617c57d16e0 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c @@ -892,7 +892,7 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd) } lmd->lmd_magic = LMD_MAGIC; - lmd->lmd_params = kzalloc(4096, GFP_NOFS); + lmd->lmd_params = kzalloc(LMD_PARAMS_MAXLEN, GFP_NOFS); if (!lmd->lmd_params) return -ENOMEM; lmd->lmd_params[0] = '\0'; @@ -978,7 +978,7 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd) goto invalid; clear++; } else if (strncmp(s1, "param=", 6) == 0) { - int length; + size_t length, params_length; char *tail = strchr(s1 + 6, ','); if (tail == NULL) @@ -986,8 +986,12 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd) else length = tail - s1; length -= 6; + params_length = strlen(lmd->lmd_params); + if (params_length + length + 1 >= LMD_PARAMS_MAXLEN) + return -E2BIG; strncat(lmd->lmd_params, s1 + 6, length); - strcat(lmd->lmd_params, " "); + lmd->lmd_params[params_length + length] = '\0'; + strlcat(lmd->lmd_params, " ", LMD_PARAMS_MAXLEN); clear++; } else if (strncmp(s1, "osd=", 4) == 0) { rc = lmd_parse_string(&lmd->lmd_osd_type, s1 + 4); diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c index ce036a1ac466..ac87aa12bd7e 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c @@ -422,6 +422,7 @@ static int ptlrpcd(void *arg) complete(&pc->pc_starting); /* + * This mainloop strongly resembles ptlrpc_set_wait() except that our * set never completes. ptlrpcd_check() calls ptlrpc_check_set() when * there are requests in the set. New requests come in on the set's diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c index 7ff948fe1424..7a206705865b 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c @@ -83,8 +83,7 @@ int sptlrpc_parse_flavor(const char *str, struct sptlrpc_flavor *flvr) return 0; } - strncpy(buf, str, sizeof(buf)); - buf[sizeof(buf) - 1] = '\0'; + strlcpy(buf, str, sizeof(buf)); bulk = strchr(buf, '-'); if (bulk) From b00917be6e90149286b3680f5e626787bcc75c55 Mon Sep 17 00:00:00 2001 From: Dmitry Eremin Date: Wed, 4 Nov 2015 13:40:01 -0500 Subject: [PATCH 356/843] staging: lustre: Fix possible NULL pointer dereference in lprocfs_status.c The imp->imp_connection really could be NULL, we better check for it before dereferencing it in taht call to libcfs_nid2str_r. Signed-off-by: Dmitry Eremin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6507 Reviewed-on: http://review.whamcloud.com/14808 Reviewed-by: Bob Glossman Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index 2de3c1b6fa49..dda5ad105f2e 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -665,15 +665,18 @@ int lprocfs_rd_import(struct seq_file *m, void *data) seq_printf(m, "%s%s", j ? ", " : "", nidstr); j++; } - libcfs_nid2str_r(imp->imp_connection->c_peer.nid, - nidstr, sizeof(nidstr)); + if (imp->imp_connection != NULL) + libcfs_nid2str_r(imp->imp_connection->c_peer.nid, + nidstr, sizeof(nidstr)); + else + strncpy(nidstr, "", sizeof(nidstr)); seq_printf(m, "]\n" " current_connection: %s\n" " connection_attempts: %u\n" " generation: %u\n" " in-progress_invalidations: %u\n", - imp->imp_connection == NULL ? "" : nidstr, + nidstr, imp->imp_conn_cnt, imp->imp_generation, atomic_read(&imp->imp_inval_count)); From a0455471582117d31659618c02146804df527ff4 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Wed, 4 Nov 2015 13:40:02 -0500 Subject: [PATCH 357/843] staging: lustre: Update module author to OpenSFS The modinfo data has gone stale for the author information. This patch changes all the MODULE_AUTHOR to OpenSFS. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6204 Reviewed-on: http://review.whamcloud.com/16132 Reviewed-by: Frank Zago Reviewed-by: Andreas Dilger Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 +- drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c | 2 +- drivers/staging/lustre/lnet/lnet/module.c | 2 +- drivers/staging/lustre/lustre/fid/fid_request.c | 2 +- drivers/staging/lustre/lustre/fld/fld_request.c | 2 +- drivers/staging/lustre/lustre/libcfs/module.c | 2 +- drivers/staging/lustre/lustre/llite/lloop.c | 2 +- drivers/staging/lustre/lustre/llite/super25.c | 2 +- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 2 +- drivers/staging/lustre/lustre/lov/lov_obd.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 2 +- drivers/staging/lustre/lustre/mgc/mgc_request.c | 2 +- drivers/staging/lustre/lustre/obdclass/class_obd.c | 2 +- drivers/staging/lustre/lustre/obdecho/echo_client.c | 2 +- drivers/staging/lustre/lustre/osc/osc_request.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index 7c730e3f7453..de0f85f8a2f9 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -2865,7 +2865,7 @@ static int __init kiblnd_module_init(void) return 0; } -MODULE_AUTHOR("Sun Microsystems, Inc. "); +MODULE_AUTHOR("OpenSFS, Inc. "); MODULE_DESCRIPTION("Kernel OpenIB gen2 LND v2.00"); MODULE_LICENSE("GPL"); diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index 46a24b4ead09..ebde0369edc8 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -2869,7 +2869,7 @@ ksocknal_module_init(void) return 0; } -MODULE_AUTHOR("Sun Microsystems, Inc. "); +MODULE_AUTHOR("OpenSFS, Inc. "); MODULE_DESCRIPTION("Kernel TCP Socket LND v3.0.0"); MODULE_LICENSE("GPL"); MODULE_VERSION("3.0.0"); diff --git a/drivers/staging/lustre/lnet/lnet/module.c b/drivers/staging/lustre/lnet/lnet/module.c index 576201a8390c..ac2fdf05a5fd 100644 --- a/drivers/staging/lustre/lnet/lnet/module.c +++ b/drivers/staging/lustre/lnet/lnet/module.c @@ -146,7 +146,7 @@ fini_lnet(void) lnet_fini(); } -MODULE_AUTHOR("Peter J. Braam "); +MODULE_AUTHOR("OpenSFS, Inc. "); MODULE_DESCRIPTION("LNet v3.1"); MODULE_LICENSE("GPL"); MODULE_VERSION("1.0.0"); diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c index e8176288452c..fe7c39afd1d9 100644 --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -462,7 +462,7 @@ static void __exit fid_mod_exit(void) ldebugfs_remove(&seq_debugfs_dir); } -MODULE_AUTHOR("Sun Microsystems, Inc. "); +MODULE_AUTHOR("OpenSFS, Inc. "); MODULE_DESCRIPTION("Lustre FID Module"); MODULE_LICENSE("GPL"); MODULE_VERSION("0.1.0"); diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c index 3fd91bc77da5..469df685f392 100644 --- a/drivers/staging/lustre/lustre/fld/fld_request.c +++ b/drivers/staging/lustre/lustre/fld/fld_request.c @@ -501,7 +501,7 @@ static void __exit fld_mod_exit(void) ldebugfs_remove(&fld_debugfs_dir); } -MODULE_AUTHOR("Sun Microsystems, Inc. "); +MODULE_AUTHOR("OpenSFS, Inc. "); MODULE_DESCRIPTION("Lustre FLD"); MODULE_LICENSE("GPL"); diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c index 07a68594c279..d781b417fd38 100644 --- a/drivers/staging/lustre/lustre/libcfs/module.c +++ b/drivers/staging/lustre/lustre/libcfs/module.c @@ -62,7 +62,7 @@ #include "../../include/linux/lnet/lnet.h" #include "tracefile.h" -MODULE_AUTHOR("Peter J. Braam "); +MODULE_AUTHOR("OpenSFS, Inc. "); MODULE_DESCRIPTION("Portals v3.1"); MODULE_LICENSE("GPL"); diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c index fed50d538a41..420d39123877 100644 --- a/drivers/staging/lustre/lustre/llite/lloop.c +++ b/drivers/staging/lustre/lustre/llite/lloop.c @@ -877,6 +877,6 @@ module_exit(lloop_exit); module_param(max_loop, int, 0444); MODULE_PARM_DESC(max_loop, "maximum of lloop_device"); -MODULE_AUTHOR("Sun Microsystems, Inc. "); +MODULE_AUTHOR("OpenSFS, Inc. "); MODULE_DESCRIPTION("Lustre virtual block device"); MODULE_LICENSE("GPL"); diff --git a/drivers/staging/lustre/lustre/llite/super25.c b/drivers/staging/lustre/lustre/llite/super25.c index 013136860664..7a9fafc67693 100644 --- a/drivers/staging/lustre/lustre/llite/super25.c +++ b/drivers/staging/lustre/lustre/llite/super25.c @@ -205,7 +205,7 @@ static void __exit exit_lustre_lite(void) kmem_cache_destroy(ll_file_data_slab); } -MODULE_AUTHOR("Sun Microsystems, Inc. "); +MODULE_AUTHOR("OpenSFS, Inc. "); MODULE_DESCRIPTION("Lustre Lite Client File System"); MODULE_LICENSE("GPL"); diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 55f801ba9826..a4de9a3fd847 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -2812,7 +2812,7 @@ static void lmv_exit(void) class_unregister_type(LUSTRE_LMV_NAME); } -MODULE_AUTHOR("Sun Microsystems, Inc. "); +MODULE_AUTHOR("OpenSFS, Inc. "); MODULE_DESCRIPTION("Lustre Logical Metadata Volume OBD driver"); MODULE_LICENSE("GPL"); diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index 6bd4ac051274..b52609aead4c 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -2352,7 +2352,7 @@ static void /*__exit*/ lov_exit(void) lu_kmem_fini(lov_caches); } -MODULE_AUTHOR("Sun Microsystems, Inc. "); +MODULE_AUTHOR("OpenSFS, Inc. "); MODULE_DESCRIPTION("Lustre Logical Object Volume OBD driver"); MODULE_LICENSE("GPL"); MODULE_VERSION(LUSTRE_VERSION_STRING); diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 3dd0d01856f1..294c05084b97 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -2532,7 +2532,7 @@ static void /*__exit*/ mdc_exit(void) class_unregister_type(LUSTRE_MDC_NAME); } -MODULE_AUTHOR("Sun Microsystems, Inc. "); +MODULE_AUTHOR("OpenSFS, Inc. "); MODULE_DESCRIPTION("Lustre Metadata Client"); MODULE_LICENSE("GPL"); diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index b73f8f21b6c5..2c4884727626 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -1725,7 +1725,7 @@ static void /*__exit*/ mgc_exit(void) class_unregister_type(LUSTRE_MGC_NAME); } -MODULE_AUTHOR("Sun Microsystems, Inc. "); +MODULE_AUTHOR("OpenSFS, Inc. "); MODULE_DESCRIPTION("Lustre Management Client"); MODULE_LICENSE("GPL"); diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c index 3e9c24684690..beb59f009cbe 100644 --- a/drivers/staging/lustre/lustre/obdclass/class_obd.c +++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c @@ -576,7 +576,7 @@ static void cleanup_obdclass(void) obd_zombie_impexp_stop(); } -MODULE_AUTHOR("Sun Microsystems, Inc. "); +MODULE_AUTHOR("OpenSFS, Inc. "); MODULE_DESCRIPTION("Lustre Class Driver Build Version: " BUILD_VERSION); MODULE_LICENSE("GPL"); MODULE_VERSION(LUSTRE_VERSION_STRING); diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index f49564f6bb89..14ac56bb0d77 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -2170,7 +2170,7 @@ static void /*__exit*/ obdecho_exit(void) } -MODULE_AUTHOR("Sun Microsystems, Inc. "); +MODULE_AUTHOR("OpenSFS, Inc. "); MODULE_DESCRIPTION("Lustre Testing Echo OBD driver"); MODULE_LICENSE("GPL"); MODULE_VERSION(LUSTRE_VERSION_STRING); diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index cfb3ce2111f8..d6c1447f6bd9 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -3358,7 +3358,7 @@ static void /*__exit*/ osc_exit(void) ptlrpc_free_rq_pool(osc_rq_pool); } -MODULE_AUTHOR("Sun Microsystems, Inc. "); +MODULE_AUTHOR("OpenSFS, Inc. "); MODULE_DESCRIPTION("Lustre Object Storage Client (OSC)"); MODULE_LICENSE("GPL"); MODULE_VERSION(LUSTRE_VERSION_STRING); diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c index 9deeb244166f..c4f1d0f5deb2 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c @@ -160,7 +160,7 @@ static void __exit ptlrpc_exit(void) ptlrpc_connection_fini(); } -MODULE_AUTHOR("Sun Microsystems, Inc. "); +MODULE_AUTHOR("OpenSFS, Inc. "); MODULE_DESCRIPTION("Lustre Request Processor and Lock Management"); MODULE_LICENSE("GPL"); MODULE_VERSION("1.0.0"); From 78368d578e9eab8dc9d42b9e9a2be78a98f4e9d9 Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Wed, 4 Nov 2015 13:40:04 -0500 Subject: [PATCH 358/843] staging: lustre: race condition for check/use cfs_fail_val There are some race conditions when check/use cfs_fail_val. For example: when inject failure stub for LFSCK test as following: 764 if (OBD_FAIL_CHECK(OBD_FAIL_LFSCK_DELAY2) && 765 cfs_fail_val > 0) { 766 struct l_wait_info lwi; 767 768 lwi = LWI_TIMEOUT(cfs_time_seconds(cfs_fail_val), 769 NULL, NULL); 770 l_wait_event(thread->t_ctl_waitq, 771 !thread_is_running(thread), 772 &lwi); 773 774 if (unlikely(!thread_is_running(thread))) { 775 CDEBUG(D_LFSCK, "%s: scan dir exit for engine " 776 "stop, parent "DFID", cookie "LPX64"n", 777 lfsck_lfsck2name(lfsck), 778 PFID(lfsck_dto2fid(dir)), 779 lfsck->li_cookie_dir); 780 RETURN(0); 781 } 782 } The "cfs_fail_val" may be changed as zero by others after the check at the line 765 but before using it at the line 768. Then the LFSCK engine will fall into "wait" until someone run "lfsck_stop". Signed-off-by: Fan Yong Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6146 Reviewed-on: http://review.whamcloud.com/13481 Reviewed-by: Lai Siyao Reviewed-by: Andreas Dilger Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/fail.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/libcfs/fail.c b/drivers/staging/lustre/lustre/libcfs/fail.c index d39fecebd12d..ea059b012a66 100644 --- a/drivers/staging/lustre/lustre/libcfs/fail.c +++ b/drivers/staging/lustre/lustre/libcfs/fail.c @@ -126,7 +126,7 @@ int __cfs_fail_timeout_set(__u32 id, __u32 value, int ms, int set) int ret; ret = __cfs_fail_check_set(id, value, set); - if (ret) { + if (ret && likely(ms > 0)) { CERROR("cfs_fail_timeout id %x sleeping for %dms\n", id, ms); set_current_state(TASK_UNINTERRUPTIBLE); From 9d3e85326f4c3c65a7e97c5406611a17142bd70f Mon Sep 17 00:00:00 2001 From: Liang Zhen Date: Wed, 4 Nov 2015 13:40:05 -0500 Subject: [PATCH 359/843] staging: lustre: remove page_collection::pc_lock in libcfs page_collection::pc_lock is supposed to protect race between functions called by smp_call_function(), however we don't have this use-case for ages and page_collection only lives in stack of thread, so it is safe to remove it. Signed-off-by: Liang Zhen Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3055 Reviewed-on: http://review.whamcloud.com/7660 Reviewed-by: Bobi Jam Reviewed-by: Sebastien Buisson Reviewed-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/tracefile.c | 14 -------------- drivers/staging/lustre/lustre/libcfs/tracefile.h | 8 -------- 2 files changed, 22 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c b/drivers/staging/lustre/lustre/libcfs/tracefile.c index f99d30f799e0..c27e3207e932 100644 --- a/drivers/staging/lustre/lustre/libcfs/tracefile.c +++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c @@ -199,7 +199,6 @@ static void cfs_tcd_shrink(struct cfs_trace_cpu_data *tcd) pgcount + 1, tcd->tcd_cur_pages); INIT_LIST_HEAD(&pc.pc_pages); - spin_lock_init(&pc.pc_lock); list_for_each_entry_safe(tage, tmp, &tcd->tcd_pages, linkage) { if (pgcount-- == 0) @@ -522,7 +521,6 @@ static void collect_pages_on_all_cpus(struct page_collection *pc) struct cfs_trace_cpu_data *tcd; int i, cpu; - spin_lock(&pc->pc_lock); for_each_possible_cpu(cpu) { cfs_tcd_for_each_type_lock(tcd, i, cpu) { list_splice_init(&tcd->tcd_pages, &pc->pc_pages); @@ -534,7 +532,6 @@ static void collect_pages_on_all_cpus(struct page_collection *pc) } } } - spin_unlock(&pc->pc_lock); } static void collect_pages(struct page_collection *pc) @@ -555,7 +552,6 @@ static void put_pages_back_on_all_cpus(struct page_collection *pc) struct cfs_trace_page *tmp; int i, cpu; - spin_lock(&pc->pc_lock); for_each_possible_cpu(cpu) { cfs_tcd_for_each_type_lock(tcd, i, cpu) { cur_head = tcd->tcd_pages.next; @@ -573,7 +569,6 @@ static void put_pages_back_on_all_cpus(struct page_collection *pc) } } } - spin_unlock(&pc->pc_lock); } static void put_pages_back(struct page_collection *pc) @@ -592,7 +587,6 @@ static void put_pages_on_tcd_daemon_list(struct page_collection *pc, struct cfs_trace_page *tage; struct cfs_trace_page *tmp; - spin_lock(&pc->pc_lock); list_for_each_entry_safe(tage, tmp, &pc->pc_pages, linkage) { __LASSERT_TAGE_INVARIANT(tage); @@ -616,7 +610,6 @@ static void put_pages_on_tcd_daemon_list(struct page_collection *pc, tcd->tcd_cur_daemon_pages--; } } - spin_unlock(&pc->pc_lock); } static void put_pages_on_daemon_list(struct page_collection *pc) @@ -636,8 +629,6 @@ void cfs_trace_debug_print(void) struct cfs_trace_page *tage; struct cfs_trace_page *tmp; - spin_lock_init(&pc.pc_lock); - pc.pc_want_daemon_pages = 1; collect_pages(&pc); list_for_each_entry_safe(tage, tmp, &pc.pc_pages, linkage) { @@ -692,7 +683,6 @@ int cfs_tracefile_dump_all_pages(char *filename) goto out; } - spin_lock_init(&pc.pc_lock); pc.pc_want_daemon_pages = 1; collect_pages(&pc); if (list_empty(&pc.pc_pages)) { @@ -739,8 +729,6 @@ void cfs_trace_flush_pages(void) struct cfs_trace_page *tage; struct cfs_trace_page *tmp; - spin_lock_init(&pc.pc_lock); - pc.pc_want_daemon_pages = 1; collect_pages(&pc); list_for_each_entry_safe(tage, tmp, &pc.pc_pages, linkage) { @@ -970,7 +958,6 @@ static int tracefiled(void *arg) /* we're started late enough that we pick up init's fs context */ /* this is so broken in uml? what on earth is going on? */ - spin_lock_init(&pc.pc_lock); complete(&tctl->tctl_start); while (1) { @@ -1170,7 +1157,6 @@ static void cfs_trace_cleanup(void) struct page_collection pc; INIT_LIST_HEAD(&pc.pc_pages); - spin_lock_init(&pc.pc_lock); trace_cleanup_on_all_cpus(); diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.h b/drivers/staging/lustre/lustre/libcfs/tracefile.h index 73d60e056922..e5fbeecf3567 100644 --- a/drivers/staging/lustre/lustre/libcfs/tracefile.h +++ b/drivers/staging/lustre/lustre/libcfs/tracefile.h @@ -195,14 +195,6 @@ extern union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS]; * be moved there */ struct page_collection { struct list_head pc_pages; - /* - * spin-lock protecting ->pc_pages. It is taken by smp_call_function() - * call-back functions. XXX nikita: Which is horrible: all processors - * receive NMI at the same time only to be serialized by this - * lock. Probably ->pc_pages should be replaced with an array of - * NR_CPUS elements accessed locklessly. - */ - spinlock_t pc_lock; /* * if this flag is set, collect_pages() will spill both * ->tcd_daemon_pages and ->tcd_pages to the ->pc_pages. Otherwise, From 5bfd446e7bd94ee6f9c17d07b5d47342b96b387a Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Wed, 4 Nov 2015 13:40:06 -0500 Subject: [PATCH 360/843] staging: lustre: fix 'error handling' issues for libcfs workitem.c Fix 'error handling' issues found by Coverity version 6.5.1: Unchecked return value (CHECKED_RETURN) Calling function without checking return value. Signed-off-by: Sebastien Buisson Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3427 Reviewed-on: http://review.whamcloud.com/7103 Reviewed-by: Bobbie Lind Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/workitem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/libcfs/workitem.c b/drivers/staging/lustre/lustre/libcfs/workitem.c index 6d988084dbb6..b57acbfb061b 100644 --- a/drivers/staging/lustre/lustre/libcfs/workitem.c +++ b/drivers/staging/lustre/lustre/libcfs/workitem.c @@ -225,7 +225,9 @@ cfs_wi_scheduler (void *arg) /* CPT affinity scheduler? */ if (sched->ws_cptab != NULL) - cfs_cpt_bind(sched->ws_cptab, sched->ws_cpt); + if (cfs_cpt_bind(sched->ws_cptab, sched->ws_cpt) != 0) + CWARN("Failed to bind %s on CPT %d\n", + sched->ws_name, sched->ws_cpt); spin_lock(&cfs_wi_data.wi_glock); From 14e384ce758d613cf9da0b3fb4c2e66d58917ac0 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Thu, 5 Nov 2015 10:55:16 +0100 Subject: [PATCH 361/843] staging: lustre: Delete an unnecessary variable initialisation in class_register_type() The variable "rc" will be eventually set to an error return code in the class_register_type() function. Thus let us omit the explicit initialisation at the beginning. Signed-off-by: Markus Elfring Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/genops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index 08966562d7fe..26f54f950350 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -155,7 +155,7 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops, struct lu_device_type *ldt) { struct obd_type *type; - int rc = 0; + int rc; /* sanity check */ LASSERT(strnlen(name, CLASS_MAX_NAME) < CLASS_MAX_NAME); From ee98e44249a95832f24469d8caa8a693b88f854a Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Fri, 6 Nov 2015 20:26:52 +0530 Subject: [PATCH 362/843] staging: lustre: lnet: klnds: socklnd: Move extern declarations to header This patch moves extern declarations in socklnd_lib.c to the respective header file, 'socklnd.h'. This patch also removes extern keyword from function declarations since functions have the extern specifier by default. Signed-off-by: Amitoj Kaur Chawla Acked-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h | 3 +++ drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h index b349847f9cf9..f4fa72550657 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h @@ -679,6 +679,9 @@ int ksocknal_lib_recv_kiov(ksock_conn_t *conn); int ksocknal_lib_get_conn_tunables(ksock_conn_t *conn, int *txmem, int *rxmem, int *nagle); +void ksocknal_read_callback(ksock_conn_t *conn); +void ksocknal_write_callback(ksock_conn_t *conn); + int ksocknal_tunables_init(void); void ksocknal_lib_csum_tx(ksock_tx_t *tx); diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c index 679785b0209c..04a4653c549a 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c @@ -580,8 +580,6 @@ ksocknal_lib_push_conn(ksock_conn_t *conn) ksocknal_connsock_decref(conn); } -extern void ksocknal_read_callback(ksock_conn_t *conn); -extern void ksocknal_write_callback(ksock_conn_t *conn); /* * socket call back in Linux */ From c6ef5b91f3df7d22c058a135871d5827add94498 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Fri, 6 Nov 2015 22:25:29 +0530 Subject: [PATCH 363/843] Staging: lustre: dir: Remove wrapper function Remove the function ll_check_page() and replace all its calls with the function it wrapped. Signed-off-by: Shivani Bhardwaj Acked-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/dir.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 951259a98323..5c2ef92809e6 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -239,12 +239,6 @@ static int ll_dir_filler(void *_hash, struct page *page0) return rc; } -static void ll_check_page(struct inode *dir, struct page *page) -{ - /* XXX: check page format later */ - SetPageChecked(page); -} - void ll_release_page(struct page *page, int remove) { kunmap(page); @@ -432,7 +426,8 @@ struct page *ll_get_dir_page(struct inode *dir, __u64 hash, goto fail; } if (!PageChecked(page)) - ll_check_page(dir, page); + /* XXX: check page format later */ + SetPageChecked(page); if (PageError(page)) { CERROR("page error: "DFID" at %llu: rc %d\n", PFID(ll_inode2fid(dir)), hash, -5); From e4ce7f7779313ff23f958049b91cc7ac1b24d8e8 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Fri, 6 Nov 2015 22:48:29 +0530 Subject: [PATCH 364/843] Staging: lustre: module: Replace function calls Replace the calls of function cfs_trace_free_string_buffer() with kfree() as the former function is not required. Signed-off-by: Shivani Bhardwaj Acked-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c index d781b417fd38..96d9d4651a51 100644 --- a/drivers/staging/lustre/lustre/libcfs/module.c +++ b/drivers/staging/lustre/lustre/libcfs/module.c @@ -392,7 +392,7 @@ static int __proc_dobitmasks(void *data, int write, } else { rc = cfs_trace_copyin_string(tmpstr, tmpstrlen, buffer, nob); if (rc < 0) { - cfs_trace_free_string_buffer(tmpstr, tmpstrlen); + kfree(tmpstr); return rc; } @@ -402,7 +402,7 @@ static int __proc_dobitmasks(void *data, int write, *mask |= D_EMERG; } - cfs_trace_free_string_buffer(tmpstr, tmpstrlen); + kfree(tmpstr); return rc; } From 7cbf673d8b4a68916fe362fe9a9c3a55a604700e Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Fri, 6 Nov 2015 22:49:07 +0530 Subject: [PATCH 365/843] Staging: lustre: tracefile: Remove wrapper function Remove the function cfs_trace_free_string_buffer() as it can be replaced with the standard function kfree(). Signed-off-by: Shivani Bhardwaj Acked-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/tracefile.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c b/drivers/staging/lustre/lustre/libcfs/tracefile.c index c27e3207e932..65c4f1ab0de8 100644 --- a/drivers/staging/lustre/lustre/libcfs/tracefile.c +++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c @@ -805,11 +805,6 @@ int cfs_trace_allocate_string_buffer(char **str, int nob) return 0; } -void cfs_trace_free_string_buffer(char *str, int nob) -{ - kfree(str); -} - int cfs_trace_dump_debug_buffer_usrstr(void __user *usr_str, int usr_str_nob) { char *str; @@ -830,7 +825,7 @@ int cfs_trace_dump_debug_buffer_usrstr(void __user *usr_str, int usr_str_nob) } rc = cfs_tracefile_dump_all_pages(str); out: - cfs_trace_free_string_buffer(str, usr_str_nob + 1); + kfree(str); return rc; } @@ -886,7 +881,7 @@ int cfs_trace_daemon_command_usrstr(void __user *usr_str, int usr_str_nob) if (rc == 0) rc = cfs_trace_daemon_command(str); - cfs_trace_free_string_buffer(str, usr_str_nob + 1); + kfree(str); return rc; } From 7fb6f46b14d01a185dfe563a8ba20cda514d4f9a Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Fri, 6 Nov 2015 22:49:43 +0530 Subject: [PATCH 366/843] Staging: lustre: tracefile: Remove function prototype Remove the prototype of function cfs_trace_free_string_buffer() as it is no longer needed. Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/tracefile.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.h b/drivers/staging/lustre/lustre/libcfs/tracefile.h index e5fbeecf3567..6b37798336f2 100644 --- a/drivers/staging/lustre/lustre/libcfs/tracefile.h +++ b/drivers/staging/lustre/lustre/libcfs/tracefile.h @@ -70,7 +70,6 @@ int cfs_trace_copyin_string(char *knl_buffer, int knl_buffer_nob, int cfs_trace_copyout_string(char __user *usr_buffer, int usr_buffer_nob, const char *knl_str, char *append); int cfs_trace_allocate_string_buffer(char **str, int nob); -void cfs_trace_free_string_buffer(char *str, int nob); int cfs_trace_dump_debug_buffer_usrstr(void __user *usr_str, int usr_str_nob); int cfs_trace_daemon_command(char *str); int cfs_trace_daemon_command_usrstr(void __user *usr_str, int usr_str_nob); From 7c37abe0e1e970a7793a05c0953b44ac078f0a11 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Fri, 6 Nov 2015 23:13:19 +0530 Subject: [PATCH 367/843] Staging: lustre: ldlm_pool: Remove unneeded wrapper function Remove the function ldlm_pl2ns() and replace its calls with the function it wrapped. Signed-off-by: Shivani Bhardwaj Acked-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/ldlm/ldlm_pool.c | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c index 1a4eef64658f..2beb36b081a3 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c @@ -176,11 +176,6 @@ enum { LDLM_POOL_LAST_STAT }; -static inline struct ldlm_namespace *ldlm_pl2ns(struct ldlm_pool *pl) -{ - return container_of(pl, struct ldlm_namespace, ns_pool); -} - /** * Calculates suggested grant_step in % of available locks for passed * \a period. This is later used in grant_plan calculations. @@ -254,7 +249,8 @@ static void ldlm_pool_recalc_stats(struct ldlm_pool *pl) } /** - * Sets SLV and Limit from ldlm_pl2ns(pl)->ns_obd tp passed \a pl. + * Sets SLV and Limit from container_of(pl, struct ldlm_namespace, + * ns_pool)->ns_obd tp passed \a pl. */ static void ldlm_cli_pool_pop_slv(struct ldlm_pool *pl) { @@ -264,7 +260,8 @@ static void ldlm_cli_pool_pop_slv(struct ldlm_pool *pl) * Get new SLV and Limit from obd which is updated with coming * RPCs. */ - obd = ldlm_pl2ns(pl)->ns_obd; + obd = container_of(pl, struct ldlm_namespace, + ns_pool)->ns_obd; LASSERT(obd != NULL); read_lock(&obd->obd_pool_lock); pl->pl_server_lock_volume = obd->obd_pool_slv; @@ -304,7 +301,8 @@ static int ldlm_cli_pool_recalc(struct ldlm_pool *pl) /* * Do not cancel locks in case lru resize is disabled for this ns. */ - if (!ns_connect_lru_resize(ldlm_pl2ns(pl))) { + if (!ns_connect_lru_resize(container_of(pl, struct ldlm_namespace, + ns_pool))) { ret = 0; goto out; } @@ -315,7 +313,8 @@ static int ldlm_cli_pool_recalc(struct ldlm_pool *pl) * It may be called when SLV has changed much, this is why we do not * take into account pl->pl_recalc_time here. */ - ret = ldlm_cancel_lru(ldlm_pl2ns(pl), 0, LCF_ASYNC, LDLM_CANCEL_LRUR); + ret = ldlm_cancel_lru(container_of(pl, struct ldlm_namespace, ns_pool), + 0, LCF_ASYNC, LDLM_CANCEL_LRUR); out: spin_lock(&pl->pl_lock); @@ -341,7 +340,7 @@ static int ldlm_cli_pool_shrink(struct ldlm_pool *pl, struct ldlm_namespace *ns; int unused; - ns = ldlm_pl2ns(pl); + ns = container_of(pl, struct ldlm_namespace, ns_pool); /* * Do not cancel locks in case lru resize is disabled for this ns. @@ -558,7 +557,8 @@ static struct kobj_type ldlm_pl_ktype = { static int ldlm_pool_sysfs_init(struct ldlm_pool *pl) { - struct ldlm_namespace *ns = ldlm_pl2ns(pl); + struct ldlm_namespace *ns = container_of(pl, struct ldlm_namespace, + ns_pool); int err; init_completion(&pl->pl_kobj_unregister); @@ -570,7 +570,8 @@ static int ldlm_pool_sysfs_init(struct ldlm_pool *pl) static int ldlm_pool_debugfs_init(struct ldlm_pool *pl) { - struct ldlm_namespace *ns = ldlm_pl2ns(pl); + struct ldlm_namespace *ns = container_of(pl, struct ldlm_namespace, + ns_pool); struct dentry *debugfs_ns_parent; struct lprocfs_vars pool_vars[2]; char *var_name = NULL; From 946d6f9577438f5d344aa8545fba2b7885118b5f Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Fri, 6 Nov 2015 23:13:56 +0530 Subject: [PATCH 368/843] Staging: lustre: ldlm_pool: Drop wrapper function Remove the function ldlm_pool_get_limit() and replace its calls with the function it wrapped. Signed-off-by: Shivani Bhardwaj Acked-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c index 2beb36b081a3..20cf38931ea7 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c @@ -207,14 +207,6 @@ static inline int ldlm_pool_t2gsp(unsigned int t) (t >> LDLM_POOL_GSP_STEP_SHIFT)); } -/** - * Returns current \a pl limit. - */ -static __u32 ldlm_pool_get_limit(struct ldlm_pool *pl) -{ - return atomic_read(&pl->pl_limit); -} - /** * Sets passed \a limit to \a pl. */ @@ -452,7 +444,7 @@ static int lprocfs_pool_state_seq_show(struct seq_file *m, void *unused) spin_lock(&pl->pl_lock); slv = pl->pl_server_lock_volume; clv = pl->pl_client_lock_volume; - limit = ldlm_pool_get_limit(pl); + limit = atomic_read(&pl->pl_limit); granted = atomic_read(&pl->pl_granted); grant_rate = atomic_read(&pl->pl_grant_rate); cancel_rate = atomic_read(&pl->pl_cancel_rate); From f7ec22b5fa0423d1bd7c5cf3f811c539307a595d Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Fri, 6 Nov 2015 23:14:32 +0530 Subject: [PATCH 369/843] Staging: lustre: ldlm_pool: Drop unneeded wrapper function Remove the function ldlm_pool_set_limit() and replace its calls with the function it wrapped. Signed-off-by: Shivani Bhardwaj Acked-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c index 20cf38931ea7..e59b2864180f 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c @@ -207,14 +207,6 @@ static inline int ldlm_pool_t2gsp(unsigned int t) (t >> LDLM_POOL_GSP_STEP_SHIFT)); } -/** - * Sets passed \a limit to \a pl. - */ -static void ldlm_pool_set_limit(struct ldlm_pool *pl, __u32 limit) -{ - atomic_set(&pl->pl_limit, limit); -} - /** * Recalculates next stats on passed \a pl. * @@ -257,7 +249,7 @@ static void ldlm_cli_pool_pop_slv(struct ldlm_pool *pl) LASSERT(obd != NULL); read_lock(&obd->obd_pool_lock); pl->pl_server_lock_volume = obd->obd_pool_slv; - ldlm_pool_set_limit(pl, obd->obd_pool_limit); + atomic_set(&pl->pl_limit, obd->obd_pool_limit); read_unlock(&obd->obd_pool_lock); } @@ -678,7 +670,7 @@ int ldlm_pool_init(struct ldlm_pool *pl, struct ldlm_namespace *ns, snprintf(pl->pl_name, sizeof(pl->pl_name), "ldlm-pool-%s-%d", ldlm_ns_name(ns), idx); - ldlm_pool_set_limit(pl, 1); + atomic_set(&pl->pl_limit, 1); pl->pl_server_lock_volume = 0; pl->pl_ops = &ldlm_cli_pool_ops; pl->pl_recalc_period = LDLM_POOL_CLI_DEF_RECALC_PERIOD; From ed73749426deb2810d4b66a25d6441c5fe8de2b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Oudompheng?= Date: Mon, 2 Nov 2015 11:39:22 +0100 Subject: [PATCH 370/843] staging: rtl8188eu: jiffies are unsigned long MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove rtw_get_passing_time_ms function and adjust type of relevant variables. Signed-off-by: Rémy Oudompheng Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_efuse.c | 4 +- drivers/staging/rtl8188eu/core/rtw_mlme.c | 13 +++--- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 43 ++++++++++++------- drivers/staging/rtl8188eu/core/rtw_pwrctrl.c | 14 +++--- .../staging/rtl8188eu/hal/rtl8188e_hal_init.c | 4 +- drivers/staging/rtl8188eu/hal/usb_halinit.c | 10 +++-- .../staging/rtl8188eu/include/osdep_service.h | 2 - drivers/staging/rtl8188eu/os_dep/os_intfs.c | 10 +++-- .../staging/rtl8188eu/os_dep/osdep_service.c | 6 --- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 8 ++-- 10 files changed, 62 insertions(+), 52 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c b/drivers/staging/rtl8188eu/core/rtw_efuse.c index eb894233a785..2320fb11af24 100644 --- a/drivers/staging/rtl8188eu/core/rtw_efuse.c +++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c @@ -224,7 +224,7 @@ static void efuse_read_phymap_from_txpktbuf( ) { u16 dbg_addr = 0; - u32 start = 0, passing_time = 0; + unsigned long start = 0; u8 reg_0x143 = 0; u32 lo32 = 0, hi32 = 0; u16 len = 0, count = 0; @@ -248,7 +248,7 @@ static void efuse_read_phymap_from_txpktbuf( usb_write8(adapter, REG_TXPKTBUF_DBG, 0); start = jiffies; while (!(reg_0x143 = usb_read8(adapter, REG_TXPKTBUF_DBG)) && - (passing_time = rtw_get_passing_time_ms(start)) < 1000) { + jiffies_to_msecs(jiffies - start) < 1000) { DBG_88E("%s polling reg_0x143:0x%02x, reg_0x106:0x%02x\n", __func__, reg_0x143, usb_read8(adapter, 0x106)); usleep_range(1000, 2000); } diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c index c1b82f71b682..1bf5c4819897 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c @@ -163,7 +163,8 @@ exit: static void _rtw_free_network(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwork, u8 isfreeall) { - u32 curr_time, delta_time; + unsigned long curr_time; + u32 delta_time; u32 lifetime = SCANQUEUE_LIFETIME; struct __queue *free_queue = &(pmlmepriv->free_bss_pool); @@ -272,7 +273,7 @@ int rtw_if_up(struct adapter *padapter) void rtw_generate_random_ibss(u8 *pibss) { - u32 curtime = jiffies; + unsigned long curtime = jiffies; pibss[0] = 0x02; /* in ad-hoc mode bit1 must set to 1 */ pibss[1] = 0x11; @@ -878,14 +879,14 @@ inline void rtw_indicate_scan_done(struct adapter *padapter, bool aborted) void rtw_scan_abort(struct adapter *adapter) { - u32 start; + unsigned long start; struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); struct mlme_ext_priv *pmlmeext = &(adapter->mlmeextpriv); start = jiffies; pmlmeext->scan_abort = true; while (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) && - rtw_get_passing_time_ms(start) <= 200) { + jiffies_to_msecs(jiffies - start) <= 200) { if (adapter->bDriverStopped || adapter->bSurpriseRemoved) break; DBG_88E(FUNC_NDEV_FMT"fw_state=_FW_UNDER_SURVEY!\n", FUNC_NDEV_ARG(adapter->pnetdev)); @@ -1474,6 +1475,7 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv , struct wlan_network **candidate, struct wlan_network *competitor) { int updated = false; + unsigned long since_scan; struct adapter *adapter = container_of(pmlmepriv, struct adapter, mlmepriv); @@ -1494,7 +1496,8 @@ static int rtw_check_join_candidate(struct mlme_priv *pmlmepriv goto exit; if (pmlmepriv->to_roaming) { - if (rtw_get_passing_time_ms((u32)competitor->last_scanned) >= RTW_SCAN_RESULT_EXPIRE || + since_scan = jiffies - competitor->last_scanned; + if (jiffies_to_msecs(since_scan) >= RTW_SCAN_RESULT_EXPIRE || is_same_ess(&competitor->network, &pmlmepriv->cur_network.network) == false) goto exit; } diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index a9bff48868ef..3eca6874b6df 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -708,7 +708,7 @@ static int issue_probereq_ex(struct adapter *padapter, { int ret; int i = 0; - u32 start = jiffies; + unsigned long start = jiffies; do { ret = issue_probereq(padapter, pssid, da, wait_ms > 0 ? true : false); @@ -732,11 +732,13 @@ static int issue_probereq_ex(struct adapter *padapter, if (da) DBG_88E(FUNC_ADPT_FMT" to %pM, ch:%u%s, %d/%d in %u ms\n", FUNC_ADPT_ARG(padapter), da, rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", i, try_cnt, rtw_get_passing_time_ms(start)); + ret == _SUCCESS ? ", acked" : "", i, try_cnt, + jiffies_to_msecs(jiffies - start)); else DBG_88E(FUNC_ADPT_FMT", ch:%u%s, %d/%d in %u ms\n", FUNC_ADPT_ARG(padapter), rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", i, try_cnt, rtw_get_passing_time_ms(start)); + ret == _SUCCESS ? ", acked" : "", i, try_cnt, + jiffies_to_msecs(jiffies - start)); } exit: return ret; @@ -1293,7 +1295,7 @@ int issue_nulldata(struct adapter *padapter, unsigned char *da, unsigned int pow { int ret; int i = 0; - u32 start = jiffies; + unsigned long start = jiffies; struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct wlan_bssid_ex *pnetwork = &(pmlmeinfo->network); @@ -1323,11 +1325,13 @@ int issue_nulldata(struct adapter *padapter, unsigned char *da, unsigned int pow if (da) DBG_88E(FUNC_ADPT_FMT" to %pM, ch:%u%s, %d/%d in %u ms\n", FUNC_ADPT_ARG(padapter), da, rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", i, try_cnt, rtw_get_passing_time_ms(start)); + ret == _SUCCESS ? ", acked" : "", i, try_cnt, + jiffies_to_msecs(jiffies - start)); else DBG_88E(FUNC_ADPT_FMT", ch:%u%s, %d/%d in %u ms\n", FUNC_ADPT_ARG(padapter), rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", i, try_cnt, rtw_get_passing_time_ms(start)); + ret == _SUCCESS ? ", acked" : "", i, try_cnt, + jiffies_to_msecs(jiffies - start)); } exit: return ret; @@ -1418,7 +1422,7 @@ int issue_qos_nulldata(struct adapter *padapter, unsigned char *da, u16 tid, int { int ret; int i = 0; - u32 start = jiffies; + unsigned long start = jiffies; struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct wlan_bssid_ex *pnetwork = &(pmlmeinfo->network); @@ -1448,11 +1452,13 @@ int issue_qos_nulldata(struct adapter *padapter, unsigned char *da, u16 tid, int if (da) DBG_88E(FUNC_ADPT_FMT" to %pM, ch:%u%s, %d/%d in %u ms\n", FUNC_ADPT_ARG(padapter), da, rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", i, try_cnt, rtw_get_passing_time_ms(start)); + ret == _SUCCESS ? ", acked" : "", i, try_cnt, + jiffies_to_msecs(jiffies - start)); else DBG_88E(FUNC_ADPT_FMT", ch:%u%s, %d/%d in %u ms\n", FUNC_ADPT_ARG(padapter), rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", i, try_cnt, rtw_get_passing_time_ms(start)); + ret == _SUCCESS ? ", acked" : "", i, try_cnt, + jiffies_to_msecs(jiffies - start)); } exit: return ret; @@ -1530,7 +1536,7 @@ static int issue_deauth_ex(struct adapter *padapter, u8 *da, { int ret; int i = 0; - u32 start = jiffies; + unsigned long start = jiffies; do { ret = _issue_deauth(padapter, da, reason, wait_ms > 0 ? true : false); @@ -1553,11 +1559,13 @@ static int issue_deauth_ex(struct adapter *padapter, u8 *da, if (da) DBG_88E(FUNC_ADPT_FMT" to %pM, ch:%u%s, %d/%d in %u ms\n", FUNC_ADPT_ARG(padapter), da, rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", i, try_cnt, rtw_get_passing_time_ms(start)); + ret == _SUCCESS ? ", acked" : "", i, try_cnt, + jiffies_to_msecs(jiffies - start)); else DBG_88E(FUNC_ADPT_FMT", ch:%u%s, %d/%d in %u ms\n", FUNC_ADPT_ARG(padapter), rtw_get_oper_ch(padapter), - ret == _SUCCESS ? ", acked" : "", i, try_cnt, rtw_get_passing_time_ms(start)); + ret == _SUCCESS ? ", acked" : "", i, try_cnt, + jiffies_to_msecs(jiffies - start)); } exit: return ret; @@ -1959,7 +1967,7 @@ unsigned int send_beacon(struct adapter *padapter) int issue = 0; int poll = 0; - u32 start = jiffies; + unsigned long start = jiffies; rtw_hal_set_hwreg(padapter, HW_VAR_BCN_VALID, NULL); do { @@ -1975,13 +1983,16 @@ unsigned int send_beacon(struct adapter *padapter) if (padapter->bSurpriseRemoved || padapter->bDriverStopped) return _FAIL; if (!bxmitok) { - DBG_88E("%s fail! %u ms\n", __func__, rtw_get_passing_time_ms(start)); + DBG_88E("%s fail! %u ms\n", __func__, + jiffies_to_msecs(jiffies - start)); return _FAIL; } else { - u32 passing_time = rtw_get_passing_time_ms(start); + u32 passing_time = jiffies_to_msecs(jiffies - start); if (passing_time > 100 || issue > 3) - DBG_88E("%s success, issue:%d, poll:%d, %u ms\n", __func__, issue, poll, rtw_get_passing_time_ms(start)); + DBG_88E("%s success, issue:%d, poll:%d, %u ms\n", + __func__, issue, poll, + jiffies_to_msecs(jiffies - start)); return _SUCCESS; } } diff --git a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c index 9765946466ab..5e1ef9fdcf47 100644 --- a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c @@ -348,7 +348,7 @@ void rtw_set_rpwm(struct adapter *padapter, u8 pslv) static u8 PS_RDY_CHECK(struct adapter *padapter) { - u32 curr_time, delta_time; + unsigned long curr_time, delta_time; struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); @@ -418,7 +418,7 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a */ s32 LPS_RF_ON_check(struct adapter *padapter, u32 delay_ms) { - u32 start_time; + unsigned long start_time; u8 bAwake = false; s32 err = 0; @@ -435,7 +435,7 @@ s32 LPS_RF_ON_check(struct adapter *padapter, u32 delay_ms) break; } - if (rtw_get_passing_time_ms(start_time) > delay_ms) { + if (jiffies_to_msecs(jiffies - start_time) > delay_ms) { err = -1; DBG_88E("%s: Wait for FW LPS leave more than %u ms!!!\n", __func__, delay_ms); break; @@ -561,24 +561,24 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; unsigned long expires; + unsigned long start; int ret = _SUCCESS; expires = jiffies + msecs_to_jiffies(ips_deffer_ms); if (time_before(pwrpriv->ips_deny_time, expires)) pwrpriv->ips_deny_time = jiffies + msecs_to_jiffies(ips_deffer_ms); -{ - u32 start = jiffies; + start = jiffies; if (pwrpriv->ps_processing) { DBG_88E("%s wait ps_processing...\n", __func__); - while (pwrpriv->ps_processing && rtw_get_passing_time_ms(start) <= 3000) + while (pwrpriv->ps_processing && + jiffies_to_msecs(jiffies - start) <= 3000) usleep_range(1000, 3000); if (pwrpriv->ps_processing) DBG_88E("%s wait ps_processing timeout\n", __func__); else DBG_88E("%s wait ps_processing done\n", __func__); } -} /* System suspend is not allowed to wakeup */ if ((!pwrpriv->bInternalAutoSuspend) && (pwrpriv->bInSuspend)) { diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c index e3e5d6f5d4f9..03cf84c4bb06 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c @@ -53,7 +53,7 @@ s32 iol_execute(struct adapter *padapter, u8 control) { s32 status = _FAIL; u8 reg_0x88 = 0; - u32 start = 0, passing_time = 0; + unsigned long start = 0; control = control&0x0f; reg_0x88 = usb_read8(padapter, REG_HMEBOX_E0); @@ -61,7 +61,7 @@ s32 iol_execute(struct adapter *padapter, u8 control) start = jiffies; while ((reg_0x88 = usb_read8(padapter, REG_HMEBOX_E0)) & control && - (passing_time = rtw_get_passing_time_ms(start)) < 1000) { + jiffies_to_msecs(jiffies - start) < 1000) { ; } diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c b/drivers/staging/rtl8188eu/hal/usb_halinit.c index 7e72259f0e40..5789e1e23f0a 100644 --- a/drivers/staging/rtl8188eu/hal/usb_halinit.c +++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c @@ -684,7 +684,7 @@ static u32 rtl8188eu_hal_init(struct adapter *Adapter) struct hal_data_8188e *haldata = GET_HAL_DATA(Adapter); struct pwrctrl_priv *pwrctrlpriv = &Adapter->pwrctrlpriv; struct registry_priv *pregistrypriv = &Adapter->registrypriv; - u32 init_start_time = jiffies; + unsigned long init_start_time = jiffies; #define HAL_INIT_PROFILE_TAG(stage) do {} while (0) @@ -903,7 +903,8 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_LCK); exit: HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_END); - DBG_88E("%s in %dms\n", __func__, rtw_get_passing_time_ms(init_start_time)); + DBG_88E("%s in %dms\n", __func__, + jiffies_to_msecs(jiffies - init_start_time)); return status; @@ -1149,14 +1150,15 @@ static void _ReadRFType(struct adapter *Adapter) static void _ReadAdapterInfo8188EU(struct adapter *Adapter) { - u32 start = jiffies; + unsigned long start = jiffies; MSG_88E("====> %s\n", __func__); _ReadRFType(Adapter);/* rf_chip -> _InitRFType() */ _ReadPROMContent(Adapter); - MSG_88E("<==== %s in %d ms\n", __func__, rtw_get_passing_time_ms(start)); + MSG_88E("<==== %s in %d ms\n", __func__, + jiffies_to_msecs(jiffies - start)); } #define GPIO_DEBUG_PORT_NUM 0 diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h b/drivers/staging/rtl8188eu/include/osdep_service.h index e24fe8cc3d0b..22de53d6539a 100644 --- a/drivers/staging/rtl8188eu/include/osdep_service.h +++ b/drivers/staging/rtl8188eu/include/osdep_service.h @@ -87,8 +87,6 @@ u32 _rtw_down_sema(struct semaphore *sema); void _rtw_init_queue(struct __queue *pqueue); -s32 rtw_get_passing_time_ms(u32 start); - struct rtw_netdev_priv_indicator { void *priv; u32 sizeof_priv; diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c b/drivers/staging/rtl8188eu/os_dep/os_intfs.c index d063d02db7f0..9201b94d017c 100644 --- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c +++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c @@ -1100,7 +1100,7 @@ netdev_open_error: int rtw_ips_pwr_up(struct adapter *padapter) { int result; - u32 start_time = jiffies; + unsigned long start_time = jiffies; DBG_88E("===> rtw_ips_pwr_up..............\n"); rtw_reset_drv_sw(padapter); @@ -1109,13 +1109,14 @@ int rtw_ips_pwr_up(struct adapter *padapter) rtw_led_control(padapter, LED_CTL_NO_LINK); - DBG_88E("<=== rtw_ips_pwr_up.............. in %dms\n", rtw_get_passing_time_ms(start_time)); + DBG_88E("<=== rtw_ips_pwr_up.............. in %dms\n", + jiffies_to_msecs(jiffies - start_time)); return result; } void rtw_ips_pwr_down(struct adapter *padapter) { - u32 start_time = jiffies; + unsigned long start_time = jiffies; DBG_88E("===> rtw_ips_pwr_down...................\n"); @@ -1124,7 +1125,8 @@ void rtw_ips_pwr_down(struct adapter *padapter) rtw_led_control(padapter, LED_CTL_POWER_OFF); rtw_ips_dev_unload(padapter); - DBG_88E("<=== rtw_ips_pwr_down..................... in %dms\n", rtw_get_passing_time_ms(start_time)); + DBG_88E("<=== rtw_ips_pwr_down..................... in %dms\n", + jiffies_to_msecs(jiffies - start_time)); } void rtw_ips_dev_unload(struct adapter *padapter) diff --git a/drivers/staging/rtl8188eu/os_dep/osdep_service.c b/drivers/staging/rtl8188eu/os_dep/osdep_service.c index 466cd76fc1c4..d87b54711c0d 100644 --- a/drivers/staging/rtl8188eu/os_dep/osdep_service.c +++ b/drivers/staging/rtl8188eu/os_dep/osdep_service.c @@ -77,12 +77,6 @@ void _rtw_init_queue(struct __queue *pqueue) spin_lock_init(&(pqueue->lock)); } -/* the input parameter start must be in jiffies */ -inline s32 rtw_get_passing_time_ms(u32 start) -{ - return jiffies_to_msecs(jiffies-start); -} - struct net_device *rtw_alloc_etherdev_with_old_priv(int sizeof_priv, void *old_priv) { diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index 82a7c27c517f..01d50f7c1667 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c @@ -227,7 +227,7 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) struct net_device *pnetdev = padapter->pnetdev; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; - u32 start_time = jiffies; + unsigned long start_time = jiffies; pr_debug("==> %s (%s:%d)\n", __func__, current->comm, current->pid); @@ -282,7 +282,7 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) exit: pr_debug("<=== %s .............. in %dms\n", __func__, - rtw_get_passing_time_ms(start_time)); + jiffies_to_msecs(jiffies - start_time)); return 0; } @@ -292,7 +292,7 @@ static int rtw_resume_process(struct adapter *padapter) struct net_device *pnetdev; struct pwrctrl_priv *pwrpriv = NULL; int ret = -1; - u32 start_time = jiffies; + unsigned long start_time = jiffies; pr_debug("==> %s (%s:%d)\n", __func__, current->comm, current->pid); @@ -323,7 +323,7 @@ exit: if (pwrpriv) pwrpriv->bInSuspend = false; pr_debug("<=== %s return %d.............. in %dms\n", __func__, - ret, rtw_get_passing_time_ms(start_time)); + ret, jiffies_to_msecs(jiffies - start_time)); return ret; } From 3913c19ae7a3ede2fa4f1787630fa71c55ff8d23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Oudompheng?= Date: Mon, 2 Nov 2015 11:43:09 +0100 Subject: [PATCH 371/843] staging: rtl8188eu: add missing delay in polling loops. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously the code could exit with failure too early. Signed-off-by: Rémy Oudompheng Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c index 03cf84c4bb06..2592bc298f84 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c @@ -62,7 +62,7 @@ s32 iol_execute(struct adapter *padapter, u8 control) start = jiffies; while ((reg_0x88 = usb_read8(padapter, REG_HMEBOX_E0)) & control && jiffies_to_msecs(jiffies - start) < 1000) { - ; + udelay(5); } reg_0x88 = usb_read8(padapter, REG_HMEBOX_E0); @@ -242,6 +242,7 @@ static s32 _LLTWrite(struct adapter *padapter, u32 address, u32 data) status = _FAIL; break; } + udelay(5); } while (count++); return status; From 2b5a10a923e6541f20581b0557785a55e0039436 Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 3 Nov 2015 00:16:09 +0700 Subject: [PATCH 372/843] staging: rtl8188eu: do .. while (0) loop replaced by while (...) loop It is a simple and clear representation of this loop. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_cmd.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c index 9b7026e7d55b..f0ac66de34d6 100644 --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c @@ -242,15 +242,11 @@ post_process: pcmdpriv->cmdthd_running = false; /* free all cmd_obj resources */ - do { - pcmd = rtw_dequeue_cmd(&pcmdpriv->cmd_queue); - if (pcmd == NULL) - break; - + while ((pcmd = rtw_dequeue_cmd(&pcmdpriv->cmd_queue))) { /* DBG_88E("%s: leaving... drop cmdcode:%u\n", __func__, pcmd->cmdcode); */ rtw_free_cmd_obj(pcmd); - } while (1); + } up(&pcmdpriv->terminate_cmdthread_sema); From 72fb6c5a9dbc8cff8308d42b9de4f7c49bbcdcb4 Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 3 Nov 2015 00:16:28 +0700 Subject: [PATCH 373/843] staging: rtl8188eu: while loop replaced by for loop Here is more suitable for loop. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_mlme.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c index 1bf5c4819897..abab854e6889 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c @@ -366,20 +366,13 @@ struct wlan_network *rtw_get_oldest_wlan_network(struct __queue *scanned_queue) phead = get_list_head(scanned_queue); - plist = phead->next; - - while (1) { - if (phead == plist) - break; - + for (plist = phead->next; plist != phead; plist = plist->next) { pwlan = container_of(plist, struct wlan_network, list); if (!pwlan->fixed) { if (oldest == NULL || time_after(oldest->last_scanned, pwlan->last_scanned)) oldest = pwlan; } - - plist = plist->next; } return oldest; } From 37efd082311371ad387d9067128e5924eebd5790 Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 3 Nov 2015 00:16:53 +0700 Subject: [PATCH 374/843] staging: rtl8188eu: 'infinite' loop removed The body of this loop is executed only once, so it can be removed. In this loop no keyword 'continue', only 'break' at the end. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8188eu/hal/rtl8188eu_xmit.c | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c index 7c5086ecff17..e04303ce80af 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c @@ -463,30 +463,26 @@ s32 rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmitp } /* 3 1. pick up first frame */ - do { - rtw_free_xmitframe(pxmitpriv, pxmitframe); + rtw_free_xmitframe(pxmitpriv, pxmitframe); - pxmitframe = rtw_dequeue_xframe(pxmitpriv, pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry); - if (pxmitframe == NULL) { - /* no more xmit frame, release xmit buffer */ - rtw_free_xmitbuf(pxmitpriv, pxmitbuf); - return false; - } + pxmitframe = rtw_dequeue_xframe(pxmitpriv, pxmitpriv->hwxmits, pxmitpriv->hwxmit_entry); + if (pxmitframe == NULL) { + /* no more xmit frame, release xmit buffer */ + rtw_free_xmitbuf(pxmitpriv, pxmitbuf); + return false; + } - pxmitframe->pxmitbuf = pxmitbuf; - pxmitframe->buf_addr = pxmitbuf->pbuf; - pxmitbuf->priv_data = pxmitframe; + pxmitframe->pxmitbuf = pxmitbuf; + pxmitframe->buf_addr = pxmitbuf->pbuf; + pxmitbuf->priv_data = pxmitframe; - pxmitframe->agg_num = 1; /* alloc xmitframe should assign to 1. */ - pxmitframe->pkt_offset = 1; /* first frame of aggregation, reserve offset */ + pxmitframe->agg_num = 1; /* alloc xmitframe should assign to 1. */ + pxmitframe->pkt_offset = 1; /* first frame of aggregation, reserve offset */ - rtw_xmitframe_coalesce(adapt, pxmitframe->pkt, pxmitframe); + rtw_xmitframe_coalesce(adapt, pxmitframe->pkt, pxmitframe); - /* always return ndis_packet after rtw_xmitframe_coalesce */ - rtw_os_xmit_complete(adapt, pxmitframe); - - break; - } while (1); + /* always return ndis_packet after rtw_xmitframe_coalesce */ + rtw_os_xmit_complete(adapt, pxmitframe); /* 3 2. aggregate same priority and same DA(AP or STA) frames */ pfirstframe = pxmitframe; From 6d9b0f00ecf3f991ae8d4124211cad7c5122cbbc Mon Sep 17 00:00:00 2001 From: Abdul Hussain Date: Tue, 3 Nov 2015 05:30:56 +0000 Subject: [PATCH 375/843] Staging: rtl8188eu: fix space prohibited before that ',' This patch fixes the following checkpatch.pl error: fix space prohibited before that ',' Signed-off-by: Abdul Hussain Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_xmit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c index 11dbfc060b0d..e778132b73dc 100644 --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c @@ -641,7 +641,7 @@ static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitfr if (pattrib->psta) stainfo = pattrib->psta; else - stainfo = rtw_get_stainfo(&padapter->stapriv , &pattrib->ra[0]); + stainfo = rtw_get_stainfo(&padapter->stapriv, &pattrib->ra[0]); hw_hdr_offset = TXDESC_SIZE + (pxmitframe->pkt_offset * PACKET_OFFSET_SZ); @@ -1702,12 +1702,12 @@ u32 rtw_get_ff_hwaddr(struct xmit_frame *pxmitframe) return addr; } -static void do_queue_select(struct adapter *padapter, struct pkt_attrib *pattrib) +static void do_queue_select(struct adapter *padapter, struct pkt_attrib *pattrib) { u8 qsel; qsel = pattrib->priority; - RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, ("### do_queue_select priority=%d , qsel = %d\n", pattrib->priority , qsel)); + RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, ("### do_queue_select priority=%d , qsel = %d\n", pattrib->priority, qsel)); pattrib->qsel = qsel; } From 52863d83f3112b009aec82403c63f8fcf1c6c4cb Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 3 Nov 2015 16:43:53 +0700 Subject: [PATCH 376/843] staging: rtl8188eu: *(ptr + i) replaced by ptr[i] in _rtl88e_fw_block_write It is better to read. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/fw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c index 23aa6d37acac..af93697a6ab9 100644 --- a/drivers/staging/rtl8188eu/hal/fw.c +++ b/drivers/staging/rtl8188eu/hal/fw.c @@ -68,7 +68,7 @@ static void _rtl88e_fw_block_write(struct adapter *adapt, for (i = 0; i < blk_cnt; i++) { offset = i * blk_sz; usb_write32(adapt, (FW_8192C_START_ADDRESS + offset), - *(pu4BytePtr + i)); + pu4BytePtr[i]); } if (remain) { @@ -76,7 +76,7 @@ static void _rtl88e_fw_block_write(struct adapter *adapt, buf_ptr += offset; for (i = 0; i < remain; i++) { usb_write8(adapt, (FW_8192C_START_ADDRESS + - offset + i), *(buf_ptr + i)); + offset + i), buf_ptr[i]); } } } From d44f58f7c5c737c6f95f3adf4af00a4a19746d9f Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 3 Nov 2015 16:45:00 +0700 Subject: [PATCH 377/843] staging: rtl8188eu: assigning a value to the variable is replaced by the increment It is made to the initial value could be placed in the offset variable. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/fw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c index af93697a6ab9..70825e05fae9 100644 --- a/drivers/staging/rtl8188eu/hal/fw.c +++ b/drivers/staging/rtl8188eu/hal/fw.c @@ -65,10 +65,12 @@ static void _rtl88e_fw_block_write(struct adapter *adapt, blk_cnt = size / blk_sz; remain = size % blk_sz; + offset = 0; + for (i = 0; i < blk_cnt; i++) { - offset = i * blk_sz; usb_write32(adapt, (FW_8192C_START_ADDRESS + offset), pu4BytePtr[i]); + offset += blk_sz; } if (remain) { From 1c48deffc7fa48a341ccc4bcef41f8ce2eab645f Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 3 Nov 2015 16:46:08 +0700 Subject: [PATCH 378/843] staging: rtl8188eu: initial value placed in the variable Line become shorter. After the loop offset variable points to the location following insertion. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/fw.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c index 70825e05fae9..99dd1f03afec 100644 --- a/drivers/staging/rtl8188eu/hal/fw.c +++ b/drivers/staging/rtl8188eu/hal/fw.c @@ -65,11 +65,10 @@ static void _rtl88e_fw_block_write(struct adapter *adapt, blk_cnt = size / blk_sz; remain = size % blk_sz; - offset = 0; + offset = FW_8192C_START_ADDRESS; for (i = 0; i < blk_cnt; i++) { - usb_write32(adapt, (FW_8192C_START_ADDRESS + offset), - pu4BytePtr[i]); + usb_write32(adapt, offset, pu4BytePtr[i]); offset += blk_sz; } From 37d5579095b380f3328a5106354c0999eeca60f2 Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 3 Nov 2015 16:46:53 +0700 Subject: [PATCH 379/843] staging: rtl8188eu: offset variable replaced by its value It is now possible to get rid of re-initializing the offset variable. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/fw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c index 99dd1f03afec..9673686bdc47 100644 --- a/drivers/staging/rtl8188eu/hal/fw.c +++ b/drivers/staging/rtl8188eu/hal/fw.c @@ -74,7 +74,7 @@ static void _rtl88e_fw_block_write(struct adapter *adapt, if (remain) { offset = blk_cnt * blk_sz; - buf_ptr += offset; + buf_ptr += blk_cnt * blk_sz; for (i = 0; i < remain; i++) { usb_write8(adapt, (FW_8192C_START_ADDRESS + offset + i), buf_ptr[i]); From 8107b147d78ba5f04ed5e809041b17273c1f5a02 Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 3 Nov 2015 16:47:32 +0700 Subject: [PATCH 380/843] staging: rtl8188eu: unnecessary variable override removed Variable value calculated in the previous loop. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/fw.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c index 9673686bdc47..39c5a055fc1b 100644 --- a/drivers/staging/rtl8188eu/hal/fw.c +++ b/drivers/staging/rtl8188eu/hal/fw.c @@ -73,11 +73,9 @@ static void _rtl88e_fw_block_write(struct adapter *adapt, } if (remain) { - offset = blk_cnt * blk_sz; buf_ptr += blk_cnt * blk_sz; for (i = 0; i < remain; i++) { - usb_write8(adapt, (FW_8192C_START_ADDRESS + - offset + i), buf_ptr[i]); + usb_write8(adapt, offset + i, buf_ptr[i]); } } } From f464b3a08cefe3febcd30068d0a7ecd28f085b2d Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 3 Nov 2015 16:48:22 +0700 Subject: [PATCH 381/843] staging: rtl8188eu: unnecessary branching removed If the 'remain' is zero, the loop is not executed at all. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/fw.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c index 39c5a055fc1b..44e807803a36 100644 --- a/drivers/staging/rtl8188eu/hal/fw.c +++ b/drivers/staging/rtl8188eu/hal/fw.c @@ -72,11 +72,9 @@ static void _rtl88e_fw_block_write(struct adapter *adapt, offset += blk_sz; } - if (remain) { - buf_ptr += blk_cnt * blk_sz; - for (i = 0; i < remain; i++) { - usb_write8(adapt, offset + i, buf_ptr[i]); - } + buf_ptr += blk_cnt * blk_sz; + for (i = 0; i < remain; i++) { + usb_write8(adapt, offset + i, buf_ptr[i]); } } From ec60e037c7e3e6b38b5c153d009d4f9161dd9e16 Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 3 Nov 2015 16:49:13 +0700 Subject: [PATCH 382/843] staging: rtl8188eu: offset increment placed into for loop header It makes the code little easier. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/fw.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c index 44e807803a36..3cfd2b2bc868 100644 --- a/drivers/staging/rtl8188eu/hal/fw.c +++ b/drivers/staging/rtl8188eu/hal/fw.c @@ -67,14 +67,13 @@ static void _rtl88e_fw_block_write(struct adapter *adapt, offset = FW_8192C_START_ADDRESS; - for (i = 0; i < blk_cnt; i++) { + for (i = 0; i < blk_cnt; i++, offset += blk_sz) { usb_write32(adapt, offset, pu4BytePtr[i]); - offset += blk_sz; } buf_ptr += blk_cnt * blk_sz; - for (i = 0; i < remain; i++) { - usb_write8(adapt, offset + i, buf_ptr[i]); + for (i = 0; i < remain; i++, offset++) { + usb_write8(adapt, offset, buf_ptr[i]); } } From 1e7e93ee6da0ee4c9054a9cb70748f1c34fe15bf Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 3 Nov 2015 16:51:11 +0700 Subject: [PATCH 383/843] staging: rtl8188eu: buf_ptr variable completely defined in a single line It is simpler. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/fw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c index 3cfd2b2bc868..4f1c3a2997b8 100644 --- a/drivers/staging/rtl8188eu/hal/fw.c +++ b/drivers/staging/rtl8188eu/hal/fw.c @@ -71,7 +71,7 @@ static void _rtl88e_fw_block_write(struct adapter *adapt, usb_write32(adapt, offset, pu4BytePtr[i]); } - buf_ptr += blk_cnt * blk_sz; + buf_ptr = buffer + blk_cnt * blk_sz; for (i = 0; i < remain; i++, offset++) { usb_write8(adapt, offset, buf_ptr[i]); } From 645d2a8f463c70f27fef2507952b71fdae71cf41 Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 3 Nov 2015 16:51:47 +0700 Subject: [PATCH 384/843] staging: rtl8188eu: types of local variables conformed with types of function arguments The array should not change in any case. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/fw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c index 4f1c3a2997b8..8eafd7e34f4a 100644 --- a/drivers/staging/rtl8188eu/hal/fw.c +++ b/drivers/staging/rtl8188eu/hal/fw.c @@ -58,8 +58,8 @@ static void _rtl88e_fw_block_write(struct adapter *adapt, const u8 *buffer, u32 size) { u32 blk_sz = sizeof(u32); - u8 *buf_ptr = (u8 *)buffer; - u32 *pu4BytePtr = (u32 *)buffer; + const u8 *buf_ptr = (u8 *)buffer; + const u32 *pu4BytePtr = (u32 *)buffer; u32 i, offset, blk_cnt, remain; blk_cnt = size / blk_sz; From 429078e1f1ddf549ff9e282ed4a485b607b945cb Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 3 Nov 2015 16:52:23 +0700 Subject: [PATCH 385/843] staging: rtl8188eu: unnecessary initialization removed It is superfluous. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/fw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c index 8eafd7e34f4a..b48f4447dc40 100644 --- a/drivers/staging/rtl8188eu/hal/fw.c +++ b/drivers/staging/rtl8188eu/hal/fw.c @@ -58,7 +58,7 @@ static void _rtl88e_fw_block_write(struct adapter *adapt, const u8 *buffer, u32 size) { u32 blk_sz = sizeof(u32); - const u8 *buf_ptr = (u8 *)buffer; + const u8 *buf_ptr; const u32 *pu4BytePtr = (u32 *)buffer; u32 i, offset, blk_cnt, remain; From 6e84aa6c8251f9d5cb086cb9ba8d1a59a59e5cd9 Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 3 Nov 2015 16:53:43 +0700 Subject: [PATCH 386/843] staging: rtl8188eu: unnessesary braces for single statement block removed checkpatch fix: WARNING: braces {} are not necessary for single statement blocks Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/fw.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c index b48f4447dc40..04ae5836d121 100644 --- a/drivers/staging/rtl8188eu/hal/fw.c +++ b/drivers/staging/rtl8188eu/hal/fw.c @@ -67,14 +67,12 @@ static void _rtl88e_fw_block_write(struct adapter *adapt, offset = FW_8192C_START_ADDRESS; - for (i = 0; i < blk_cnt; i++, offset += blk_sz) { + for (i = 0; i < blk_cnt; i++, offset += blk_sz) usb_write32(adapt, offset, pu4BytePtr[i]); - } buf_ptr = buffer + blk_cnt * blk_sz; - for (i = 0; i < remain; i++, offset++) { + for (i = 0; i < remain; i++, offset++) usb_write8(adapt, offset, buf_ptr[i]); - } } static void _rtl88e_fill_dummy(u8 *pfwbuf, u32 *pfwlen) From 988c5146885f0f16e9124b4ae8e840229c4dc6d6 Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 3 Nov 2015 16:54:10 +0700 Subject: [PATCH 387/843] staging: rtl8188eu: buf_ptr renamed to byte_buffer This name is better suited for this variable. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/fw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c index 04ae5836d121..f8f212f1e0af 100644 --- a/drivers/staging/rtl8188eu/hal/fw.c +++ b/drivers/staging/rtl8188eu/hal/fw.c @@ -58,7 +58,7 @@ static void _rtl88e_fw_block_write(struct adapter *adapt, const u8 *buffer, u32 size) { u32 blk_sz = sizeof(u32); - const u8 *buf_ptr; + const u8 *byte_buffer; const u32 *pu4BytePtr = (u32 *)buffer; u32 i, offset, blk_cnt, remain; @@ -70,9 +70,9 @@ static void _rtl88e_fw_block_write(struct adapter *adapt, for (i = 0; i < blk_cnt; i++, offset += blk_sz) usb_write32(adapt, offset, pu4BytePtr[i]); - buf_ptr = buffer + blk_cnt * blk_sz; + byte_buffer = buffer + blk_cnt * blk_sz; for (i = 0; i < remain; i++, offset++) - usb_write8(adapt, offset, buf_ptr[i]); + usb_write8(adapt, offset, byte_buffer[i]); } static void _rtl88e_fill_dummy(u8 *pfwbuf, u32 *pfwlen) From 7e91b28a015e1b478fe5e872dc8e46fc867c418f Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 3 Nov 2015 16:54:28 +0700 Subject: [PATCH 388/843] staging: rtl8188eu: pu4BytePtr renamed to dword_buffer This name is better suited for this variable. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/fw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c index f8f212f1e0af..059e7ee761ca 100644 --- a/drivers/staging/rtl8188eu/hal/fw.c +++ b/drivers/staging/rtl8188eu/hal/fw.c @@ -59,7 +59,7 @@ static void _rtl88e_fw_block_write(struct adapter *adapt, { u32 blk_sz = sizeof(u32); const u8 *byte_buffer; - const u32 *pu4BytePtr = (u32 *)buffer; + const u32 *dword_buffer = (u32 *)buffer; u32 i, offset, blk_cnt, remain; blk_cnt = size / blk_sz; @@ -68,7 +68,7 @@ static void _rtl88e_fw_block_write(struct adapter *adapt, offset = FW_8192C_START_ADDRESS; for (i = 0; i < blk_cnt; i++, offset += blk_sz) - usb_write32(adapt, offset, pu4BytePtr[i]); + usb_write32(adapt, offset, dword_buffer[i]); byte_buffer = buffer + blk_cnt * blk_sz; for (i = 0; i < remain; i++, offset++) From 13cab3d422e89ccdcc78377e76299a2fdb4df90b Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Tue, 3 Nov 2015 16:54:45 +0700 Subject: [PATCH 389/843] staging: rtl8188eu: offset renamed to write_address This name is better suited for this variable. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/fw.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c index 059e7ee761ca..8c0230125d00 100644 --- a/drivers/staging/rtl8188eu/hal/fw.c +++ b/drivers/staging/rtl8188eu/hal/fw.c @@ -60,19 +60,19 @@ static void _rtl88e_fw_block_write(struct adapter *adapt, u32 blk_sz = sizeof(u32); const u8 *byte_buffer; const u32 *dword_buffer = (u32 *)buffer; - u32 i, offset, blk_cnt, remain; + u32 i, write_address, blk_cnt, remain; blk_cnt = size / blk_sz; remain = size % blk_sz; - offset = FW_8192C_START_ADDRESS; + write_address = FW_8192C_START_ADDRESS; - for (i = 0; i < blk_cnt; i++, offset += blk_sz) - usb_write32(adapt, offset, dword_buffer[i]); + for (i = 0; i < blk_cnt; i++, write_address += blk_sz) + usb_write32(adapt, write_address, dword_buffer[i]); byte_buffer = buffer + blk_cnt * blk_sz; - for (i = 0; i < remain; i++, offset++) - usb_write8(adapt, offset, byte_buffer[i]); + for (i = 0; i < remain; i++, write_address++) + usb_write8(adapt, write_address, byte_buffer[i]); } static void _rtl88e_fill_dummy(u8 *pfwbuf, u32 *pfwlen) From 08ecab13e1677396edcd57459e47d25272f9179b Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Wed, 4 Nov 2015 18:58:41 +0700 Subject: [PATCH 390/843] staging: rtl8188eu: for loop instead of while loop used The range of elements to fill with zeros is determined by using a roundup macro Signed-off-by: Ivan Safonov Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/fw.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c index 8c0230125d00..4d72537644b3 100644 --- a/drivers/staging/rtl8188eu/hal/fw.c +++ b/drivers/staging/rtl8188eu/hal/fw.c @@ -77,18 +77,12 @@ static void _rtl88e_fw_block_write(struct adapter *adapt, static void _rtl88e_fill_dummy(u8 *pfwbuf, u32 *pfwlen) { - u32 fwlen = *pfwlen; - u8 remain = (u8)(fwlen % 4); + u32 i; - remain = (remain == 0) ? 0 : (4 - remain); + for (i = *pfwlen; i < roundup(*pfwlen, 4); i++) + pfwbuf[i] = 0; - while (remain > 0) { - pfwbuf[fwlen] = 0; - fwlen++; - remain--; - } - - *pfwlen = fwlen; + *pfwlen = i; } static void _rtl88e_fw_page_write(struct adapter *adapt, From 940f90eae69b6f548c9c03c416bccb5331e6bfac Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Thu, 5 Nov 2015 16:56:38 +0700 Subject: [PATCH 391/843] staging: rtl8188eu: rarely used macros replaced by their definitions IS_* macros (except one) occur only once. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/hal_com.c | 14 +++++++------- drivers/staging/rtl8188eu/hal/rtl8188e_dm.c | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/hal_com.c b/drivers/staging/rtl8188eu/hal/hal_com.c index 38e9fdc312d3..3871cda2eec2 100644 --- a/drivers/staging/rtl8188eu/hal/hal_com.c +++ b/drivers/staging/rtl8188eu/hal/hal_com.c @@ -32,19 +32,19 @@ void dump_chip_info(struct HAL_VERSION chip_vers) char buf[128]; cnt += sprintf((buf+cnt), "Chip Version Info: CHIP_8188E_"); - cnt += sprintf((buf+cnt), "%s_", IS_NORMAL_CHIP(chip_vers) ? + cnt += sprintf((buf+cnt), "%s_", chip_vers.ChipType == NORMAL_CHIP ? "Normal_Chip" : "Test_Chip"); - cnt += sprintf((buf+cnt), "%s_", IS_CHIP_VENDOR_TSMC(chip_vers) ? + cnt += sprintf((buf+cnt), "%s_", chip_vers.VendorType == CHIP_VENDOR_TSMC ? "TSMC" : "UMC"); - if (IS_A_CUT(chip_vers)) + if (chip_vers.CUTVersion == A_CUT_VERSION) cnt += sprintf((buf+cnt), "A_CUT_"); - else if (IS_B_CUT(chip_vers)) + else if (chip_vers.CUTVersion == B_CUT_VERSION) cnt += sprintf((buf+cnt), "B_CUT_"); - else if (IS_C_CUT(chip_vers)) + else if (chip_vers.CUTVersion == C_CUT_VERSION) cnt += sprintf((buf+cnt), "C_CUT_"); - else if (IS_D_CUT(chip_vers)) + else if (chip_vers.CUTVersion == D_CUT_VERSION) cnt += sprintf((buf+cnt), "D_CUT_"); - else if (IS_E_CUT(chip_vers)) + else if (chip_vers.CUTVersion == E_CUT_VERSION) cnt += sprintf((buf+cnt), "E_CUT_"); else cnt += sprintf((buf+cnt), "UNKNOWN_CUT(%d)_", diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c b/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c index fca590949409..199a77acd7a9 100644 --- a/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c @@ -67,7 +67,7 @@ static void Init_ODM_ComInfo_88E(struct adapter *Adapter) ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_FAB_VER, fab_ver); ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_CUT_VER, cut_ver); - ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_MP_TEST_CHIP, IS_NORMAL_CHIP(hal_data->VersionID)); + ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_MP_TEST_CHIP, hal_data->VersionID.ChipType == NORMAL_CHIP ? true : false); ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_PATCH_ID, hal_data->CustomerID); ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_BWIFI_TEST, Adapter->registrypriv.wifi_spec); From d14c07f6ff63d43c536c312c1b14837d44dbe020 Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Thu, 5 Nov 2015 16:58:56 +0700 Subject: [PATCH 392/843] staging: rtl8188eu: unused macros removed IS_* and GET_CVID_* macros have not been used. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8188eu/core/rtw_ioctl_set.c | 7 ---- drivers/staging/rtl8188eu/include/HalVerDef.h | 33 ------------------- 2 files changed, 40 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c index 22f5b45f5f7f..cf60717a6c19 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c +++ b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c @@ -27,13 +27,6 @@ extern void indicate_wx_scan_complete_event(struct adapter *padapter); -#define IS_MAC_ADDRESS_BROADCAST(addr) \ -(\ - ((addr[0] == 0xff) && (addr[1] == 0xff) && \ - (addr[2] == 0xff) && (addr[3] == 0xff) && \ - (addr[4] == 0xff) && (addr[5] == 0xff)) ? true : false \ -) - u8 rtw_do_join(struct adapter *padapter) { struct list_head *plist, *phead; diff --git a/drivers/staging/rtl8188eu/include/HalVerDef.h b/drivers/staging/rtl8188eu/include/HalVerDef.h index 56b4ff08e509..6f2b2a436b04 100644 --- a/drivers/staging/rtl8188eu/include/HalVerDef.h +++ b/drivers/staging/rtl8188eu/include/HalVerDef.h @@ -47,37 +47,4 @@ struct HAL_VERSION { enum HAL_VENDOR VendorType; }; -/* Get element */ -#define GET_CVID_CHIP_TYPE(version) (((version).ChipType)) -#define GET_CVID_MANUFACTUER(version) (((version).VendorType)) -#define GET_CVID_CUT_VERSION(version) (((version).CUTVersion)) - -/* Common Macro. -- */ -/* HAL_VERSION VersionID */ - -/* HAL_CHIP_TYPE_E */ -#define IS_TEST_CHIP(version) \ - ((GET_CVID_CHIP_TYPE(version) == TEST_CHIP) ? true : false) -#define IS_NORMAL_CHIP(version) \ - ((GET_CVID_CHIP_TYPE(version) == NORMAL_CHIP) ? true : false) - -/* HAL_CUT_VERSION_E */ -#define IS_A_CUT(version) \ - ((GET_CVID_CUT_VERSION(version) == A_CUT_VERSION) ? true : false) -#define IS_B_CUT(version) \ - ((GET_CVID_CUT_VERSION(version) == B_CUT_VERSION) ? true : false) -#define IS_C_CUT(version) \ - ((GET_CVID_CUT_VERSION(version) == C_CUT_VERSION) ? true : false) -#define IS_D_CUT(version) \ - ((GET_CVID_CUT_VERSION(version) == D_CUT_VERSION) ? true : false) -#define IS_E_CUT(version) \ - ((GET_CVID_CUT_VERSION(version) == E_CUT_VERSION) ? true : false) - - -/* HAL_VENDOR_E */ -#define IS_CHIP_VENDOR_TSMC(version) \ - ((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_TSMC) ? true : false) -#define IS_CHIP_VENDOR_UMC(version) \ - ((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_UMC) ? true : false) - #endif From 4a3bda22fdf0b9ccc674675cbe87d781207c799e Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Fri, 6 Nov 2015 22:17:29 +0700 Subject: [PATCH 393/843] staging: rtl8188eu: goto replaced by 'else' branch goto is not needed here. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_cmd.c | 27 +++++++++++------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c index f0ac66de34d6..f90a2bfbb819 100644 --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c @@ -201,24 +201,21 @@ _next: if (rtw_cmd_filter(pcmdpriv, pcmd) == _FAIL) { pcmd->res = H2C_DROPPED; - goto post_process; - } - - if (pcmd->cmdcode < ARRAY_SIZE(wlancmds)) { - cmd_hdl = wlancmds[pcmd->cmdcode].h2cfuns; - - if (cmd_hdl) { - ret = cmd_hdl(pcmd->padapter, pcmd->parmbuf); - pcmd->res = ret; - } } else { - pcmd->res = H2C_PARAMETERS_ERROR; + if (pcmd->cmdcode < ARRAY_SIZE(wlancmds)) { + cmd_hdl = wlancmds[pcmd->cmdcode].h2cfuns; + + if (cmd_hdl) { + ret = cmd_hdl(pcmd->padapter, pcmd->parmbuf); + pcmd->res = ret; + } + } else { + pcmd->res = H2C_PARAMETERS_ERROR; + } + + cmd_hdl = NULL; } - cmd_hdl = NULL; - -post_process: - /* call callback function for post-processed */ if (pcmd->cmdcode < ARRAY_SIZE(rtw_cmd_callback)) { pcmd_callback = rtw_cmd_callback[pcmd->cmdcode].callback; From 25e168a4a367eca8bdab3456ac73758290e8aab5 Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Fri, 6 Nov 2015 22:20:17 +0700 Subject: [PATCH 394/843] staging: rtl8188eu: goto removed malloc error handling moved into one place. Signed-off-by: Ivan Safonov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/core/rtw_cmd.c | 67 +++++------------------- 1 file changed, 13 insertions(+), 54 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c index f90a2bfbb819..433b926ceae7 100644 --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c @@ -563,31 +563,19 @@ u8 rtw_setopmode_cmd(struct adapter *padapter, enum ndis_802_11_network_infra n struct setopmode_parm *psetop; struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - u8 res = _SUCCESS; - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); - if (ph2c == NULL) { - res = false; - goto exit; - } psetop = kzalloc(sizeof(struct setopmode_parm), GFP_KERNEL); - - if (psetop == NULL) { + if (!ph2c || !psetop) { kfree(ph2c); - res = false; - goto exit; + kfree(psetop); + return false; } init_h2fwcmd_w_parm_no_rsp(ph2c, psetop, _SetOpMode_CMD_); psetop->mode = (u8)networktype; - res = rtw_enqueue_cmd(pcmdpriv, ph2c); - -exit: - - - return res; + return rtw_enqueue_cmd(pcmdpriv, ph2c); } u8 rtw_setstakey_cmd(struct adapter *padapter, u8 *psta, u8 unicast_key) @@ -600,28 +588,16 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, u8 *psta, u8 unicast_key) struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct security_priv *psecuritypriv = &padapter->securitypriv; struct sta_info *sta = (struct sta_info *)psta; - u8 res = _SUCCESS; - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); - if (ph2c == NULL) { - res = _FAIL; - goto exit; - } - psetstakey_para = kzalloc(sizeof(struct set_stakey_parm), GFP_KERNEL); - if (psetstakey_para == NULL) { - kfree(ph2c); - res = _FAIL; - goto exit; - } - psetstakey_rsp = kzalloc(sizeof(struct set_stakey_rsp), GFP_KERNEL); - if (psetstakey_rsp == NULL) { + + if (!ph2c || !psetstakey_para || !psetstakey_rsp) { kfree(ph2c); kfree(psetstakey_para); - res = _FAIL; - goto exit; + kfree(psetstakey_rsp); + return _FAIL; } init_h2fwcmd_w_parm_no_rsp(ph2c, psetstakey_para, _SetStaKey_CMD_); @@ -643,12 +619,7 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, u8 *psta, u8 unicast_key) /* jeff: set this because at least sw key is ready */ padapter->securitypriv.busetkipkey = true; - res = rtw_enqueue_cmd(pcmdpriv, ph2c); - -exit: - - - return res; + return rtw_enqueue_cmd(pcmdpriv, ph2c); } u8 rtw_clearstakey_cmd(struct adapter *padapter, u8 *psta, u8 entry, u8 enqueue) @@ -1079,31 +1050,19 @@ u8 rtw_ps_cmd(struct adapter *padapter) struct drvextra_cmd_parm *pdrvextra_cmd_parm; struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - u8 res = _SUCCESS; - ppscmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); - if (ppscmd == NULL) { - res = _FAIL; - goto exit; - } - pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); - if (pdrvextra_cmd_parm == NULL) { + if (!ppscmd || !pdrvextra_cmd_parm) { kfree(ppscmd); - res = _FAIL; - goto exit; + kfree(pdrvextra_cmd_parm); + return _FAIL; } pdrvextra_cmd_parm->ec_id = POWER_SAVING_CTRL_WK_CID; pdrvextra_cmd_parm->pbuf = NULL; init_h2fwcmd_w_parm_no_rsp(ppscmd, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra)); - res = rtw_enqueue_cmd(pcmdpriv, ppscmd); - -exit: - - - return res; + return rtw_enqueue_cmd(pcmdpriv, ppscmd); } #ifdef CONFIG_88EU_AP_MODE From fabb93f18fdbb1b9eebb799fd7b69610799f25a9 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Thu, 29 Oct 2015 16:44:08 +0900 Subject: [PATCH 395/843] staging: most: remove multiple blank lines This patch removes multiple blank lines found by checkpatch. CHECK: Please don't use multiple blank lines Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/aim-network/networking.h | 2 -- drivers/staging/most/hdm-dim2/dim2_errors.h | 2 -- drivers/staging/most/hdm-dim2/dim2_hal.h | 3 --- drivers/staging/most/hdm-dim2/dim2_reg.h | 3 --- drivers/staging/most/hdm-dim2/dim2_sysfs.h | 3 --- drivers/staging/most/mostcore/mostcore.h | 2 -- 6 files changed, 15 deletions(-) diff --git a/drivers/staging/most/aim-network/networking.h b/drivers/staging/most/aim-network/networking.h index 1b8b434fabb0..6f346d410525 100644 --- a/drivers/staging/most/aim-network/networking.h +++ b/drivers/staging/most/aim-network/networking.h @@ -15,9 +15,7 @@ #include "mostcore.h" - void most_deliver_netinfo(struct most_interface *iface, unsigned char link_stat, unsigned char *mac_addr); - #endif diff --git a/drivers/staging/most/hdm-dim2/dim2_errors.h b/drivers/staging/most/hdm-dim2/dim2_errors.h index 314f7de2be73..5a713df1d1d4 100644 --- a/drivers/staging/most/hdm-dim2/dim2_errors.h +++ b/drivers/staging/most/hdm-dim2/dim2_errors.h @@ -19,7 +19,6 @@ extern "C" { #endif - /** * MOST DIM errors. */ @@ -59,7 +58,6 @@ enum dim_errors_t { DIM_ERR_OVERFLOW, }; - #ifdef __cplusplus } #endif diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index ebb7d87a45fc..94ea6c7827f1 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -17,7 +17,6 @@ #include - #ifdef __cplusplus extern "C" { #endif @@ -66,7 +65,6 @@ struct dim_channel { u16 done_sw_buffers_number; /*< Done software buffers number. */ }; - u8 DIM_Startup(void *dim_base_address, u32 mlb_clock); void DIM_Shutdown(void); @@ -111,7 +109,6 @@ void DIMCB_IoWrite(u32 *ptr32, u32 value); void DIMCB_OnError(u8 error_id, const char *error_message); - #ifdef __cplusplus } #endif diff --git a/drivers/staging/most/hdm-dim2/dim2_reg.h b/drivers/staging/most/hdm-dim2/dim2_reg.h index 476f66f4c566..0795aae05f1c 100644 --- a/drivers/staging/most/hdm-dim2/dim2_reg.h +++ b/drivers/staging/most/hdm-dim2/dim2_reg.h @@ -21,7 +21,6 @@ extern "C" { #endif - struct dim2_regs { /* 0x00 */ u32 MLBC0; /* 0x01 */ u32 rsvd0[1]; @@ -67,7 +66,6 @@ struct dim2_regs { /* 0xF7 */ u32 ACMR1; }; - #define DIM2_MASK(n) (~((~(u32)0)<<(n))) enum { @@ -168,7 +166,6 @@ enum { CAT_CL_MASK = DIM2_MASK(6) }; - #ifdef __cplusplus } #endif diff --git a/drivers/staging/most/hdm-dim2/dim2_sysfs.h b/drivers/staging/most/hdm-dim2/dim2_sysfs.h index e719691035b0..b71dd027ebc7 100644 --- a/drivers/staging/most/hdm-dim2/dim2_sysfs.h +++ b/drivers/staging/most/hdm-dim2/dim2_sysfs.h @@ -16,10 +16,8 @@ #ifndef DIM2_SYSFS_H #define DIM2_SYSFS_H - #include - struct medialb_bus { struct kobject kobj_group; }; @@ -35,5 +33,4 @@ void dim2_sysfs_destroy(struct medialb_bus *bus); */ bool dim2_sysfs_get_state_cb(void); - #endif /* DIM2_SYSFS_H */ diff --git a/drivers/staging/most/mostcore/mostcore.h b/drivers/staging/most/mostcore/mostcore.h index e148b324331a..bda3850d5435 100644 --- a/drivers/staging/most/mostcore/mostcore.h +++ b/drivers/staging/most/mostcore/mostcore.h @@ -60,7 +60,6 @@ enum most_channel_data_type { MOST_CH_SYNC = 1 << 5, }; - enum mbo_status_flags { /* MBO was processed successfully (data was send or received )*/ MBO_SUCCESS = 0, @@ -317,5 +316,4 @@ int most_start_channel(struct most_interface *iface, int channel_idx, int most_stop_channel(struct most_interface *iface, int channel_idx, struct most_aim *); - #endif /* MOST_CORE_H_ */ From 23242684c150835602a7f8cf10d530761f8d96ab Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Thu, 29 Oct 2015 16:44:09 +0900 Subject: [PATCH 396/843] staging: most: remove blank line after an open brace This patch removes blank line after an open brace found by checkpatch. CHECK: Blank lines aren't necessary after an open brace '{' Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hdm.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index b6fe346f73b0..9ab092a3ccfe 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -371,7 +371,6 @@ static void service_done_flag(struct dim2_hdm *dev, int ch_idx) if (hdm_ch->data_type == MOST_CH_ASYNC && hdm_ch->direction == MOST_CH_RX && PACKET_IS_NET_INFO(data)) { - retrieve_netinfo(dev, mbo); spin_lock_irqsave(&dim_lock, flags); @@ -380,7 +379,6 @@ static void service_done_flag(struct dim2_hdm *dev, int ch_idx) } else { if (hdm_ch->data_type == MOST_CH_CONTROL || hdm_ch->data_type == MOST_CH_ASYNC) { - u32 const data_size = (u32)data[0] * 256 + data[1] + 2; From 3c70754250e42cf7aacf9c4d3ea7ea61beb4d3fa Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Thu, 29 Oct 2015 16:44:10 +0900 Subject: [PATCH 397/843] staging: most: add spaces preferred around that '<<' This patch adds space around '<<' found by checkpatch. CHECK: spaces preferred around that '<<' (ctx:VxV) FILE: drivers/staging/most/hdm-dim2/dim2_reg.h:69: Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_reg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_reg.h b/drivers/staging/most/hdm-dim2/dim2_reg.h index 0795aae05f1c..bcf6a79f6744 100644 --- a/drivers/staging/most/hdm-dim2/dim2_reg.h +++ b/drivers/staging/most/hdm-dim2/dim2_reg.h @@ -66,7 +66,7 @@ struct dim2_regs { /* 0xF7 */ u32 ACMR1; }; -#define DIM2_MASK(n) (~((~(u32)0)<<(n))) +#define DIM2_MASK(n) (~((~(u32)0) << (n))) enum { MLBC0_MLBLK_BIT = 7, From 6417267f17c72f3d4224be3e76399475748e1e17 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Thu, 29 Oct 2015 16:44:11 +0900 Subject: [PATCH 398/843] staging: most: rename DIM_Startup to dim_startup This patch renames DIM_Startup to dim_startup to avoid camelcase found by checkpatch. CHECK: Avoid CamelCase: FILE: drivers/staging/most/hdm-dim2/dim2_hal.c:653: Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.c | 2 +- drivers/staging/most/hdm-dim2/dim2_hal.h | 2 +- drivers/staging/most/hdm-dim2/dim2_hdm.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index c915c44f025e..583506dac323 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -650,7 +650,7 @@ static bool channel_detach_buffers(struct dim_channel *ch, u16 buffers_number) /* -------------------------------------------------------------------------- */ /* API */ -u8 DIM_Startup(void *dim_base_address, u32 mlb_clock) +u8 dim_startup(void *dim_base_address, u32 mlb_clock) { g.dim_is_initialized = false; diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index 94ea6c7827f1..6e1392a0e604 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -65,7 +65,7 @@ struct dim_channel { u16 done_sw_buffers_number; /*< Done software buffers number. */ }; -u8 DIM_Startup(void *dim_base_address, u32 mlb_clock); +u8 dim_startup(void *dim_base_address, u32 mlb_clock); void DIM_Shutdown(void); diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index 9ab092a3ccfe..89e43e412c4e 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -212,9 +212,9 @@ static int startup_dim(struct platform_device *pdev) return ret; } - hal_ret = DIM_Startup(dev->io_base, dev->clk_speed); + hal_ret = dim_startup(dev->io_base, dev->clk_speed); if (hal_ret != DIM_NO_ERROR) { - pr_err("DIM_Startup failed: %d\n", hal_ret); + pr_err("dim_startup failed: %d\n", hal_ret); if (pdata && pdata->destroy) pdata->destroy(pdata); return -ENODEV; From 50a45b170c044a27075535b36beea7b18ada98ce Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Thu, 29 Oct 2015 16:44:12 +0900 Subject: [PATCH 399/843] staging: most: rename DIM_Shutdown to dim_shutdown This patch renames DIM_Shutdown to dim_shutdown to avoid camelcase found by checkpatch. CHECK: Avoid CamelCase: FILE: drivers/staging/most/hdm-dim2/dim2_hal.c:676: Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.c | 2 +- drivers/staging/most/hdm-dim2/dim2_hal.h | 2 +- drivers/staging/most/hdm-dim2/dim2_hdm.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index 583506dac323..e296adb64a1d 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -673,7 +673,7 @@ u8 dim_startup(void *dim_base_address, u32 mlb_clock) return DIM_NO_ERROR; } -void DIM_Shutdown(void) +void dim_shutdown(void) { g.dim_is_initialized = false; dim2_cleanup(); diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index 6e1392a0e604..8b18f74c0837 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -67,7 +67,7 @@ struct dim_channel { u8 dim_startup(void *dim_base_address, u32 mlb_clock); -void DIM_Shutdown(void); +void dim_shutdown(void); bool DIM_GetLockState(void); diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index 89e43e412c4e..9c99f65d5ed5 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -883,7 +883,7 @@ static int dim2_remove(struct platform_device *pdev) unsigned long flags; spin_lock_irqsave(&dim_lock, flags); - DIM_Shutdown(); + dim_shutdown(); spin_unlock_irqrestore(&dim_lock, flags); if (pdata && pdata->destroy) From 38c385449048ef4372ec7973c179bf1012cb284e Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Thu, 29 Oct 2015 16:44:13 +0900 Subject: [PATCH 400/843] staging: most: rename DIM_DetachBuffers to dim_detach_buffers This patch renames DIM_DetachBuffers to dim_detach_buffers to avoid camelcase found by checkpatch. CHECK: Avoid CamelCase: FILE: drivers/staging/most/hdm-dim2/dim2_hal.c:886: Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.c | 2 +- drivers/staging/most/hdm-dim2/dim2_hal.h | 2 +- drivers/staging/most/hdm-dim2/dim2_hdm.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index e296adb64a1d..9bf952d57cc7 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -883,7 +883,7 @@ bool DIM_EnqueueBuffer(struct dim_channel *ch, u32 buffer_addr, u16 buffer_size) return channel_start(ch, buffer_addr, buffer_size); } -bool DIM_DetachBuffers(struct dim_channel *ch, u16 buffers_number) +bool dim_detach_buffers(struct dim_channel *ch, u16 buffers_number) { if (!ch) return dim_on_error(DIM_ERR_DRIVER_NOT_INITIALIZED, diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index 8b18f74c0837..54dbfc4953eb 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -101,7 +101,7 @@ struct dim_ch_state_t *DIM_GetChannelState(struct dim_channel *ch, bool DIM_EnqueueBuffer(struct dim_channel *ch, u32 buffer_addr, u16 buffer_size); -bool DIM_DetachBuffers(struct dim_channel *ch, u16 buffers_number); +bool dim_detach_buffers(struct dim_channel *ch, u16 buffers_number); u32 DIMCB_IoRead(u32 *ptr32); diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index 9c99f65d5ed5..3f36aa6548af 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -346,7 +346,7 @@ static void service_done_flag(struct dim2_hdm *dev, int ch_idx) return; } - if (!DIM_DetachBuffers(&hdm_ch->ch, done_buffers)) { + if (!dim_detach_buffers(&hdm_ch->ch, done_buffers)) { spin_unlock_irqrestore(&dim_lock, flags); return; } From b724207b4122ac8253c76834b24696a9dc68384a Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 2 Nov 2015 22:59:01 +0900 Subject: [PATCH 401/843] staging: most: rename DIM_GetLockState to dim_get_lock_state This patch renames DIM_GetLockState to dim_get_lock_state to avoid camelcase found by checkpatch. CHECK: Avoid CamelCase: FILE: drivers/staging/most/hdm-dim2/dim2_hdm.c:131: Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.c | 2 +- drivers/staging/most/hdm-dim2/dim2_hal.h | 2 +- drivers/staging/most/hdm-dim2/dim2_hdm.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index 9bf952d57cc7..2610ad2030c1 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -679,7 +679,7 @@ void dim_shutdown(void) dim2_cleanup(); } -bool DIM_GetLockState(void) +bool dim_get_lock_state(void) { return dim2_is_mlb_locked(); } diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index 54dbfc4953eb..323ac2d052a2 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -69,7 +69,7 @@ u8 dim_startup(void *dim_base_address, u32 mlb_clock); void dim_shutdown(void); -bool DIM_GetLockState(void); +bool dim_get_lock_state(void); u16 DIM_NormCtrlAsyncBufferSize(u16 buf_size); diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index 3f36aa6548af..fdaf9d2a6a72 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -128,7 +128,7 @@ bool dim2_sysfs_get_state_cb(void) unsigned long flags; spin_lock_irqsave(&dim_lock, flags); - state = DIM_GetLockState(); + state = dim_get_lock_state(); spin_unlock_irqrestore(&dim_lock, flags); return state; From de6687313df421296533de085dee76ec779d7332 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 2 Nov 2015 22:59:02 +0900 Subject: [PATCH 402/843] staging: most: rename DIMCB_OnError to dimcb_on_error This patch renames DIMCB_OnError to dimcb_on_error to avoid camelcase found by checkpatch. CHECK: Avoid CamelCase: FILE: drivers/staging/most/hdm-dim2/dim2_hal.c:77: Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.c | 2 +- drivers/staging/most/hdm-dim2/dim2_hal.h | 2 +- drivers/staging/most/hdm-dim2/dim2_hdm.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index 2610ad2030c1..d77566a1a59f 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -74,7 +74,7 @@ static inline u32 bit_mask(u8 position) static inline bool dim_on_error(u8 error_id, const char *error_message) { - DIMCB_OnError(error_id, error_message); + dimcb_on_error(error_id, error_message); return false; } diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index 323ac2d052a2..9e65e815eee1 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -107,7 +107,7 @@ u32 DIMCB_IoRead(u32 *ptr32); void DIMCB_IoWrite(u32 *ptr32, u32 value); -void DIMCB_OnError(u8 error_id, const char *error_message); +void dimcb_on_error(u8 error_id, const char *error_message); #ifdef __cplusplus } diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index fdaf9d2a6a72..ffe4bad5d7dd 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -154,14 +154,14 @@ void DIMCB_IoWrite(u32 *ptr32, u32 value) } /** - * DIMCB_OnError - callback from HAL to report miscommunication between + * dimcb_on_error - callback from HAL to report miscommunication between * HDM and HAL * @error_id: Error ID * @error_message: Error message. Some text in a free format */ -void DIMCB_OnError(u8 error_id, const char *error_message) +void dimcb_on_error(u8 error_id, const char *error_message) { - pr_err("DIMCB_OnError: error_id - %d, error_message - %s\n", error_id, + pr_err("dimcb_on_error: error_id - %d, error_message - %s\n", error_id, error_message); } From 1efc4564624070561c1a562f2001ca357895cc99 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 2 Nov 2015 22:59:03 +0900 Subject: [PATCH 403/843] staging: most: rename DIMCB_IoWrite to dimcb_io_write This patch renames DIMCB_IoWrite to dimcb_io_write to avoid camelcase found by checkpatch. CHECK: Avoid CamelCase: FILE: drivers/staging/most/hdm-dim2/dim2_hal.c:154: Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.c | 76 ++++++++++++------------ drivers/staging/most/hdm-dim2/dim2_hal.h | 2 +- drivers/staging/most/hdm-dim2/dim2_hdm.c | 4 +- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index d77566a1a59f..2df126c64b2c 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -151,13 +151,13 @@ static void free_dbr(int offs, int size) static u32 dim2_read_ctr(u32 ctr_addr, u16 mdat_idx) { - DIMCB_IoWrite(&g.dim2->MADR, ctr_addr); + dimcb_io_write(&g.dim2->MADR, ctr_addr); /* wait till transfer is completed */ while ((DIMCB_IoRead(&g.dim2->MCTL) & 1) != 1) continue; - DIMCB_IoWrite(&g.dim2->MCTL, 0); /* clear transfer complete */ + dimcb_io_write(&g.dim2->MCTL, 0); /* clear transfer complete */ return DIMCB_IoRead((&g.dim2->MDAT0) + mdat_idx); } @@ -166,29 +166,29 @@ static void dim2_write_ctr_mask(u32 ctr_addr, const u32 *mask, const u32 *value) { enum { MADR_WNR_BIT = 31 }; - DIMCB_IoWrite(&g.dim2->MCTL, 0); /* clear transfer complete */ + dimcb_io_write(&g.dim2->MCTL, 0); /* clear transfer complete */ if (mask[0] != 0) - DIMCB_IoWrite(&g.dim2->MDAT0, value[0]); + dimcb_io_write(&g.dim2->MDAT0, value[0]); if (mask[1] != 0) - DIMCB_IoWrite(&g.dim2->MDAT1, value[1]); + dimcb_io_write(&g.dim2->MDAT1, value[1]); if (mask[2] != 0) - DIMCB_IoWrite(&g.dim2->MDAT2, value[2]); + dimcb_io_write(&g.dim2->MDAT2, value[2]); if (mask[3] != 0) - DIMCB_IoWrite(&g.dim2->MDAT3, value[3]); + dimcb_io_write(&g.dim2->MDAT3, value[3]); - DIMCB_IoWrite(&g.dim2->MDWE0, mask[0]); - DIMCB_IoWrite(&g.dim2->MDWE1, mask[1]); - DIMCB_IoWrite(&g.dim2->MDWE2, mask[2]); - DIMCB_IoWrite(&g.dim2->MDWE3, mask[3]); + dimcb_io_write(&g.dim2->MDWE0, mask[0]); + dimcb_io_write(&g.dim2->MDWE1, mask[1]); + dimcb_io_write(&g.dim2->MDWE2, mask[2]); + dimcb_io_write(&g.dim2->MDWE3, mask[3]); - DIMCB_IoWrite(&g.dim2->MADR, bit_mask(MADR_WNR_BIT) | ctr_addr); + dimcb_io_write(&g.dim2->MADR, bit_mask(MADR_WNR_BIT) | ctr_addr); /* wait till transfer is completed */ while ((DIMCB_IoRead(&g.dim2->MCTL) & 1) != 1) continue; - DIMCB_IoWrite(&g.dim2->MCTL, 0); /* clear transfer complete */ + dimcb_io_write(&g.dim2->MCTL, 0); /* clear transfer complete */ } static inline void dim2_write_ctr(u32 ctr_addr, const u32 *value) @@ -341,15 +341,15 @@ static void dim2_configure_channel( dim2_configure_cat(AHB_CAT, ch_addr, type, is_tx ? 0 : 1, sync_mfe); /* unmask interrupt for used channel, enable mlb_sys_int[0] interrupt */ - DIMCB_IoWrite(&g.dim2->ACMR0, - DIMCB_IoRead(&g.dim2->ACMR0) | bit_mask(ch_addr)); + dimcb_io_write(&g.dim2->ACMR0, + DIMCB_IoRead(&g.dim2->ACMR0) | bit_mask(ch_addr)); } static void dim2_clear_channel(u8 ch_addr) { /* mask interrupt for used channel, disable mlb_sys_int[0] interrupt */ - DIMCB_IoWrite(&g.dim2->ACMR0, - DIMCB_IoRead(&g.dim2->ACMR0) & ~bit_mask(ch_addr)); + dimcb_io_write(&g.dim2->ACMR0, + DIMCB_IoRead(&g.dim2->ACMR0) & ~bit_mask(ch_addr)); dim2_clear_cat(AHB_CAT, ch_addr); dim2_clear_adt(ch_addr); @@ -455,20 +455,20 @@ static inline u16 norm_sync_buffer_size(u16 buf_size, u16 bytes_per_frame) static void dim2_cleanup(void) { /* disable MediaLB */ - DIMCB_IoWrite(&g.dim2->MLBC0, false << MLBC0_MLBEN_BIT); + dimcb_io_write(&g.dim2->MLBC0, false << MLBC0_MLBEN_BIT); dim2_clear_ctram(); /* disable mlb_int interrupt */ - DIMCB_IoWrite(&g.dim2->MIEN, 0); + dimcb_io_write(&g.dim2->MIEN, 0); /* clear status for all dma channels */ - DIMCB_IoWrite(&g.dim2->ACSR0, 0xFFFFFFFF); - DIMCB_IoWrite(&g.dim2->ACSR1, 0xFFFFFFFF); + dimcb_io_write(&g.dim2->ACSR0, 0xFFFFFFFF); + dimcb_io_write(&g.dim2->ACSR1, 0xFFFFFFFF); /* mask interrupts for all channels */ - DIMCB_IoWrite(&g.dim2->ACMR0, 0); - DIMCB_IoWrite(&g.dim2->ACMR1, 0); + dimcb_io_write(&g.dim2->ACMR0, 0); + dimcb_io_write(&g.dim2->ACMR1, 0); } static void dim2_initialize(bool enable_6pin, u8 mlb_clock) @@ -476,23 +476,23 @@ static void dim2_initialize(bool enable_6pin, u8 mlb_clock) dim2_cleanup(); /* configure and enable MediaLB */ - DIMCB_IoWrite(&g.dim2->MLBC0, - enable_6pin << MLBC0_MLBPEN_BIT | - mlb_clock << MLBC0_MLBCLK_SHIFT | - MLBC0_FCNT_VAL(FRAMES_PER_SUBBUFF) << MLBC0_FCNT_SHIFT | - true << MLBC0_MLBEN_BIT); + dimcb_io_write(&g.dim2->MLBC0, + enable_6pin << MLBC0_MLBPEN_BIT | + mlb_clock << MLBC0_MLBCLK_SHIFT | + MLBC0_FCNT_VAL(FRAMES_PER_SUBBUFF) << MLBC0_FCNT_SHIFT | + true << MLBC0_MLBEN_BIT); /* activate all HBI channels */ - DIMCB_IoWrite(&g.dim2->HCMR0, 0xFFFFFFFF); - DIMCB_IoWrite(&g.dim2->HCMR1, 0xFFFFFFFF); + dimcb_io_write(&g.dim2->HCMR0, 0xFFFFFFFF); + dimcb_io_write(&g.dim2->HCMR1, 0xFFFFFFFF); /* enable HBI */ - DIMCB_IoWrite(&g.dim2->HCTL, bit_mask(HCTL_EN_BIT)); + dimcb_io_write(&g.dim2->HCTL, bit_mask(HCTL_EN_BIT)); /* configure DMA */ - DIMCB_IoWrite(&g.dim2->ACTL, - ACTL_DMA_MODE_VAL_DMA_MODE_1 << ACTL_DMA_MODE_BIT | - true << ACTL_SCE_BIT); + dimcb_io_write(&g.dim2->ACTL, + ACTL_DMA_MODE_VAL_DMA_MODE_1 << ACTL_DMA_MODE_BIT | + true << ACTL_SCE_BIT); } static bool dim2_is_mlb_locked(void) @@ -503,7 +503,7 @@ static bool dim2_is_mlb_locked(void) u32 const c1 = DIMCB_IoRead(&g.dim2->MLBC1); u32 const nda_mask = (u32)MLBC1_NDA_MASK << MLBC1_NDA_SHIFT; - DIMCB_IoWrite(&g.dim2->MLBC1, c1 & nda_mask); + dimcb_io_write(&g.dim2->MLBC1, c1 & nda_mask); return (DIMCB_IoRead(&g.dim2->MLBC1) & mask1) == 0 && (DIMCB_IoRead(&g.dim2->MLBC0) & mask0) != 0; } @@ -531,7 +531,7 @@ static inline bool service_channel(u8 ch_addr, u8 idx) } /* clear channel status bit */ - DIMCB_IoWrite(&g.dim2->ACSR0, bit_mask(ch_addr)); + dimcb_io_write(&g.dim2->ACSR0, bit_mask(ch_addr)); return true; } @@ -850,8 +850,8 @@ void DIM_ServiceIrq(struct dim_channel *const *channels) } while (state_changed); /* clear pending Interrupts */ - DIMCB_IoWrite(&g.dim2->MS0, 0); - DIMCB_IoWrite(&g.dim2->MS1, 0); + dimcb_io_write(&g.dim2->MS0, 0); + dimcb_io_write(&g.dim2->MS1, 0); } u8 DIM_ServiceChannel(struct dim_channel *ch) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index 9e65e815eee1..7dc290896c12 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -105,7 +105,7 @@ bool dim_detach_buffers(struct dim_channel *ch, u16 buffers_number); u32 DIMCB_IoRead(u32 *ptr32); -void DIMCB_IoWrite(u32 *ptr32, u32 value); +void dimcb_io_write(u32 *ptr32, u32 value); void dimcb_on_error(u8 error_id, const char *error_message); diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index ffe4bad5d7dd..d8a0790979bf 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -144,11 +144,11 @@ u32 DIMCB_IoRead(u32 *ptr32) } /** - * DIMCB_IoWrite - callback from HAL to write value to an I/O register + * dimcb_io_write - callback from HAL to write value to an I/O register * @ptr32: register address * @value: value to write */ -void DIMCB_IoWrite(u32 *ptr32, u32 value) +void dimcb_io_write(u32 *ptr32, u32 value) { __raw_writel(value, ptr32); } From 58889788fc806e8b63e7f159db659937decf61e8 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 2 Nov 2015 22:59:04 +0900 Subject: [PATCH 404/843] staging: most: rename DIMCB_IoRead to dimcb_io_read This patch renames DIMCB_IoRead to dimcb_io_read to avoid camelcase found by checkpatch. CHECK: Avoid CamelCase: FILE: drivers/staging/most/hdm-dim2/dim2_hal.c:157: Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.c | 16 ++++++++-------- drivers/staging/most/hdm-dim2/dim2_hal.h | 2 +- drivers/staging/most/hdm-dim2/dim2_hdm.c | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index 2df126c64b2c..a470900ccf4c 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -154,12 +154,12 @@ static u32 dim2_read_ctr(u32 ctr_addr, u16 mdat_idx) dimcb_io_write(&g.dim2->MADR, ctr_addr); /* wait till transfer is completed */ - while ((DIMCB_IoRead(&g.dim2->MCTL) & 1) != 1) + while ((dimcb_io_read(&g.dim2->MCTL) & 1) != 1) continue; dimcb_io_write(&g.dim2->MCTL, 0); /* clear transfer complete */ - return DIMCB_IoRead((&g.dim2->MDAT0) + mdat_idx); + return dimcb_io_read((&g.dim2->MDAT0) + mdat_idx); } static void dim2_write_ctr_mask(u32 ctr_addr, const u32 *mask, const u32 *value) @@ -185,7 +185,7 @@ static void dim2_write_ctr_mask(u32 ctr_addr, const u32 *mask, const u32 *value) dimcb_io_write(&g.dim2->MADR, bit_mask(MADR_WNR_BIT) | ctr_addr); /* wait till transfer is completed */ - while ((DIMCB_IoRead(&g.dim2->MCTL) & 1) != 1) + while ((dimcb_io_read(&g.dim2->MCTL) & 1) != 1) continue; dimcb_io_write(&g.dim2->MCTL, 0); /* clear transfer complete */ @@ -342,14 +342,14 @@ static void dim2_configure_channel( /* unmask interrupt for used channel, enable mlb_sys_int[0] interrupt */ dimcb_io_write(&g.dim2->ACMR0, - DIMCB_IoRead(&g.dim2->ACMR0) | bit_mask(ch_addr)); + dimcb_io_read(&g.dim2->ACMR0) | bit_mask(ch_addr)); } static void dim2_clear_channel(u8 ch_addr) { /* mask interrupt for used channel, disable mlb_sys_int[0] interrupt */ dimcb_io_write(&g.dim2->ACMR0, - DIMCB_IoRead(&g.dim2->ACMR0) & ~bit_mask(ch_addr)); + dimcb_io_read(&g.dim2->ACMR0) & ~bit_mask(ch_addr)); dim2_clear_cat(AHB_CAT, ch_addr); dim2_clear_adt(ch_addr); @@ -500,12 +500,12 @@ static bool dim2_is_mlb_locked(void) u32 const mask0 = bit_mask(MLBC0_MLBLK_BIT); u32 const mask1 = bit_mask(MLBC1_CLKMERR_BIT) | bit_mask(MLBC1_LOCKERR_BIT); - u32 const c1 = DIMCB_IoRead(&g.dim2->MLBC1); + u32 const c1 = dimcb_io_read(&g.dim2->MLBC1); u32 const nda_mask = (u32)MLBC1_NDA_MASK << MLBC1_NDA_SHIFT; dimcb_io_write(&g.dim2->MLBC1, c1 & nda_mask); - return (DIMCB_IoRead(&g.dim2->MLBC1) & mask1) == 0 && - (DIMCB_IoRead(&g.dim2->MLBC0) & mask0) != 0; + return (dimcb_io_read(&g.dim2->MLBC1) & mask1) == 0 && + (dimcb_io_read(&g.dim2->MLBC0) & mask0) != 0; } /* -------------------------------------------------------------------------- */ diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index 7dc290896c12..5a866da2a128 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -103,7 +103,7 @@ bool DIM_EnqueueBuffer(struct dim_channel *ch, u32 buffer_addr, bool dim_detach_buffers(struct dim_channel *ch, u16 buffers_number); -u32 DIMCB_IoRead(u32 *ptr32); +u32 dimcb_io_read(u32 *ptr32); void dimcb_io_write(u32 *ptr32, u32 value); diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index d8a0790979bf..1b792f1861c2 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -135,10 +135,10 @@ bool dim2_sysfs_get_state_cb(void) } /** - * DIMCB_IoRead - callback from HAL to read an I/O register + * dimcb_io_read - callback from HAL to read an I/O register * @ptr32: register address */ -u32 DIMCB_IoRead(u32 *ptr32) +u32 dimcb_io_read(u32 *ptr32) { return __raw_readl(ptr32); } From c64c6073e8fe1c80cc991c48450136c619c051ee Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 2 Nov 2015 22:59:05 +0900 Subject: [PATCH 405/843] staging: most: rename DIM_NormCtrlAsyncBufferSize to dim_norm_ctrl_async_buffer_size This patch renames DIM_NormCtrlAsyncBufferSize to dim_norm_ctrl_async_buffer_size to avoid camelcase found by checkpatch CHECK: Avoid CamelCase: FILE: drivers/staging/most/hdm-dim2/dim2_hal.c:709: Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.c | 2 +- drivers/staging/most/hdm-dim2/dim2_hal.h | 2 +- drivers/staging/most/hdm-dim2/dim2_hdm.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index a470900ccf4c..8cca18e9f38f 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -706,7 +706,7 @@ static u8 init_ctrl_async(struct dim_channel *ch, u8 type, u8 is_tx, return DIM_NO_ERROR; } -u16 DIM_NormCtrlAsyncBufferSize(u16 buf_size) +u16 dim_norm_ctrl_async_buffer_size(u16 buf_size) { return norm_ctrl_async_buffer_size(buf_size); } diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index 5a866da2a128..f5640485c5ba 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -71,7 +71,7 @@ void dim_shutdown(void); bool dim_get_lock_state(void); -u16 DIM_NormCtrlAsyncBufferSize(u16 buf_size); +u16 dim_norm_ctrl_async_buffer_size(u16 buf_size); u16 DIM_NormIsocBufferSize(u16 buf_size, u16 packet_length); diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index 1b792f1861c2..6e583d46181f 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -534,7 +534,7 @@ static int configure_channel(struct most_interface *most_iface, int ch_idx, switch (ccfg->data_type) { case MOST_CH_CONTROL: - new_size = DIM_NormCtrlAsyncBufferSize(buf_size); + new_size = dim_norm_ctrl_async_buffer_size(buf_size); if (new_size == 0) { pr_err("%s: too small buffer size\n", hdm_ch->name); return -EINVAL; @@ -548,7 +548,7 @@ static int configure_channel(struct most_interface *most_iface, int ch_idx, buf_size); break; case MOST_CH_ASYNC: - new_size = DIM_NormCtrlAsyncBufferSize(buf_size); + new_size = dim_norm_ctrl_async_buffer_size(buf_size); if (new_size == 0) { pr_err("%s: too small buffer size\n", hdm_ch->name); return -EINVAL; From e302ca47b59f024e90c26367fca6448af5198dc7 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 2 Nov 2015 22:59:06 +0900 Subject: [PATCH 406/843] staging: most: rename DIM_NormIsocBufferSize to dim_norm_isoc_buffer_size This patch renames DIM_NormIsocBufferSize to dim_norm_isoc_buffer_size to avoid camelcase found by checkpatch. CHECK: Avoid CamelCase: FILE: drivers/staging/most/hdm-dim2/dim2_hal.c:720: Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.c | 2 +- drivers/staging/most/hdm-dim2/dim2_hal.h | 2 +- drivers/staging/most/hdm-dim2/dim2_hdm.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index 8cca18e9f38f..01fa2e535737 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -717,7 +717,7 @@ u16 dim_norm_ctrl_async_buffer_size(u16 buf_size) * * Returns non-zero correct buffer size or zero by error. */ -u16 DIM_NormIsocBufferSize(u16 buf_size, u16 packet_length) +u16 dim_norm_isoc_buffer_size(u16 buf_size, u16 packet_length) { if (!check_packet_length(packet_length)) return 0; diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index f5640485c5ba..c2e3fcc377cc 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -73,7 +73,7 @@ bool dim_get_lock_state(void); u16 dim_norm_ctrl_async_buffer_size(u16 buf_size); -u16 DIM_NormIsocBufferSize(u16 buf_size, u16 packet_length); +u16 dim_norm_isoc_buffer_size(u16 buf_size, u16 packet_length); u16 DIM_NormSyncBufferSize(u16 buf_size, u16 bytes_per_frame); diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index 6e583d46181f..6e457c138151 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -561,7 +561,7 @@ static int configure_channel(struct most_interface *most_iface, int ch_idx, hal_ret = DIM_InitAsync(&hdm_ch->ch, is_tx, ch_addr, buf_size); break; case MOST_CH_ISOC_AVP: - new_size = DIM_NormIsocBufferSize(buf_size, sub_size); + new_size = dim_norm_isoc_buffer_size(buf_size, sub_size); if (new_size == 0) { pr_err("%s: invalid sub-buffer size or too small buffer size\n", hdm_ch->name); From aff1924508e8808a3e9d6b41ce30ad4cbb4be582 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 2 Nov 2015 22:59:07 +0900 Subject: [PATCH 407/843] staging: most: rename DIM_NormSyncBufferSize to dim_norm_sync_buffer_size This patch renames DIM_NormSyncBufferSize to dim_norm_sync_buffer_size to avoid camelcase found by checkpatch. CHECK: Avoid CamelCase: FILE: drivers/staging/most/hdm-dim2/dim2_hal.c:734: Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.c | 2 +- drivers/staging/most/hdm-dim2/dim2_hal.h | 2 +- drivers/staging/most/hdm-dim2/dim2_hdm.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index 01fa2e535737..e6f35cb0fc01 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -731,7 +731,7 @@ u16 dim_norm_isoc_buffer_size(u16 buf_size, u16 packet_length) * * Returns non-zero correct buffer size or zero by error. */ -u16 DIM_NormSyncBufferSize(u16 buf_size, u16 bytes_per_frame) +u16 dim_norm_sync_buffer_size(u16 buf_size, u16 bytes_per_frame) { if (!check_bytes_per_frame(bytes_per_frame)) return 0; diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index c2e3fcc377cc..cbed686cbafe 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -75,7 +75,7 @@ u16 dim_norm_ctrl_async_buffer_size(u16 buf_size); u16 dim_norm_isoc_buffer_size(u16 buf_size, u16 packet_length); -u16 DIM_NormSyncBufferSize(u16 buf_size, u16 bytes_per_frame); +u16 dim_norm_sync_buffer_size(u16 buf_size, u16 bytes_per_frame); u8 DIM_InitControl(struct dim_channel *ch, u8 is_tx, u16 ch_address, u16 max_buffer_size); diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index 6e457c138151..1e9037f862f5 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -575,7 +575,7 @@ static int configure_channel(struct most_interface *most_iface, int ch_idx, hal_ret = DIM_InitIsoc(&hdm_ch->ch, is_tx, ch_addr, sub_size); break; case MOST_CH_SYNC: - new_size = DIM_NormSyncBufferSize(buf_size, sub_size); + new_size = dim_norm_sync_buffer_size(buf_size, sub_size); if (new_size == 0) { pr_err("%s: invalid sub-buffer size or too small buffer size\n", hdm_ch->name); From a3f3e9211947101b00d3c6d6c0864905a1bde0a9 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 2 Nov 2015 22:59:08 +0900 Subject: [PATCH 408/843] staging: most: rename DIM_InitControl to dim_init_control This patch renames DIM_InitControl to dim_init_control to avoid camelcase found by checkpatch. CHECK: Avoid CamelCase: FILE: drivers/staging/most/hdm-dim2/dim2_hal.c:742: Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.c | 4 ++-- drivers/staging/most/hdm-dim2/dim2_hal.h | 4 ++-- drivers/staging/most/hdm-dim2/dim2_hdm.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index e6f35cb0fc01..6edabbdd0eed 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -739,8 +739,8 @@ u16 dim_norm_sync_buffer_size(u16 buf_size, u16 bytes_per_frame) return norm_sync_buffer_size(buf_size, bytes_per_frame); } -u8 DIM_InitControl(struct dim_channel *ch, u8 is_tx, u16 ch_address, - u16 max_buffer_size) +u8 dim_init_control(struct dim_channel *ch, u8 is_tx, u16 ch_address, + u16 max_buffer_size) { return init_ctrl_async(ch, CAT_CT_VAL_CONTROL, is_tx, ch_address, max_buffer_size); diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index cbed686cbafe..7ab57c96c43d 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -77,8 +77,8 @@ u16 dim_norm_isoc_buffer_size(u16 buf_size, u16 packet_length); u16 dim_norm_sync_buffer_size(u16 buf_size, u16 bytes_per_frame); -u8 DIM_InitControl(struct dim_channel *ch, u8 is_tx, u16 ch_address, - u16 max_buffer_size); +u8 dim_init_control(struct dim_channel *ch, u8 is_tx, u16 ch_address, + u16 max_buffer_size); u8 DIM_InitAsync(struct dim_channel *ch, u8 is_tx, u16 ch_address, u16 max_buffer_size); diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index 1e9037f862f5..02cd10b881a7 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -544,8 +544,8 @@ static int configure_channel(struct most_interface *most_iface, int ch_idx, pr_warn("%s: fixed buffer size (%d -> %d)\n", hdm_ch->name, buf_size, new_size); spin_lock_irqsave(&dim_lock, flags); - hal_ret = DIM_InitControl(&hdm_ch->ch, is_tx, ch_addr, - buf_size); + hal_ret = dim_init_control(&hdm_ch->ch, is_tx, ch_addr, + buf_size); break; case MOST_CH_ASYNC: new_size = dim_norm_ctrl_async_buffer_size(buf_size); From 26303150c3fe9fce81cc1baa60a32aed6ff203ee Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 2 Nov 2015 22:59:09 +0900 Subject: [PATCH 409/843] staging: most: rename DIM_InitAsync to dim_init_async This patch renames DIM_InitAsync to dim_init_async to avoid camelcase found by checkpatch. CHECK: Avoid CamelCase: FILE: drivers/staging/most/hdm-dim2/dim2_hal.c:749: Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.c | 4 ++-- drivers/staging/most/hdm-dim2/dim2_hal.h | 4 ++-- drivers/staging/most/hdm-dim2/dim2_hdm.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index 6edabbdd0eed..a59bb50451a2 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -746,8 +746,8 @@ u8 dim_init_control(struct dim_channel *ch, u8 is_tx, u16 ch_address, max_buffer_size); } -u8 DIM_InitAsync(struct dim_channel *ch, u8 is_tx, u16 ch_address, - u16 max_buffer_size) +u8 dim_init_async(struct dim_channel *ch, u8 is_tx, u16 ch_address, + u16 max_buffer_size) { return init_ctrl_async(ch, CAT_CT_VAL_ASYNC, is_tx, ch_address, max_buffer_size); diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index 7ab57c96c43d..8c60f7eab692 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -80,8 +80,8 @@ u16 dim_norm_sync_buffer_size(u16 buf_size, u16 bytes_per_frame); u8 dim_init_control(struct dim_channel *ch, u8 is_tx, u16 ch_address, u16 max_buffer_size); -u8 DIM_InitAsync(struct dim_channel *ch, u8 is_tx, u16 ch_address, - u16 max_buffer_size); +u8 dim_init_async(struct dim_channel *ch, u8 is_tx, u16 ch_address, + u16 max_buffer_size); u8 DIM_InitIsoc(struct dim_channel *ch, u8 is_tx, u16 ch_address, u16 packet_length); diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index 02cd10b881a7..4bc6c8e8b89a 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -558,7 +558,7 @@ static int configure_channel(struct most_interface *most_iface, int ch_idx, pr_warn("%s: fixed buffer size (%d -> %d)\n", hdm_ch->name, buf_size, new_size); spin_lock_irqsave(&dim_lock, flags); - hal_ret = DIM_InitAsync(&hdm_ch->ch, is_tx, ch_addr, buf_size); + hal_ret = dim_init_async(&hdm_ch->ch, is_tx, ch_addr, buf_size); break; case MOST_CH_ISOC_AVP: new_size = dim_norm_isoc_buffer_size(buf_size, sub_size); From f1383176c928016e6b7c85bb8c646fe829600db0 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 2 Nov 2015 22:59:10 +0900 Subject: [PATCH 410/843] staging: most: rename DIM_InitIsoc to dim_init_isoc This patch renames DIM_InitIsoc to dim_init_isoc to avoid camelcase found by checkpatch. CHECK: Avoid CamelCase: FILE: drivers/staging/most/hdm-dim2/dim2_hal.c:756: Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.c | 4 ++-- drivers/staging/most/hdm-dim2/dim2_hal.h | 4 ++-- drivers/staging/most/hdm-dim2/dim2_hdm.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index a59bb50451a2..3c9ea4cd3c11 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -753,8 +753,8 @@ u8 dim_init_async(struct dim_channel *ch, u8 is_tx, u16 ch_address, max_buffer_size); } -u8 DIM_InitIsoc(struct dim_channel *ch, u8 is_tx, u16 ch_address, - u16 packet_length) +u8 dim_init_isoc(struct dim_channel *ch, u8 is_tx, u16 ch_address, + u16 packet_length) { if (!g.dim_is_initialized || !ch) return DIM_ERR_DRIVER_NOT_INITIALIZED; diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index 8c60f7eab692..43e79c97851f 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -83,8 +83,8 @@ u8 dim_init_control(struct dim_channel *ch, u8 is_tx, u16 ch_address, u8 dim_init_async(struct dim_channel *ch, u8 is_tx, u16 ch_address, u16 max_buffer_size); -u8 DIM_InitIsoc(struct dim_channel *ch, u8 is_tx, u16 ch_address, - u16 packet_length); +u8 dim_init_isoc(struct dim_channel *ch, u8 is_tx, u16 ch_address, + u16 packet_length); u8 DIM_InitSync(struct dim_channel *ch, u8 is_tx, u16 ch_address, u16 bytes_per_frame); diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index 4bc6c8e8b89a..43a9c2b28148 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -572,7 +572,7 @@ static int configure_channel(struct most_interface *most_iface, int ch_idx, pr_warn("%s: fixed buffer size (%d -> %d)\n", hdm_ch->name, buf_size, new_size); spin_lock_irqsave(&dim_lock, flags); - hal_ret = DIM_InitIsoc(&hdm_ch->ch, is_tx, ch_addr, sub_size); + hal_ret = dim_init_isoc(&hdm_ch->ch, is_tx, ch_addr, sub_size); break; case MOST_CH_SYNC: new_size = dim_norm_sync_buffer_size(buf_size, sub_size); From 10e5efb7b51f30b696a2cde366b783d8ecd0f465 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 2 Nov 2015 22:59:11 +0900 Subject: [PATCH 411/843] staging: most: rename DIM_InitSync to dim_init_sync This patch renames DIM_InitSync to dim_init_sync to avoid camelcase found by checkpatch. CHECK: Avoid CamelCase: FILE: drivers/staging/most/hdm-dim2/dim2_hal.c:781: Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.c | 4 ++-- drivers/staging/most/hdm-dim2/dim2_hal.h | 4 ++-- drivers/staging/most/hdm-dim2/dim2_hdm.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index 3c9ea4cd3c11..a57816ae861e 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -778,8 +778,8 @@ u8 dim_init_isoc(struct dim_channel *ch, u8 is_tx, u16 ch_address, return DIM_NO_ERROR; } -u8 DIM_InitSync(struct dim_channel *ch, u8 is_tx, u16 ch_address, - u16 bytes_per_frame) +u8 dim_init_sync(struct dim_channel *ch, u8 is_tx, u16 ch_address, + u16 bytes_per_frame) { if (!g.dim_is_initialized || !ch) return DIM_ERR_DRIVER_NOT_INITIALIZED; diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index 43e79c97851f..8692bb7dd68f 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -86,8 +86,8 @@ u8 dim_init_async(struct dim_channel *ch, u8 is_tx, u16 ch_address, u8 dim_init_isoc(struct dim_channel *ch, u8 is_tx, u16 ch_address, u16 packet_length); -u8 DIM_InitSync(struct dim_channel *ch, u8 is_tx, u16 ch_address, - u16 bytes_per_frame); +u8 dim_init_sync(struct dim_channel *ch, u8 is_tx, u16 ch_address, + u16 bytes_per_frame); u8 DIM_DestroyChannel(struct dim_channel *ch); diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index 43a9c2b28148..63219852d112 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -586,7 +586,7 @@ static int configure_channel(struct most_interface *most_iface, int ch_idx, pr_warn("%s: fixed buffer size (%d -> %d)\n", hdm_ch->name, buf_size, new_size); spin_lock_irqsave(&dim_lock, flags); - hal_ret = DIM_InitSync(&hdm_ch->ch, is_tx, ch_addr, sub_size); + hal_ret = dim_init_sync(&hdm_ch->ch, is_tx, ch_addr, sub_size); break; default: pr_err("%s: configure failed, bad channel type: %d\n", From a5e4d891a3968ded645a1c556f021097b2faa514 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 2 Nov 2015 22:59:12 +0900 Subject: [PATCH 412/843] staging: most: rename DIM_DestroyChannel to dim_destroy_channel This patch renames DIM_DestroyChannel to dim_destroy_channel to avoid camelcase found by checkpatch. CHECK: Avoid CamelCase: FILE: drivers/staging/most/hdm-dim2/dim2_hal.c:806: Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.c | 2 +- drivers/staging/most/hdm-dim2/dim2_hal.h | 2 +- drivers/staging/most/hdm-dim2/dim2_hdm.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index a57816ae861e..cb92461fa36c 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -803,7 +803,7 @@ u8 dim_init_sync(struct dim_channel *ch, u8 is_tx, u16 ch_address, return DIM_NO_ERROR; } -u8 DIM_DestroyChannel(struct dim_channel *ch) +u8 dim_destroy_channel(struct dim_channel *ch) { if (!g.dim_is_initialized || !ch) return DIM_ERR_DRIVER_NOT_INITIALIZED; diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index 8692bb7dd68f..bdde159671a8 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -89,7 +89,7 @@ u8 dim_init_isoc(struct dim_channel *ch, u8 is_tx, u16 ch_address, u8 dim_init_sync(struct dim_channel *ch, u8 is_tx, u16 ch_address, u16 bytes_per_frame); -u8 DIM_DestroyChannel(struct dim_channel *ch); +u8 dim_destroy_channel(struct dim_channel *ch); void DIM_ServiceIrq(struct dim_channel *const *channels); diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index 63219852d112..6cd6c788e6f7 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -706,7 +706,7 @@ static int poison_channel(struct most_interface *most_iface, int ch_idx) return -EPERM; spin_lock_irqsave(&dim_lock, flags); - hal_ret = DIM_DestroyChannel(&hdm_ch->ch); + hal_ret = dim_destroy_channel(&hdm_ch->ch); hdm_ch->is_initialized = false; if (ch_idx == dev->atx_idx) dev->atx_idx = -1; From e5baa9e99cc3f5bbca84d8894aed4b39692c41e6 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 2 Nov 2015 22:59:13 +0900 Subject: [PATCH 413/843] staging: most: rename DIM_ServiceIrq to dim_service_irq This patch renames DIM_ServiceIrq to dim_service_irq to avoid camelcase found by checkpatch. CHECK: Avoid CamelCase: FILE: drivers/staging/most/hdm-dim2/dim2_hal.c:819: Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.c | 2 +- drivers/staging/most/hdm-dim2/dim2_hal.h | 2 +- drivers/staging/most/hdm-dim2/dim2_hdm.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index cb92461fa36c..4a7d7fb11bfc 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -816,7 +816,7 @@ u8 dim_destroy_channel(struct dim_channel *ch) return DIM_NO_ERROR; } -void DIM_ServiceIrq(struct dim_channel *const *channels) +void dim_service_irq(struct dim_channel *const *channels) { bool state_changed; diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index bdde159671a8..6eb8da16160f 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -91,7 +91,7 @@ u8 dim_init_sync(struct dim_channel *ch, u8 is_tx, u16 ch_address, u8 dim_destroy_channel(struct dim_channel *ch); -void DIM_ServiceIrq(struct dim_channel *const *channels); +void dim_service_irq(struct dim_channel *const *channels); u8 DIM_ServiceChannel(struct dim_channel *ch); diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index 6cd6c788e6f7..7767cdcda6fd 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -452,7 +452,7 @@ static irqreturn_t dim2_ahb_isr(int irq, void *_dev) unsigned long flags; spin_lock_irqsave(&dim_lock, flags); - DIM_ServiceIrq(get_active_channels(dev, buffer)); + dim_service_irq(get_active_channels(dev, buffer)); spin_unlock_irqrestore(&dim_lock, flags); #if !defined(ENABLE_HDM_TEST) From 0d08d54f8da9f54bd861f694a81208a8a0625b95 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 2 Nov 2015 22:59:14 +0900 Subject: [PATCH 414/843] staging: most: rename DIM_ServiceChannel to dim_service_channel This patch renames DIM_ServiceChannel to dim_service_channel to avoid camelcase found by checkpatch. CHECK: Avoid CamelCase: FILE: drivers/staging/most/hdm-dim2/dim2_hal.c:857: Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.c | 2 +- drivers/staging/most/hdm-dim2/dim2_hal.h | 2 +- drivers/staging/most/hdm-dim2/dim2_hdm.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index 4a7d7fb11bfc..a96457c60f6d 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -854,7 +854,7 @@ void dim_service_irq(struct dim_channel *const *channels) dimcb_io_write(&g.dim2->MS1, 0); } -u8 DIM_ServiceChannel(struct dim_channel *ch) +u8 dim_service_channel(struct dim_channel *ch) { if (!g.dim_is_initialized || !ch) return DIM_ERR_DRIVER_NOT_INITIALIZED; diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index 6eb8da16160f..f333f0adbcd2 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -93,7 +93,7 @@ u8 dim_destroy_channel(struct dim_channel *ch); void dim_service_irq(struct dim_channel *const *channels); -u8 DIM_ServiceChannel(struct dim_channel *ch); +u8 dim_service_channel(struct dim_channel *ch); struct dim_ch_state_t *DIM_GetChannelState(struct dim_channel *ch, struct dim_ch_state_t *dim_ch_state_ptr); diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index 7767cdcda6fd..4b5df0b06008 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -428,7 +428,7 @@ static void dim2_tasklet_fn(unsigned long data) continue; spin_lock_irqsave(&dim_lock, flags); - DIM_ServiceChannel(&dev->hch[ch_idx].ch); + dim_service_channel(&dev->hch[ch_idx].ch); spin_unlock_irqrestore(&dim_lock, flags); service_done_flag(dev, ch_idx); From e38092531282db8bdf8c8f3e9607e551b2f1a906 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 2 Nov 2015 22:59:15 +0900 Subject: [PATCH 415/843] staging: most: fix argument name of DIM_GetChannelState The second argument name of DIM_GetChannelState declaration changes from dim_ch_state_ptr to state_ptr. The DIM_GetChannelState declaration and definition has same argument name as state_ptr. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index f333f0adbcd2..76e4a62f2f20 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -96,7 +96,7 @@ void dim_service_irq(struct dim_channel *const *channels); u8 dim_service_channel(struct dim_channel *ch); struct dim_ch_state_t *DIM_GetChannelState(struct dim_channel *ch, - struct dim_ch_state_t *dim_ch_state_ptr); + struct dim_ch_state_t *state_ptr); bool DIM_EnqueueBuffer(struct dim_channel *ch, u32 buffer_addr, u16 buffer_size); From 60d5f66ce5e1a569fe0230bc1b23bfb5295f383d Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 2 Nov 2015 22:59:16 +0900 Subject: [PATCH 416/843] staging: most: rename DIM_GetChannelState to dim_get_channel_state This patch renames DIM_GetChannelState to dim_get_channel_state to avoid camelcase found by checkpatch. CHECK: Avoid CamelCase: FILE: drivers/staging/most/hdm-dim2/dim2_hal.c:865: Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.c | 4 ++-- drivers/staging/most/hdm-dim2/dim2_hal.h | 4 ++-- drivers/staging/most/hdm-dim2/dim2_hdm.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index a96457c60f6d..e80a12ec0db4 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -862,8 +862,8 @@ u8 dim_service_channel(struct dim_channel *ch) return channel_service(ch); } -struct dim_ch_state_t *DIM_GetChannelState(struct dim_channel *ch, - struct dim_ch_state_t *state_ptr) +struct dim_ch_state_t *dim_get_channel_state(struct dim_channel *ch, + struct dim_ch_state_t *state_ptr) { if (!ch || !state_ptr) return NULL; diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index 76e4a62f2f20..1ca7a1a2e0c5 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -95,8 +95,8 @@ void dim_service_irq(struct dim_channel *const *channels); u8 dim_service_channel(struct dim_channel *ch); -struct dim_ch_state_t *DIM_GetChannelState(struct dim_channel *ch, - struct dim_ch_state_t *state_ptr); +struct dim_ch_state_t *dim_get_channel_state(struct dim_channel *ch, + struct dim_ch_state_t *state_ptr); bool DIM_EnqueueBuffer(struct dim_channel *ch, u32 buffer_addr, u16 buffer_size); diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index 4b5df0b06008..6524c3ce9685 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -246,7 +246,7 @@ static int try_start_dim_transfer(struct hdm_channel *hdm_ch) return -EAGAIN; } - if (!DIM_GetChannelState(&hdm_ch->ch, &st)->ready) { + if (!dim_get_channel_state(&hdm_ch->ch, &st)->ready) { spin_unlock_irqrestore(&dim_lock, flags); return -EAGAIN; } @@ -340,7 +340,7 @@ static void service_done_flag(struct dim2_hdm *dev, int ch_idx) spin_lock_irqsave(&dim_lock, flags); - done_buffers = DIM_GetChannelState(&hdm_ch->ch, &st)->done_buffers; + done_buffers = dim_get_channel_state(&hdm_ch->ch, &st)->done_buffers; if (!done_buffers) { spin_unlock_irqrestore(&dim_lock, flags); return; From c904ffdaf3e3ab679e43b9a87df02ff502dbd70c Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Mon, 2 Nov 2015 22:59:17 +0900 Subject: [PATCH 417/843] staging: most: rename DIM_EnqueueBuffer to dim_enqueue_buffer This patch renames DIM_EnqueueBuffer to dim_enqueue_buffer to avoid camelcase found by checkpatch. CHECK: Avoid CamelCase: FILE: drivers/staging/most/hdm-dim2/dim2_hal.c:877: Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/hdm-dim2/dim2_hal.c | 3 ++- drivers/staging/most/hdm-dim2/dim2_hal.h | 4 ++-- drivers/staging/most/hdm-dim2/dim2_hdm.c | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c index e80a12ec0db4..172257596f1f 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.c +++ b/drivers/staging/most/hdm-dim2/dim2_hal.c @@ -874,7 +874,8 @@ struct dim_ch_state_t *dim_get_channel_state(struct dim_channel *ch, return state_ptr; } -bool DIM_EnqueueBuffer(struct dim_channel *ch, u32 buffer_addr, u16 buffer_size) +bool dim_enqueue_buffer(struct dim_channel *ch, u32 buffer_addr, + u16 buffer_size) { if (!ch) return dim_on_error(DIM_ERR_DRIVER_NOT_INITIALIZED, diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h b/drivers/staging/most/hdm-dim2/dim2_hal.h index 1ca7a1a2e0c5..48cdd9c8cde1 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hal.h +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h @@ -98,8 +98,8 @@ u8 dim_service_channel(struct dim_channel *ch); struct dim_ch_state_t *dim_get_channel_state(struct dim_channel *ch, struct dim_ch_state_t *state_ptr); -bool DIM_EnqueueBuffer(struct dim_channel *ch, u32 buffer_addr, - u16 buffer_size); +bool dim_enqueue_buffer(struct dim_channel *ch, u32 buffer_addr, + u16 buffer_size); bool dim_detach_buffers(struct dim_channel *ch, u16 buffers_number); diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index 6524c3ce9685..327d738c7194 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -73,8 +73,8 @@ struct hdm_channel { char name[sizeof "caNNN"]; bool is_initialized; struct dim_channel ch; - struct list_head pending_list; /* before DIM_EnqueueBuffer() */ - struct list_head started_list; /* after DIM_EnqueueBuffer() */ + struct list_head pending_list; /* before dim_enqueue_buffer() */ + struct list_head started_list; /* after dim_enqueue_buffer() */ enum most_channel_direction direction; enum most_channel_data_type data_type; }; @@ -255,7 +255,7 @@ static int try_start_dim_transfer(struct hdm_channel *hdm_ch) buf_size = mbo->buffer_length; BUG_ON(mbo->bus_address == 0); - if (!DIM_EnqueueBuffer(&hdm_ch->ch, mbo->bus_address, buf_size)) { + if (!dim_enqueue_buffer(&hdm_ch->ch, mbo->bus_address, buf_size)) { list_del(head->next); spin_unlock_irqrestore(&dim_lock, flags); mbo->processed_length = 0; From e23afff94803e9735d4f0edda0c77efad8d408a4 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Thu, 5 Nov 2015 14:34:43 +0100 Subject: [PATCH 418/843] staging: most: Delete an unnecessary check before the function call "module_put" The module_put() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: Greg Kroah-Hartman --- drivers/staging/most/mostcore/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/mostcore/core.c index 19852ca7e59c..ed1ed25b6d1d 100644 --- a/drivers/staging/most/mostcore/core.c +++ b/drivers/staging/most/mostcore/core.c @@ -1587,8 +1587,7 @@ out: return 0; error: - if (iface->mod) - module_put(iface->mod); + module_put(iface->mod); modref--; mutex_unlock(&c->start_mutex); return ret; From 6c63e4238acad0bb5394e0fd50d993edd23c0dc7 Mon Sep 17 00:00:00 2001 From: Sebastian Sanchez Date: Fri, 6 Nov 2015 20:06:56 -0500 Subject: [PATCH 419/843] staging/rdma/hfi1: Convert dd_dev_info() to hfi1_cdbg() in process startup Replacing dd_dev_info() for hfi1_cdbg() to avoid generating syslog output for every context that is open by PSM. Reviewed-by: Mitko Haralanov Signed-off-by: Sebastian Sanchez Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/file_ops.c | 10 ++++----- drivers/staging/rdma/hfi1/init.c | 31 ++++++++++++++++------------ drivers/staging/rdma/hfi1/pio.c | 19 +++++++++-------- 3 files changed, 33 insertions(+), 27 deletions(-) diff --git a/drivers/staging/rdma/hfi1/file_ops.c b/drivers/staging/rdma/hfi1/file_ops.c index 3b15eb4d5bf9..97ca9ec8fd3f 100644 --- a/drivers/staging/rdma/hfi1/file_ops.c +++ b/drivers/staging/rdma/hfi1/file_ops.c @@ -663,9 +663,9 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma) } vma->vm_flags = flags; - dd_dev_info(dd, - "%s: %u:%u type:%u io/vf:%d/%d, addr:0x%llx, len:%lu(%lu), flags:0x%lx\n", - __func__, ctxt, subctxt, type, mapio, vmf, memaddr, memlen, + hfi1_cdbg(PROC, + "%u:%u type:%u io/vf:%d/%d, addr:0x%llx, len:%lu(%lu), flags:0x%lx\n", + ctxt, subctxt, type, mapio, vmf, memaddr, memlen, vma->vm_end - vma->vm_start, vma->vm_flags); pfn = (unsigned long)(memaddr >> PAGE_SHIFT); if (vmf) { @@ -989,8 +989,8 @@ static int allocate_ctxt(struct file *fp, struct hfi1_devdata *dd, if (!uctxt->sc) return -ENOMEM; - dbg("allocated send context %u(%u)\n", uctxt->sc->sw_index, - uctxt->sc->hw_context); + hfi1_cdbg(PROC, "allocated send context %u(%u)\n", uctxt->sc->sw_index, + uctxt->sc->hw_context); ret = sc_enable(uctxt->sc); if (ret) return ret; diff --git a/drivers/staging/rdma/hfi1/init.c b/drivers/staging/rdma/hfi1/init.c index 8666f3ad24e9..4a7974442154 100644 --- a/drivers/staging/rdma/hfi1/init.c +++ b/drivers/staging/rdma/hfi1/init.c @@ -60,6 +60,7 @@ #include "hfi.h" #include "device.h" #include "common.h" +#include "trace.h" #include "mad.h" #include "sdma.h" #include "debugfs.h" @@ -208,7 +209,7 @@ struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct hfi1_pportdata *ppd, u32 ctxt) if (rcd) { u32 rcvtids, max_entries; - dd_dev_info(dd, "%s: setting up context %u\n", __func__, ctxt); + hfi1_cdbg(PROC, "setting up context %u\n", ctxt); INIT_LIST_HEAD(&rcd->qp_wait_list); rcd->ppd = ppd; @@ -279,8 +280,9 @@ struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct hfi1_pportdata *ppd, u32 ctxt) rcd->ctxt); rcd->egrbufs.count = MAX_EAGER_ENTRIES; } - dd_dev_info(dd, "ctxt%u: max Eager buffer RcvArray entries: %u\n", - rcd->ctxt, rcd->egrbufs.count); + hfi1_cdbg(PROC, + "ctxt%u: max Eager buffer RcvArray entries: %u\n", + rcd->ctxt, rcd->egrbufs.count); /* * Allocate array that will hold the eager buffer accounting @@ -308,8 +310,8 @@ struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct hfi1_pportdata *ppd, u32 ctxt) */ if (rcd->egrbufs.size < hfi1_max_mtu) { rcd->egrbufs.size = __roundup_pow_of_two(hfi1_max_mtu); - dd_dev_info(dd, - "ctxt%u: eager bufs size too small. Adjusting to %zu\n", + hfi1_cdbg(PROC, + "ctxt%u: eager bufs size too small. Adjusting to %zu\n", rcd->ctxt, rcd->egrbufs.size); } rcd->egrbufs.rcvtid_size = HFI1_MAX_EAGER_BUFFER_SIZE; @@ -1660,9 +1662,11 @@ int hfi1_setup_eagerbufs(struct hfi1_ctxtdata *rcd) rcd->egrbufs.numbufs = idx; rcd->egrbufs.size = alloced_bytes; - dd_dev_info(dd, "ctxt%u: Alloced %u rcv tid entries @ %uKB, total %zuKB\n", - rcd->ctxt, rcd->egrbufs.alloced, rcd->egrbufs.rcvtid_size, - rcd->egrbufs.size); + hfi1_cdbg(PROC, + "ctxt%u: Alloced %u rcv tid entries @ %uKB, total %zuKB\n", + rcd->ctxt, rcd->egrbufs.alloced, rcd->egrbufs.rcvtid_size, + rcd->egrbufs.size); + /* * Set the contexts rcv array head update threshold to the closest @@ -1683,13 +1687,14 @@ int hfi1_setup_eagerbufs(struct hfi1_ctxtdata *rcd) rcd->expected_count = MAX_TID_PAIR_ENTRIES * 2; rcd->expected_base = rcd->eager_base + egrtop; - dd_dev_info(dd, "ctxt%u: eager:%u, exp:%u, egrbase:%u, expbase:%u\n", - rcd->ctxt, rcd->egrbufs.alloced, rcd->expected_count, - rcd->eager_base, rcd->expected_base); + hfi1_cdbg(PROC, "ctxt%u: eager:%u, exp:%u, egrbase:%u, expbase:%u\n", + rcd->ctxt, rcd->egrbufs.alloced, rcd->expected_count, + rcd->eager_base, rcd->expected_base); if (!hfi1_rcvbuf_validate(rcd->egrbufs.rcvtid_size, PT_EAGER, &order)) { - dd_dev_err(dd, "ctxt%u: current Eager buffer size is invalid %u\n", - rcd->ctxt, rcd->egrbufs.rcvtid_size); + hfi1_cdbg(PROC, + "ctxt%u: current Eager buffer size is invalid %u\n", + rcd->ctxt, rcd->egrbufs.rcvtid_size); ret = -EINVAL; goto bail; } diff --git a/drivers/staging/rdma/hfi1/pio.c b/drivers/staging/rdma/hfi1/pio.c index e5c32db4bc67..eab58c12d915 100644 --- a/drivers/staging/rdma/hfi1/pio.c +++ b/drivers/staging/rdma/hfi1/pio.c @@ -815,15 +815,16 @@ struct send_context *sc_alloc(struct hfi1_devdata *dd, int type, } } - dd_dev_info(dd, - "Send context %u(%u) %s group %u credits %u credit_ctrl 0x%llx threshold %u\n", - sw_index, - hw_context, - sc_type_name(type), - sc->group, - sc->credits, - sc->credit_ctrl, - thresh); + hfi1_cdbg(PIO, + "Send context %u(%u) %s group %u credits %u credit_ctrl 0x%llx threshold %u\n", + sw_index, + hw_context, + sc_type_name(type), + sc->group, + sc->credits, + sc->credit_ctrl, + thresh); + return sc; } From 72a67ba2fa69737757c637ac541a4f0271efb41d Mon Sep 17 00:00:00 2001 From: Easwar Hariharan Date: Fri, 6 Nov 2015 20:06:57 -0500 Subject: [PATCH 420/843] staging/rdma/hfi1: Clear the QSFP reset that is asserted on FLR The FLR on driver load asserts the QSFP reset pin and the driver does not deassert it after. This patch allows the external QSFP cable to exit reset by writing 1 to all the QSFP pins. Reviewed-by: Dean Luick Signed-off-by: Easwar Hariharan Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/chip.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index 4e22477c9739..dd2ba2516a66 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -9923,19 +9923,16 @@ static void init_chip(struct hfi1_devdata *dd) setextled(dd, 0); /* * Clear the QSFP reset. - * A0 leaves the out lines floating on power on, then on an FLR - * enforces a 0 on all out pins. The driver does not touch + * An FLR enforces a 0 on all out pins. The driver does not touch * ASIC_QSFPn_OUT otherwise. This leaves RESET_N low and - * anything plugged constantly in reset, if it pays attention + * anything plugged constantly in reset, if it pays attention * to RESET_N. - * A prime example of this is SiPh. For now, set all pins high. + * Prime examples of this are optical cables. Set all pins high. * I2CCLK and I2CDAT will change per direction, and INT_N and * MODPRS_N are input only and their value is ignored. */ - if (is_a0(dd)) { - write_csr(dd, ASIC_QSFP1_OUT, 0x1f); - write_csr(dd, ASIC_QSFP2_OUT, 0x1f); - } + write_csr(dd, ASIC_QSFP1_OUT, 0x1f); + write_csr(dd, ASIC_QSFP2_OUT, 0x1f); } static void init_early_variables(struct hfi1_devdata *dd) From bf70a77577361c334367a2a2add9d92b716a2481 Mon Sep 17 00:00:00 2001 From: Vennila Megavannan Date: Fri, 6 Nov 2015 20:06:58 -0500 Subject: [PATCH 421/843] staging/rdma/hfi1: Enable WFR PCIe extended tags from the driver Some BIOS implementations turn off extended tags in DevCtl (a RW field) even though it was originally set and is advertised in DevCap Fix is to set it in the driver Reviewed-by: Dean Luick Reviewed-by: Mike Marciniszyn Reviewed-by: Ashutosh Dixit Signed-off-by: Vennila Megavannan Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/pcie.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rdma/hfi1/pcie.c b/drivers/staging/rdma/hfi1/pcie.c index f531d0f6b212..7fcf0896b65a 100644 --- a/drivers/staging/rdma/hfi1/pcie.c +++ b/drivers/staging/rdma/hfi1/pcie.c @@ -467,8 +467,18 @@ static void tune_pcie_caps(struct hfi1_devdata *dd) { struct pci_dev *parent; u16 rc_mpss, rc_mps, ep_mpss, ep_mps; - u16 rc_mrrs, ep_mrrs, max_mrrs; + u16 rc_mrrs, ep_mrrs, max_mrrs, ectl; + /* + * Turn on extended tags in DevCtl in case the BIOS has turned it off + * to improve WFR SDMA bandwidth + */ + pcie_capability_read_word(dd->pcidev, PCI_EXP_DEVCTL, &ectl); + if (!(ectl & PCI_EXP_DEVCTL_EXT_TAG)) { + dd_dev_info(dd, "Enabling PCIe extended tags\n"); + ectl |= PCI_EXP_DEVCTL_EXT_TAG; + pcie_capability_write_word(dd->pcidev, PCI_EXP_DEVCTL, ectl); + } /* Find out supported and configured values for parent (root) */ parent = dd->pcidev->bus->self; if (!pci_is_root_bus(parent->bus)) { From 65fcf5576441eb23cd1f2c9f271cbf27e3455581 Mon Sep 17 00:00:00 2001 From: Dean Luick Date: Fri, 6 Nov 2015 20:06:59 -0500 Subject: [PATCH 422/843] staging/rdma/hfi1: Always download SBus firmware B0 dual port parts require the SBus firmware to always be downloaded. Remove reset of the SBus Master spico. It is not necessary since the SBus firmware download already does that. Reviewed-by: Dennis Dalessandro Signed-off-by: Dean Luick Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/firmware.c | 2 +- drivers/staging/rdma/hfi1/pcie.c | 12 +----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/staging/rdma/hfi1/firmware.c b/drivers/staging/rdma/hfi1/firmware.c index b4bdcf341aac..f3112821cf47 100644 --- a/drivers/staging/rdma/hfi1/firmware.c +++ b/drivers/staging/rdma/hfi1/firmware.c @@ -1568,7 +1568,7 @@ int load_pcie_firmware(struct hfi1_devdata *dd) /* both firmware loads below use the SBus */ set_sbus_fast_mode(dd); - if (fw_sbus_load && (dd->flags & HFI1_DO_INIT_ASIC)) { + if (fw_sbus_load) { turn_off_spicos(dd, SPICO_SBUS); ret = load_sbus_firmware(dd, &fw_sbus); if (ret) diff --git a/drivers/staging/rdma/hfi1/pcie.c b/drivers/staging/rdma/hfi1/pcie.c index 7fcf0896b65a..0b7eafb0fc70 100644 --- a/drivers/staging/rdma/hfi1/pcie.c +++ b/drivers/staging/rdma/hfi1/pcie.c @@ -949,17 +949,7 @@ int do_pcie_gen3_transition(struct hfi1_devdata *dd) } retry: - - if (therm) { - /* - * toggle SPICO_ENABLE to get back to the state - * just after the firmware load - */ - sbus_request(dd, SBUS_MASTER_BROADCAST, 0x01, - WRITE_SBUS_RECEIVER, 0x00000040); - sbus_request(dd, SBUS_MASTER_BROADCAST, 0x01, - WRITE_SBUS_RECEIVER, 0x00000140); - } + /* the SBus download will reset the spico for thermal */ /* step 3: download SBus Master firmware */ /* step 4: download PCIe Gen3 SerDes firmware */ From 4ef98989cb08af8c7c9c955cd69327bb67dcd027 Mon Sep 17 00:00:00 2001 From: Jareer Abdel-Qader Date: Fri, 6 Nov 2015 20:07:00 -0500 Subject: [PATCH 423/843] staging/rdma/hfi1: Disable thermal polling before sensor initialization During driver load the thermal sensor needs to be reset prior to initialization of the sensor. This prevents a possible sensor lock up which can cause the wrong temperature value to be reported. This fix leads to remove disabling thermal polling from reset_asic_csrs() function. Reviewed by: Dennis Dalessandro Reviewed by: Easwar Hariharan Signed-off-by: Jareer Abdel-Qader Signed-off-by: Ira Weiny Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/chip.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index dd2ba2516a66..e842aee00535 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -9449,7 +9449,7 @@ static void reset_asic_csrs(struct hfi1_devdata *dd) /* We might want to retain this state across FLR if we ever use it */ write_csr(dd, ASIC_CFG_DRV_STR, 0); - write_csr(dd, ASIC_CFG_THERM_POLL_EN, 0); + /* ASIC_CFG_THERM_POLL_EN leave alone */ /* ASIC_STS_THERM read-only */ /* ASIC_CFG_RESET leave alone */ @@ -10794,7 +10794,9 @@ static int thermal_init(struct hfi1_devdata *dd) acquire_hw_mutex(dd); dd_dev_info(dd, "Initializing thermal sensor\n"); - + /* Disable polling of thermal readings */ + write_csr(dd, ASIC_CFG_THERM_POLL_EN, 0x0); + msleep(100); /* Thermal Sensor Initialization */ /* Step 1: Reset the Thermal SBus Receiver */ ret = sbus_request_slow(dd, SBUS_THERMAL, 0x0, From 702249732580f8f9b392552806b55206642ff401 Mon Sep 17 00:00:00 2001 From: Dean Luick Date: Fri, 6 Nov 2015 20:07:01 -0500 Subject: [PATCH 424/843] staging/rdma/hfi1: Select only devices with active links When looking for or validating a user device, only use devices that are currently active. Reviewed-by: Mitko Haralanov Signed-off-by: Dean Luick Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/file_ops.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rdma/hfi1/file_ops.c b/drivers/staging/rdma/hfi1/file_ops.c index 97ca9ec8fd3f..22037ce984c8 100644 --- a/drivers/staging/rdma/hfi1/file_ops.c +++ b/drivers/staging/rdma/hfi1/file_ops.c @@ -850,6 +850,14 @@ done: return ret; } +/* return true if the device available for general use */ +static int usable_device(struct hfi1_devdata *dd) +{ + struct hfi1_pportdata *ppd = dd->pport; + + return driver_lstate(ppd) == IB_PORT_ACTIVE; +} + static int get_user_context(struct file *fp, struct hfi1_user_info *uinfo, int devno, unsigned alg) { @@ -879,7 +887,11 @@ static int get_user_context(struct file *fp, struct hfi1_user_info *uinfo, for (dev = 0; dev < devmax; dev++) { pdd = hfi1_lookup(dev); - if (pdd && pdd->freectxts && + if (!pdd) + continue; + if (!usable_device(pdd)) + continue; + if (pdd->freectxts && pdd->freectxts > free) { dd = pdd; free = pdd->freectxts; @@ -888,7 +900,11 @@ static int get_user_context(struct file *fp, struct hfi1_user_info *uinfo, } else { for (dev = 0; dev < devmax; dev++) { pdd = hfi1_lookup(dev); - if (pdd && pdd->freectxts) { + if (!pdd) + continue; + if (!usable_device(pdd)) + continue; + if (pdd->freectxts) { dd = pdd; break; } @@ -913,7 +929,6 @@ static int find_shared_ctxt(struct file *fp, for (ndev = 0; ndev < devmax; ndev++) { struct hfi1_devdata *dd = hfi1_lookup(ndev); - /* device portion of usable() */ if (!(dd && (dd->flags & HFI1_PRESENT) && dd->kregbase)) continue; for (i = dd->first_user_ctxt; i < dd->num_rcv_contexts; i++) { From 801cfd6d8a24051a34d3cd4429e1ddc172b5aad6 Mon Sep 17 00:00:00 2001 From: Sebastian Sanchez Date: Fri, 6 Nov 2015 20:07:02 -0500 Subject: [PATCH 425/843] staging/rdma/hfi1: Fix for opaportconfig ledon by not checking for portNum opaportconfig ledon fails with error message due to port number being checked in the attr modifier. This change removes the check for the port number in AttrMod, so the P field is ignored. Reviewed-by: Easwar Hariharan Signed-off-by: Sebastian Sanchez Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/mad.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rdma/hfi1/mad.c b/drivers/staging/rdma/hfi1/mad.c index 32f703736185..a1225651005c 100644 --- a/drivers/staging/rdma/hfi1/mad.c +++ b/drivers/staging/rdma/hfi1/mad.c @@ -3458,7 +3458,7 @@ static int __subn_get_opa_led_info(struct opa_smp *smp, u32 am, u8 *data, u32 nport = OPA_AM_NPORT(am); u64 reg; - if (nport != 1 || OPA_AM_PORTNUM(am)) { + if (nport != 1) { smp->status |= IB_SMP_INVALID_FIELD; return reply((struct ib_mad_hdr *)smp); } @@ -3483,7 +3483,7 @@ static int __subn_set_opa_led_info(struct opa_smp *smp, u32 am, u8 *data, u32 nport = OPA_AM_NPORT(am); int on = !!(be32_to_cpu(p->rsvd_led_mask) & OPA_LED_MASK); - if (nport != 1 || OPA_AM_PORTNUM(am)) { + if (nport != 1) { smp->status |= IB_SMP_INVALID_FIELD; return reply((struct ib_mad_hdr *)smp); } From a03a03e956c2cb8d0c69d33edb149c6a64584a48 Mon Sep 17 00:00:00 2001 From: Ignacio Hernandez Date: Fri, 6 Nov 2015 20:07:03 -0500 Subject: [PATCH 426/843] staging/rdma/hfi1: Remove spurious error messages Changed the order in which diagnostics messages are printed, taking into account the cases where the errors are handled in rcv_hdrerr() and no further message is needed to report. Reviewed-by: Mark Debbage Reviewed-by: Arthur Kepner Reviewed-by: Mike Marciniszyn Signed-off-by: Ignacio Hernandez Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/driver.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/staging/rdma/hfi1/driver.c b/drivers/staging/rdma/hfi1/driver.c index 9a4ec09af020..72ab5e145f49 100644 --- a/drivers/staging/rdma/hfi1/driver.c +++ b/drivers/staging/rdma/hfi1/driver.c @@ -1156,20 +1156,20 @@ void handle_eflags(struct hfi1_packet *packet) struct hfi1_ctxtdata *rcd = packet->rcd; u32 rte = rhf_rcv_type_err(packet->rhf); - dd_dev_err(rcd->dd, - "receive context %d: rhf 0x%016llx, errs [ %s%s%s%s%s%s%s%s] rte 0x%x\n", - rcd->ctxt, packet->rhf, - packet->rhf & RHF_K_HDR_LEN_ERR ? "k_hdr_len " : "", - packet->rhf & RHF_DC_UNC_ERR ? "dc_unc " : "", - packet->rhf & RHF_DC_ERR ? "dc " : "", - packet->rhf & RHF_TID_ERR ? "tid " : "", - packet->rhf & RHF_LEN_ERR ? "len " : "", - packet->rhf & RHF_ECC_ERR ? "ecc " : "", - packet->rhf & RHF_VCRC_ERR ? "vcrc " : "", - packet->rhf & RHF_ICRC_ERR ? "icrc " : "", - rte); - rcv_hdrerr(rcd, rcd->ppd, packet); + if (rhf_err_flags(packet->rhf)) + dd_dev_err(rcd->dd, + "receive context %d: rhf 0x%016llx, errs [ %s%s%s%s%s%s%s%s] rte 0x%x\n", + rcd->ctxt, packet->rhf, + packet->rhf & RHF_K_HDR_LEN_ERR ? "k_hdr_len " : "", + packet->rhf & RHF_DC_UNC_ERR ? "dc_unc " : "", + packet->rhf & RHF_DC_ERR ? "dc " : "", + packet->rhf & RHF_TID_ERR ? "tid " : "", + packet->rhf & RHF_LEN_ERR ? "len " : "", + packet->rhf & RHF_ECC_ERR ? "ecc " : "", + packet->rhf & RHF_VCRC_ERR ? "vcrc " : "", + packet->rhf & RHF_ICRC_ERR ? "icrc " : "", + rte); } /* From 3bf40d65dcbfd7335680ffbc59e83a3671682472 Mon Sep 17 00:00:00 2001 From: Dean Luick Date: Fri, 6 Nov 2015 20:07:04 -0500 Subject: [PATCH 427/843] staging/rdma/hfi1: use one-shot LCB write Use the one-shot LCB write implemented in the 8051 firmware. This speeds up 8051 LCB writes by 2x. Use old method for older firmwares. Reviewed-by: Dennis Dalessandro Signed-off-by: Dean Luick Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/chip.c | 42 ++++++++++++++++++++++++++++---- drivers/staging/rdma/hfi1/chip.h | 1 + 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index e842aee00535..d858f36042b5 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -4774,13 +4774,25 @@ int read_lcb_csr(struct hfi1_devdata *dd, u32 addr, u64 *data) */ static int write_lcb_via_8051(struct hfi1_devdata *dd, u32 addr, u64 data) { + u32 regno; + int ret; - if (acquire_lcb_access(dd, 0) == 0) { - write_csr(dd, addr, data); - release_lcb_access(dd, 0); - return 0; + if (dd->icode == ICODE_FUNCTIONAL_SIMULATOR || + (dd->dc8051_ver < dc8051_ver(0, 20))) { + if (acquire_lcb_access(dd, 0) == 0) { + write_csr(dd, addr, data); + release_lcb_access(dd, 0); + return 0; + } + return -EBUSY; } - return -EBUSY; + + /* register is an index of LCB registers: (offset - base) / 8 */ + regno = (addr - DC_LCB_CFG_RUN) >> 3; + ret = do_8051_command(dd, HCMD_WRITE_LCB_CSR, regno, &data); + if (ret != HCMD_SUCCESS) + return -EBUSY; + return 0; } /* @@ -4861,6 +4873,26 @@ static int do_8051_command( * waiting for a command. */ + /* + * When writing a LCB CSR, out_data contains the full value to + * to be written, while in_data contains the relative LCB + * address in 7:0. Do the work here, rather than the caller, + * of distrubting the write data to where it needs to go: + * + * Write data + * 39:00 -> in_data[47:8] + * 47:40 -> DC8051_CFG_EXT_DEV_0.RETURN_CODE + * 63:48 -> DC8051_CFG_EXT_DEV_0.RSP_DATA + */ + if (type == HCMD_WRITE_LCB_CSR) { + in_data |= ((*out_data) & 0xffffffffffull) << 8; + reg = ((((*out_data) >> 40) & 0xff) << + DC_DC8051_CFG_EXT_DEV_0_RETURN_CODE_SHIFT) + | ((((*out_data) >> 48) & 0xffff) << + DC_DC8051_CFG_EXT_DEV_0_RSP_DATA_SHIFT); + write_csr(dd, DC_DC8051_CFG_EXT_DEV_0, reg); + } + /* * Do two writes: the first to stabilize the type and req_data, the * second to activate. diff --git a/drivers/staging/rdma/hfi1/chip.h b/drivers/staging/rdma/hfi1/chip.h index ebf9041a1c5e..d74aed8ccc18 100644 --- a/drivers/staging/rdma/hfi1/chip.h +++ b/drivers/staging/rdma/hfi1/chip.h @@ -235,6 +235,7 @@ #define HCMD_MISC 0x05 #define HCMD_READ_LCB_IDLE_MSG 0x06 #define HCMD_READ_LCB_CSR 0x07 +#define HCMD_WRITE_LCB_CSR 0x08 #define HCMD_INTERFACE_TEST 0xff /* DC_DC8051_CFG_HOST_CMD_1.RETURN_CODE - 8051 host command return */ From be1d6cb3e657907731a9aeb3cafd190c94634753 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Thu, 5 Nov 2015 19:35:36 +0530 Subject: [PATCH 428/843] Staging: fwserial: Declare fwtty_port_put as static Declare the function fwtty_port_put as static since it is used only in this particular file. Also remove the corresponding declaration from header file. Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fwserial/fwserial.c | 3 +-- drivers/staging/fwserial/fwserial.h | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c index b3ea4bb54e2c..b676c486cb18 100644 --- a/drivers/staging/fwserial/fwserial.c +++ b/drivers/staging/fwserial/fwserial.c @@ -893,11 +893,10 @@ static void fwserial_destroy(struct kref *kref) kfree(serial); } -void fwtty_port_put(struct fwtty_port *port) +static void fwtty_port_put(struct fwtty_port *port) { kref_put(&port->serial->kref, fwserial_destroy); } -EXPORT_SYMBOL(fwtty_port_put); static void fwtty_port_dtr_rts(struct tty_port *tty_port, int on) { diff --git a/drivers/staging/fwserial/fwserial.h b/drivers/staging/fwserial/fwserial.h index 8d791ae79cd6..e13fe33a6897 100644 --- a/drivers/staging/fwserial/fwserial.h +++ b/drivers/staging/fwserial/fwserial.h @@ -342,8 +342,6 @@ static const char loop_dev_name[] = "fwloop"; extern struct tty_driver *fwtty_driver; struct fwtty_port *fwtty_port_get(unsigned index); -void fwtty_port_put(struct fwtty_port *port); - /* * Returns the max send async payload size in bytes based on the unit device * link speed. Self-limiting asynchronous bandwidth (via reducing the payload) From 4811789503d16510a8a6610fb6c4097e1efa6312 Mon Sep 17 00:00:00 2001 From: Gavin O'Leary Date: Mon, 9 Nov 2015 20:12:00 -0800 Subject: [PATCH 429/843] staging: unisys: visorbus: visorbus_main.c: made checkpatch warning-free Made visorbus_main.c checkpatch warning-free by fixing the comment style issues. Signed-off-by: Gavin O'Leary Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorbus_main.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c index a272b48bab28..eac97d22278a 100644 --- a/drivers/staging/unisys/visorbus/visorbus_main.c +++ b/drivers/staging/unisys/visorbus/visorbus_main.c @@ -1078,7 +1078,8 @@ away: } /* Write the contents of to the struct - * spar_vbus_channel_protocol.chp_info. */ + * spar_vbus_channel_protocol.chp_info. + */ static int write_vbus_chp_info(struct visorchannel *chan, @@ -1096,7 +1097,8 @@ write_vbus_chp_info(struct visorchannel *chan, } /* Write the contents of to the struct - * spar_vbus_channel_protocol.bus_info. */ + * spar_vbus_channel_protocol.bus_info. + */ static int write_vbus_bus_info(struct visorchannel *chan, @@ -1370,7 +1372,8 @@ pause_state_change_complete(struct visor_device *dev, int status) /* Notify the chipset driver that the pause is complete, which * will presumably want to send some sort of response to the - * initiator. */ + * initiator. + */ (*chipset_responders.device_pause) (dev, status); } @@ -1390,7 +1393,8 @@ resume_state_change_complete(struct visor_device *dev, int status) /* Notify the chipset driver that the resume is complete, * which will presumably want to send some sort of response to - * the initiator. */ + * the initiator. + */ (*chipset_responders.device_resume) (dev, status); } @@ -1437,7 +1441,8 @@ initiate_chipset_device_pause_resume(struct visor_device *dev, bool is_pause) * existing problem prevents us from ever getting a bus * resume... This hack would fail to work should we * ever have a bus that contains NO devices, since we - * would never even get here in that case. */ + * would never even get here in that case. + */ fix_vbus_dev_info(dev); if (!drv->resume) goto away; From 559b7d2444790415b8818d3154afba7e74f5925f Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Mon, 16 Nov 2015 20:16:45 +0530 Subject: [PATCH 430/843] staging: unisys: remove unused variable The variables op, sd and zmotion were never being used. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorhba/visorhba_main.c | 4 ---- drivers/staging/unisys/visorinput/visorinput.c | 4 +--- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c index c119f20dfd44..593a48627b09 100644 --- a/drivers/staging/unisys/visorhba/visorhba_main.c +++ b/drivers/staging/unisys/visorhba/visorhba_main.c @@ -453,7 +453,6 @@ visorhba_queue_command_lck(struct scsi_cmnd *scsicmd, struct uiscmdrsp *cmdrsp; struct scsi_device *scsidev = scsicmd->device; int insert_location; - unsigned char op; unsigned char *cdb = scsicmd->cmnd; struct Scsi_Host *scsihost = scsidev->host; unsigned int i; @@ -511,7 +510,6 @@ visorhba_queue_command_lck(struct scsi_cmnd *scsicmd, } cmdrsp->scsi.guest_phys_entries = scsi_sg_count(scsicmd); - op = cdb[0]; if (!visorchannel_signalinsert(devdata->dev->visorchannel, IOCHAN_TO_IOPART, cmdrsp)) { @@ -759,11 +757,9 @@ do_scsi_linuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd) struct visorhba_devdata *devdata; struct visordisk_info *vdisk; struct scsi_device *scsidev; - struct sense_data *sd; scsidev = scsicmd->device; memcpy(scsicmd->sense_buffer, cmdrsp->scsi.sensebuf, MAX_SENSE_SIZE); - sd = (struct sense_data *)scsicmd->sense_buffer; /* Do not log errors for disk-not-present inquiries */ if ((cmdrsp->scsi.cmnd[0] == INQUIRY) && diff --git a/drivers/staging/unisys/visorinput/visorinput.c b/drivers/staging/unisys/visorinput/visorinput.c index 5c16f6634368..38d4d5b884df 100644 --- a/drivers/staging/unisys/visorinput/visorinput.c +++ b/drivers/staging/unisys/visorinput/visorinput.c @@ -523,7 +523,7 @@ visorinput_channel_interrupt(struct visor_device *dev) struct ultra_inputreport r; int scancode, keycode; struct input_dev *visorinput_dev; - int xmotion, ymotion, zmotion, button; + int xmotion, ymotion, button; int i; struct visorinput_devdata *devdata = dev_get_drvdata(&dev->device); @@ -604,12 +604,10 @@ visorinput_channel_interrupt(struct visor_device *dev) } break; case inputaction_wheel_rotate_away: - zmotion = r.activity.arg1; input_report_rel(visorinput_dev, REL_WHEEL, 1); input_sync(visorinput_dev); break; case inputaction_wheel_rotate_toward: - zmotion = r.activity.arg1; input_report_rel(visorinput_dev, REL_WHEEL, -1); input_sync(visorinput_dev); break; From 34d96c0dedbfbba50349dcc76546a86ad59a0789 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Mon, 16 Nov 2015 20:16:46 +0530 Subject: [PATCH 431/843] staging: unisys: return error value directly In case of error we are jumping to err_del_scsipending_ent and always returning SCSI_MLQUEUE_DEVICE_BUSY from error path. We donot need a variable to return a fixed error value, it can be returned directly. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorhba/visorhba_main.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c index 593a48627b09..d5178b44ba8c 100644 --- a/drivers/staging/unisys/visorhba/visorhba_main.c +++ b/drivers/staging/unisys/visorhba/visorhba_main.c @@ -460,7 +460,6 @@ visorhba_queue_command_lck(struct scsi_cmnd *scsicmd, (struct visorhba_devdata *)scsihost->hostdata; struct scatterlist *sg = NULL; struct scatterlist *sglist = NULL; - int err = 0; if (devdata->serverdown || devdata->serverchangingstate) return SCSI_MLQUEUE_DEVICE_BUSY; @@ -495,10 +494,8 @@ visorhba_queue_command_lck(struct scsi_cmnd *scsicmd, if (cmdrsp->scsi.bufflen > devdata->max_buff_len) devdata->max_buff_len = cmdrsp->scsi.bufflen; - if (scsi_sg_count(scsicmd) > MAX_PHYS_INFO) { - err = SCSI_MLQUEUE_DEVICE_BUSY; + if (scsi_sg_count(scsicmd) > MAX_PHYS_INFO) goto err_del_scsipending_ent; - } /* convert buffer to phys information */ /* buffer is scatterlist - copy it out */ @@ -512,16 +509,15 @@ visorhba_queue_command_lck(struct scsi_cmnd *scsicmd, if (!visorchannel_signalinsert(devdata->dev->visorchannel, IOCHAN_TO_IOPART, - cmdrsp)) { + cmdrsp)) /* queue must be full and we aren't going to wait */ - err = SCSI_MLQUEUE_DEVICE_BUSY; goto err_del_scsipending_ent; - } + return 0; err_del_scsipending_ent: del_scsipending_ent(devdata, insert_location); - return err; + return SCSI_MLQUEUE_DEVICE_BUSY; } /** From 79c07e9c1f3948757c30fa630c66903da2a247ec Mon Sep 17 00:00:00 2001 From: Erik Arfvidson Date: Tue, 17 Nov 2015 13:34:48 -0500 Subject: [PATCH 432/843] staging: unisys: iochannel fix block comments This patch fixes warning messages from checkpatch.pl specifically: WARNING: Block comments use a trailing */ on a separate lines Signed-off-by: Erik Arfvidson Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/include/iochannel.h | 137 +++++++++------------ 1 file changed, 59 insertions(+), 78 deletions(-) diff --git a/drivers/staging/unisys/include/iochannel.h b/drivers/staging/unisys/include/iochannel.h index 14e656ff73ec..457fe3d46478 100644 --- a/drivers/staging/unisys/include/iochannel.h +++ b/drivers/staging/unisys/include/iochannel.h @@ -6,7 +6,8 @@ /* * Everything needed for IOPart-GuestPart communication is define in * this file. Note: Everything is OS-independent because this file is - * used by Windows, Linux and possible EFI drivers. */ + * used by Windows, Linux and possible EFI drivers. + */ /* * Communication flow between the IOPart and GuestPart uses the channel headers @@ -66,21 +67,15 @@ * IO Partition is defined below. */ -/* - * Defines and enums. - */ - +/* Defines and enums. */ #define MINNUM(a, b) (((a) < (b)) ? (a) : (b)) #define MAXNUM(a, b) (((a) > (b)) ? (a) : (b)) -/* these define the two queues per data channel between iopart and - * ioguestparts - */ -#define IOCHAN_TO_IOPART 0 /* used by ioguestpart to 'insert' signals to - * iopart */ - -#define IOCHAN_FROM_IOPART 1 /* used by ioguestpart to 'remove' signals from - * iopart - same queue as previous queue */ +/* define the two queues per data channel between iopart and ioguestparts */ +/* used by ioguestpart to 'insert' signals to iopart */ +#define IOCHAN_TO_IOPART 0 +/* used by ioguestpart to 'remove' signals from iopart, same previous queue */ +#define IOCHAN_FROM_IOPART 1 /* size of cdb - i.e., scsi cmnd */ #define MAX_CMND_SIZE 16 @@ -92,26 +87,29 @@ /* various types of network packets that can be sent in cmdrsp */ enum net_types { NET_RCV_POST = 0, /* submit buffer to hold receiving - * incoming packet */ + * incoming packet + */ /* virtnic -> uisnic */ NET_RCV, /* incoming packet received */ /* uisnic -> virtpci */ - NET_XMIT, /* for outgoing net packets */ + NET_XMIT, /* for outgoing net packets */ /* virtnic -> uisnic */ NET_XMIT_DONE, /* outgoing packet xmitted */ /* uisnic -> virtpci */ NET_RCV_ENBDIS, /* enable/disable packet reception */ /* virtnic -> uisnic */ - NET_RCV_ENBDIS_ACK, /* acknowledge enable/disable packet - * reception */ + NET_RCV_ENBDIS_ACK, /* acknowledge enable/disable packet */ + /* reception */ /* uisnic -> virtnic */ NET_RCV_PROMISC, /* enable/disable promiscuous mode */ /* virtnic -> uisnic */ NET_CONNECT_STATUS, /* indicate the loss or restoration of a network - * connection */ + * connection + */ /* uisnic -> virtnic */ NET_MACADDR, /* indicates the client has requested to update - * its MAC addr */ + * its MAC addr + */ NET_MACADDR_ACK, /* MAC address */ }; @@ -170,51 +168,43 @@ struct vhba_wwnn { } __packed; /* WARNING: Values stired in this structure must contain maximum counts (not - * maximum values). */ -struct vhba_config_max { /* 20 bytes */ - u32 max_channel; /* maximum channel for devices attached to this - * bus */ - u32 max_id; /* maximum SCSI ID for devices attached to this - * bus */ - u32 max_lun; /* maximum SCSI LUN for devices attached to this - * bus */ - u32 cmd_per_lun; /* maximum number of outstanding commands per - * lun that are allowed at one time */ - u32 max_io_size; /* maximum io size for devices attached to this - * bus */ + * maximum values). + */ +struct vhba_config_max {/* 20 bytes */ + u32 max_channel;/* maximum channel for devices attached to this bus */ + u32 max_id; /* maximum SCSI ID for devices attached to bus */ + u32 max_lun; /* maximum SCSI LUN for devices attached to bus */ + u32 cmd_per_lun;/* maximum number of outstanding commands per LUN */ + u32 max_io_size;/* maximum io size for devices attached to this bus */ /* max io size is often determined by the resource of the hba. e.g */ /* max scatter gather list length * page size / sector size */ } __packed; struct uiscmdrsp_scsi { - u64 handle; /* the handle to the cmd that was received - - * send it back as is in the rsp packet. */ + u64 handle; /* the handle to the cmd that was received */ + /* send it back as is in the rsp packet. */ u8 cmnd[MAX_CMND_SIZE]; /* the cdb for the command */ u32 bufflen; /* length of data to be transferred out or in */ - u16 guest_phys_entries; /* Number of entries in scatter-gather (sg) - * list */ + u16 guest_phys_entries; /* Number of entries in scatter-gather list */ struct guest_phys_info gpi_list[MAX_PHYS_INFO]; /* physical address * information for each - * fragment */ + * fragment + */ enum dma_data_direction data_dir; /* direction of the data, if any */ - struct uisscsi_dest vdest; /* identifies the virtual hba, id, - * channel, lun to which cmd was sent */ + struct uisscsi_dest vdest; /* identifies the virtual hba, id, */ + /* channel, lun to which cmd was sent */ - /* the following fields are needed to queue the rsp back to cmd - * originator */ - int linuxstat; /* the original Linux status - for use by linux - * vdisk code */ + /* Needed to queue the rsp back to cmd originator */ + int linuxstat; /* original Linux status used by linux vdisk */ u8 scsistat; /* the scsi status */ - u8 addlstat; /* non-scsi status - covers cases like timeout - * needed by windows guests */ + u8 addlstat; /* non-scsi status */ #define ADDL_SEL_TIMEOUT 4 /* the following fields are need to determine the result of command */ u8 sensebuf[MAX_SENSE_SIZE]; /* sense info in case cmd failed; */ /* it holds the sense_data struct; */ /* see that struct for details. */ - void *vdisk; /* contains pointer to the vdisk so that we can clean up - * when the IO completes. */ + void *vdisk; /* pointer to the vdisk to clean up when IO completes. */ int no_disk_result; /* used to return no disk inquiry result * when no_disk_result is set to 1, @@ -258,15 +248,15 @@ struct uiscmdrsp_scsi { */ #define NO_DISK_INQUIRY_RESULT_LEN 36 -#define MIN_INQUIRY_RESULT_LEN 5 /* we need at least 5 bytes minimum for inquiry - * result */ +#define MIN_INQUIRY_RESULT_LEN 5 /* 5 bytes minimum for inquiry result */ /* SCSI device version for no disk inquiry result */ #define SCSI_SPC2_VER 4 /* indicates SCSI SPC2 (SPC3 is 5) */ /* Windows and Linux want different things for a non-existent lun. So, we'll let * caller pass in the peripheral qualifier and type. - * NOTE:[4] SCSI returns (n-4); so we return length-1-4 or length-5. */ + * NOTE:[4] SCSI returns (n-4); so we return length-1-4 or length-5. + */ #define SET_NO_DISK_INQUIRY_RESULT(buf, len, lun, lun0notpresent, notpresent) \ do { \ @@ -305,9 +295,7 @@ struct uiscmdrsp_scsi { } \ } while (0) -/* - * Struct & Defines to support sense information. - */ +/* Struct & Defines to support sense information. */ /* The following struct is returned in sensebuf field in uiscmdrsp_scsi. It is * initialized in exactly the manner that is recommended in Windows (hence the @@ -342,13 +330,11 @@ struct sense_data { struct net_pkt_xmt { int len; /* full length of data in the packet */ int num_frags; /* number of fragments in frags containing data */ - struct phys_info frags[MAX_PHYS_INFO]; /* physical page information for - * each fragment */ + struct phys_info frags[MAX_PHYS_INFO]; /* physical page information */ char ethhdr[ETH_HEADER_SIZE]; /* the ethernet header */ struct { - /* these are needed for csum at uisnic end */ - u8 valid; /* 1 = rest of this struct is valid - else - * ignore */ + /* these are needed for csum at uisnic end */ + u8 valid; /* 1 = struct is valid - else ignore */ u8 hrawoffv; /* 1 = hwrafoff is valid */ u8 nhrawoffv; /* 1 = nhwrafoff is valid */ u16 protocol; /* specifies packet protocol */ @@ -385,11 +371,12 @@ struct net_pkt_xmtdone { struct net_pkt_rcvpost { /* rcv buf size must be large enough to include ethernet data len + * ethernet header len - we are choosing 2K because it is guaranteed - * to be describable */ - struct phys_info frag; /* physical page information for the - * single fragment 2K rcv buf */ - u64 unique_num; /* This is used to make sure that - * receive posts are returned to */ + * to be describable + */ + struct phys_info frag; /* physical page information for the */ + /* single fragment 2K rcv buf */ + u64 unique_num; + /* unique_num ensure that receive posts are returned to */ /* the Adapter which we sent them originally. */ } __packed; @@ -399,8 +386,7 @@ struct net_pkt_rcv { u32 rcv_done_len; /* length of received data */ u8 numrcvbufs; /* number of receive buffers that contain the */ /* incoming data; guest end MUST chain these together. */ - void *rcvbuf[MAX_NET_RCV_CHAIN]; /* the list of receive buffers - * that must be chained; */ + void *rcvbuf[MAX_NET_RCV_CHAIN]; /* list of chained rcvbufs */ /* each entry is a receive buffer provided by NET_RCV_POST. */ /* NOTE: first rcvbuf in the chain will also be provided in net.buf. */ u64 unique_num; @@ -469,18 +455,17 @@ struct uiscmdrsp_scsitaskmgmt { #define TASK_MGMT_FAILED 0 } __packed; -/* The following is used by uissd to send disk add/remove notifications to - * Guest */ +/* Used by uissd to send disk add/remove notifications to Guest */ /* Note that the vHba pointer is not used by the Client/Guest side. */ struct uiscmdrsp_disknotify { u8 add; /* 0-remove, 1-add */ - void *v_hba; /* Pointer to vhba_info for channel info to - * route msg */ + void *v_hba; /* channel info to route msg */ u32 channel, id, lun; /* SCSI Path of Disk to added or removed */ } __packed; /* The following is used by virthba/vSCSI to send the Acquire/Release commands - * to the IOVM. */ + * to the IOVM. + */ struct uiscmdrsp_vdiskmgmt { enum vdisk_mgmt_types vdisktype; @@ -533,8 +518,8 @@ struct uiscmdrsp { struct uiscmdrsp_disknotify disknotify; struct uiscmdrsp_vdiskmgmt vdiskmgmt; }; - void *private_data; /* used to send the response when the cmd is - * done (scsi & scsittaskmgmt). */ + void *private_data; /* send the response when the cmd is */ + /* done (scsi & scsittaskmgmt). */ struct uiscmdrsp *next; /* General Purpose Queue Link */ struct uiscmdrsp *activeQ_next; /* Used to track active commands */ struct uiscmdrsp *activeQ_prev; /* Used to track active commands */ @@ -564,15 +549,11 @@ struct spar_io_channel_protocol { } __packed; #define MAX_CLIENTSTRING_LEN 1024 - u8 client_string[MAX_CLIENTSTRING_LEN];/* NULL terminated - so holds - * max - 1 bytes */ + /* client_string is NULL termimated so holds max -1 bytes */ + u8 client_string[MAX_CLIENTSTRING_LEN]; } __packed; - -/* - * INLINE functions for initializing and accessing I/O data channels - */ - +/* INLINE functions for initializing and accessing I/O data channels */ #define SIZEOF_PROTOCOL (COVER(sizeof(struct spar_io_channel_protocol), 64)) #define SIZEOF_CMDRSP (COVER(sizeof(struct uiscmdrsp), 64)) From 71c3c5a8ef37ab21397516caca778238874dc3dd Mon Sep 17 00:00:00 2001 From: Erik Arfvidson Date: Tue, 17 Nov 2015 13:34:49 -0500 Subject: [PATCH 433/843] staging: unisys: iochannel.h remove redundant comments iochannel cleanup redudant comments in function declarations. Signed-off-by: Erik Arfvidson Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/include/iochannel.h | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/staging/unisys/include/iochannel.h b/drivers/staging/unisys/include/iochannel.h index 457fe3d46478..ec04576fe20c 100644 --- a/drivers/staging/unisys/include/iochannel.h +++ b/drivers/staging/unisys/include/iochannel.h @@ -575,18 +575,8 @@ struct spar_io_channel_protocol { * room) */ static inline u16 -add_physinfo_entries(u32 inp_pfn, /* input - specifies the pfn to be used - * to add entries */ - u16 inp_off, /* input - specifies the off to be used - * to add entries */ - u32 inp_len, /* input - specifies the len to be used - * to add entries */ - u16 index, /* input - index in array at which new - * entries are added */ - u16 max_pi_arr_entries, /* input - specifies the maximum - * entries pi_arr can hold */ - struct phys_info pi_arr[]) /* input & output - array to - * which entries are added */ +add_physinfo_entries(u32 inp_pfn, u16 inp_off, u32 inp_len, u16 index, + u16 max_pi_arr_entries, struct phys_info pi_arr[]) { u32 len; u16 i, firstlen; From c06a278344ad5024e44d962ce9aa2ed945f0d1cf Mon Sep 17 00:00:00 2001 From: Erik Arfvidson Date: Tue, 17 Nov 2015 13:34:50 -0500 Subject: [PATCH 434/843] staging: unisys: iochannel fix spacing around operators This patch fixes check warning from checkpatch.pl in the macro definition CHECK: spaces preferred around that '+' (ctx:VxV) Signed-off-by: Erik Arfvidson Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/include/iochannel.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/unisys/include/iochannel.h b/drivers/staging/unisys/include/iochannel.h index ec04576fe20c..36664ccc08df 100644 --- a/drivers/staging/unisys/include/iochannel.h +++ b/drivers/staging/unisys/include/iochannel.h @@ -366,7 +366,8 @@ struct net_pkt_xmtdone { */ #define RCVPOST_BUF_SIZE 4032 #define MAX_NET_RCV_CHAIN \ - ((ETH_MAX_MTU+ETH_HEADER_SIZE + RCVPOST_BUF_SIZE-1) / RCVPOST_BUF_SIZE) + ((ETH_MAX_MTU + ETH_HEADER_SIZE + RCVPOST_BUF_SIZE - 1) \ + / RCVPOST_BUF_SIZE) struct net_pkt_rcvpost { /* rcv buf size must be large enough to include ethernet data len + From 0678eb1e4e0de2eaf40a28243bb9f227ae4ff49e Mon Sep 17 00:00:00 2001 From: Erik Arfvidson Date: Tue, 17 Nov 2015 13:34:51 -0500 Subject: [PATCH 435/843] staging: unisys: iochannel fix trailing */ Fixed last warning message from checkpatch.pl by removing the wordiness of the comment Signed-off-by: Erik Arfvidson Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/include/iochannel.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/unisys/include/iochannel.h b/drivers/staging/unisys/include/iochannel.h index 36664ccc08df..162ca187a66b 100644 --- a/drivers/staging/unisys/include/iochannel.h +++ b/drivers/staging/unisys/include/iochannel.h @@ -566,8 +566,7 @@ struct spar_io_channel_protocol { * pfn-off-size entires. */ -/* we deal with 4K page sizes when we it comes to passing page information - * between */ +/* use 4K page sizes when we it comes to passing page information between */ /* Guest and IOPartition. */ #define PI_PAGE_SIZE 0x1000 #define PI_PAGE_MASK 0x0FFF From b0bc5da143f654d39a4899c766757a22606428c0 Mon Sep 17 00:00:00 2001 From: Erik Arfvidson Date: Tue, 17 Nov 2015 13:34:52 -0500 Subject: [PATCH 436/843] staging: unisys: visorbus.h fix block comment This fixes last checkpatch warning: WARNING: Block comments use a trailing */ on a separate line Signed-off-by: Erik Arfvidson Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/include/visorbus.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h index 9235536fa75f..2a64a9ce0208 100644 --- a/drivers/staging/unisys/include/visorbus.h +++ b/drivers/staging/unisys/include/visorbus.h @@ -140,8 +140,8 @@ struct visor_device { struct { int major, minor; void *attr; /* private use by devmajorminor_attr.c you can - * change this constant to whatever you - * want; */ + * change this constant to whatever you want + */ } devnodes[5]; /* the code will detect and behave appropriately) */ struct semaphore visordriver_callback_lock; From 25236bc98f955007c8174a69522c5e26e2d4f804 Mon Sep 17 00:00:00 2001 From: Erik Arfvidson Date: Tue, 17 Nov 2015 13:34:53 -0500 Subject: [PATCH 437/843] staging: unisys: vbushelper.h fix Block comment This patch fixes last checkpatch warning for vbushelper.h WARNING: Block comments use a trailing */ on a separate line Signed-off-by: Erik Arfvidson Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/include/vbushelper.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/unisys/include/vbushelper.h b/drivers/staging/unisys/include/vbushelper.h index f272975b2920..f1b6aacb79d7 100644 --- a/drivers/staging/unisys/include/vbushelper.h +++ b/drivers/staging/unisys/include/vbushelper.h @@ -19,7 +19,8 @@ #define __VBUSHELPER_H__ /* TARGET_HOSTNAME specified as -DTARGET_HOSTNAME=\"thename\" on the - * command line */ + * command line + */ #define TARGET_HOSTNAME "linuxguest" From 6504e649289f24257c782aadfc419926a06b9584 Mon Sep 17 00:00:00 2001 From: Erik Arfvidson Date: Tue, 17 Nov 2015 13:34:55 -0500 Subject: [PATCH 438/843] staging: unisys: Fix visorchannel.c block comments This patch fixes the last checkpatch warning about: Block comments use a trailing */ on a separate line Signed-off-by: Erik Arfvidson Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/visorchannel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c index a4e117f101cf..891b8db7c5ec 100644 --- a/drivers/staging/unisys/visorbus/visorchannel.c +++ b/drivers/staging/unisys/visorbus/visorchannel.c @@ -41,8 +41,8 @@ struct visorchannel { struct channel_header chan_hdr; uuid_le guid; ulong size; - bool needs_lock; /* channel creator knows if more than one - * thread will be inserting or removing */ + bool needs_lock; /* channel creator knows if more than one */ + /* thread will be inserting or removing */ spinlock_t insert_lock; /* protect head writes in chan_hdr */ spinlock_t remove_lock; /* protect tail writes in chan_hdr */ From 195b57875f1563fef51be7d204ddb1dbc9e1538e Mon Sep 17 00:00:00 2001 From: Erik Arfvidson Date: Tue, 17 Nov 2015 13:34:56 -0500 Subject: [PATCH 439/843] staging: unisys: Fix vmcallerinterface.h block comments This patch fixes all the checkpatch Block comments use a trailing */ while keeping comments clean. Signed-off-by: Erik Arfvidson Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visorbus/vmcallinterface.h | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/drivers/staging/unisys/visorbus/vmcallinterface.h b/drivers/staging/unisys/visorbus/vmcallinterface.h index c8d8483bd4df..c043fa41ceda 100644 --- a/drivers/staging/unisys/visorbus/vmcallinterface.h +++ b/drivers/staging/unisys/visorbus/vmcallinterface.h @@ -43,20 +43,15 @@ enum vmcall_monitor_interface_method_tuple { /* VMCALL identification tuples */ * - the 0x01 identifies it as the 1st instance of a VMCALL_VIRTPART * type of VMCALL */ - - VMCALL_IO_CONTROLVM_ADDR = 0x0501, /* used by all Guests, not just - * IO */ - VMCALL_QUERY_GUEST_VIRTUAL_TIME_OFFSET = 0x0708, /* Allow caller to - * query virtual time - * offset */ - VMCALL_POST_CODE_LOGEVENT = 0x070B, /* LOGEVENT Post Code (RDX) with - * specified subsystem mask (RCX - * - monitor_subsystems.h) and - * severity (RDX) */ - VMCALL_UPDATE_PHYSICAL_TIME = 0x0a02 /* Allow - * ULTRA_SERVICE_CAPABILITY_TIME - * capable guest to make - * VMCALL */ + /* used by all Guests, not just IO */ + VMCALL_IO_CONTROLVM_ADDR = 0x0501, + /* Allow caller to query virtual time offset */ + VMCALL_QUERY_GUEST_VIRTUAL_TIME_OFFSET = 0x0708, + /* LOGEVENT Post Code (RDX) with specified subsystem mask */ + /* (RCX - monitor_subsystems.h) and severity (RDX) */ + VMCALL_POST_CODE_LOGEVENT = 0x070B, + /* Allow ULTRA_SERVICE_CAPABILITY_TIME capable guest to make VMCALL */ + VMCALL_UPDATE_PHYSICAL_TIME = 0x0a02 }; #define VMCALL_SUCCESS 0 @@ -74,7 +69,8 @@ enum vmcall_monitor_interface_method_tuple { /* VMCALL identification tuples */ unisys_extended_vmcall(method, param1, param2, param3) /* The following uses VMCALL_POST_CODE_LOGEVENT interface but is currently - * not used much */ + * not used much + */ #define ISSUE_IO_VMCALL_POSTCODE_SEVERITY(postcode, severity) \ ISSUE_IO_EXTENDED_VMCALL(VMCALL_POST_CODE_LOGEVENT, severity, \ MDS_APPOS, postcode) @@ -84,11 +80,11 @@ enum vmcall_monitor_interface_method_tuple { /* VMCALL identification tuples */ /* Parameters to VMCALL_IO_CONTROLVM_ADDR interface */ struct vmcall_io_controlvm_addr_params { - /* The Guest-relative physical address of the ControlVm channel. - * This VMCall fills this in with the appropriate address. */ + /* The Guest-relative physical address of the ControlVm channel. */ + /* This VMCall fills this in with the appropriate address. */ u64 address; /* contents provided by this VMCALL (OUT) */ - /* the size of the ControlVm channel in bytes This VMCall fills this - * in with the appropriate address. */ + /* the size of the ControlVm channel in bytes This VMCall fills this */ + /* in with the appropriate address. */ u32 channel_bytes; /* contents provided by this VMCALL (OUT) */ u8 unused[4]; /* Unused Bytes in the 64-Bit Aligned Struct */ } __packed; From 180e2767eb3f4d608ea5a954c8052956431593cf Mon Sep 17 00:00:00 2001 From: Erik Arfvidson Date: Tue, 17 Nov 2015 13:34:57 -0500 Subject: [PATCH 440/843] staging: unisys: Fix channel.h Block comments This patch fixes all the checkpatch.pl block commments that use a trailing */ in channel.h Signed-off-by: Erik Arfvidson Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/include/channel.h | 114 +++++++++++++---------- 1 file changed, 67 insertions(+), 47 deletions(-) diff --git a/drivers/staging/unisys/include/channel.h b/drivers/staging/unisys/include/channel.h index c6c24423a7f0..5af59a5fce61 100644 --- a/drivers/staging/unisys/include/channel.h +++ b/drivers/staging/unisys/include/channel.h @@ -60,15 +60,19 @@ enum channel_clientstate { CHANNELCLI_DISABLED = 1, /* client can see channel but is NOT * allowed to use it unless given TBD * explicit request (should actually be - * < DETACHED) */ + * < DETACHED) + */ CHANNELCLI_ATTACHING = 2, /* legacy EFI client request - * for EFI server to attach */ + * for EFI server to attach + */ CHANNELCLI_ATTACHED = 3, /* idle, but client may want - * to use channel any time */ + * to use channel any time + */ CHANNELCLI_BUSY = 4, /* client either wants to use or is - * using channel */ - CHANNELCLI_OWNED = 5 /* "no worries" state - client can - * access channel anytime */ + * using channel + */ + CHANNELCLI_OWNED = 5 /* "no worries" state - client can */ + /* access channel anytime */ }; static inline const u8 * @@ -116,11 +120,13 @@ ULTRA_CHANNELCLI_STRING(u32 v) /* Values for ULTRA_CHANNEL_PROTOCOL.CliErrorBoot: */ /* throttling invalid boot channel statetransition error due to client - * disabled */ + * disabled + */ #define ULTRA_CLIERRORBOOT_THROTTLEMSG_DISABLED 0x01 /* throttling invalid boot channel statetransition error due to client - * not attached */ + * not attached + */ #define ULTRA_CLIERRORBOOT_THROTTLEMSG_NOTATTACHED 0x02 /* throttling invalid boot channel statetransition error due to busy channel */ @@ -128,24 +134,28 @@ ULTRA_CHANNELCLI_STRING(u32 v) /* Values for ULTRA_CHANNEL_PROTOCOL.CliErrorOS: */ /* throttling invalid guest OS channel statetransition error due to - * client disabled */ + * client disabled + */ #define ULTRA_CLIERROROS_THROTTLEMSG_DISABLED 0x01 /* throttling invalid guest OS channel statetransition error due to - * client not attached */ + * client not attached + */ #define ULTRA_CLIERROROS_THROTTLEMSG_NOTATTACHED 0x02 /* throttling invalid guest OS channel statetransition error due to - * busy channel */ + * busy channel + */ #define ULTRA_CLIERROROS_THROTTLEMSG_BUSY 0x04 /* Values for ULTRA_CHANNEL_PROTOCOL.Features: This define exists so -* that windows guest can look at the FeatureFlags in the io channel, -* and configure the windows driver to use interrupts or not based on -* this setting. This flag is set in uislib after the -* ULTRA_VHBA_init_channel is called. All feature bits for all -* channels should be defined here. The io channel feature bits are -* defined right here */ + * that windows guest can look at the FeatureFlags in the io channel, + * and configure the windows driver to use interrupts or not based on + * this setting. This flag is set in uislib after the + * ULTRA_VHBA_init_channel is called. All feature bits for all + * channels should be defined here. The io channel feature bits are + * defined right here + */ #define ULTRA_IO_DRIVER_ENABLES_INTS (0x1ULL << 1) #define ULTRA_IO_CHANNEL_IS_POLLING (0x1ULL << 3) #define ULTRA_IO_IOVM_IS_OK_WITH_DRIVER_DISABLING_INTS (0x1ULL << 4) @@ -156,7 +166,7 @@ ULTRA_CHANNELCLI_STRING(u32 v) struct channel_header { u64 signature; /* Signature */ u32 legacy_state; /* DEPRECATED - being replaced by */ - /* / SrvState, CliStateBoot, and CliStateOS below */ + /* SrvState, CliStateBoot, and CliStateOS below */ u32 header_size; /* sizeof(struct channel_header) */ u64 size; /* Total size of this channel in bytes */ u64 features; /* Flags to modify behavior */ @@ -169,25 +179,32 @@ struct channel_header { uuid_le zone_uuid; /* Guid of Channel's zone */ u32 cli_str_offset; /* offset from channel header to * nul-terminated ClientString (0 if - * ClientString not present) */ + * ClientString not present) + */ u32 cli_state_boot; /* CHANNEL_CLIENTSTATE of pre-boot - * EFI client of this channel */ + * EFI client of this channel + */ u32 cmd_state_cli; /* CHANNEL_COMMANDSTATE (overloaded in * Windows drivers, see ServerStateUp, - * ServerStateDown, etc) */ + * ServerStateDown, etc) + */ u32 cli_state_os; /* CHANNEL_CLIENTSTATE of Guest OS - * client of this channel */ + * client of this channel + */ u32 ch_characteristic; /* CHANNEL_CHARACTERISTIC_ */ u32 cmd_state_srv; /* CHANNEL_COMMANDSTATE (overloaded in * Windows drivers, see ServerStateUp, - * ServerStateDown, etc) */ + * ServerStateDown, etc) + */ u32 srv_state; /* CHANNEL_SERVERSTATE */ u8 cli_error_boot; /* bits to indicate err states for * boot clients, so err messages can - * be throttled */ + * be throttled + */ u8 cli_error_os; /* bits to indicate err states for OS * clients, so err messages can be - * throttled */ + * throttled + */ u8 filler[1]; /* Pad out to 128 byte cacheline */ /* Please add all new single-byte values below here */ u8 recover_channel; @@ -205,29 +222,33 @@ struct signal_queue_header { u64 features; /* Flags to modify behavior */ u64 num_sent; /* Total # of signals placed in this queue */ u64 num_overflows; /* Total # of inserts failed due to - * full queue */ + * full queue + */ u32 signal_size; /* Total size of a signal for this queue */ u32 max_slots; /* Max # of slots in queue, 1 slot is - * always empty */ + * always empty + */ u32 max_signals; /* Max # of signals in queue - * (MaxSignalSlots-1) */ + * (MaxSignalSlots-1) + */ u32 head; /* Queue head signal # */ /* 2nd cache line */ u64 num_received; /* Total # of signals removed from this queue */ - u32 tail; /* Queue tail signal # (on separate - * cache line) */ + u32 tail; /* Queue tail signal */ u32 reserved1; /* Reserved field */ u64 reserved2; /* Reserved field */ u64 client_queue; u64 num_irq_received; /* Total # of Interrupts received. This - * is incremented by the ISR in the - * guest windows driver */ + * is incremented by the ISR in the + * guest windows driver + */ u64 num_empty; /* Number of times that visor_signal_remove - * is called and returned Empty - * Status. */ + * is called and returned Empty Status. + */ u32 errorflags; /* Error bits set during SignalReinit * to denote trouble with client's - * fields */ + * fields + */ u8 filler[12]; /* Pad out to 64 byte cacheline */ } __packed; @@ -272,8 +293,7 @@ spar_check_channel_client(void __iomem *ch, return 0; } } - if (expected_min_bytes > 0) { /* caller wants us to verify - * channel size */ + if (expected_min_bytes > 0) { /* verify channel size */ unsigned long long bytes = readq(&((struct channel_header __iomem *) (ch))->size); @@ -284,8 +304,7 @@ spar_check_channel_client(void __iomem *ch, return 0; } } - if (expected_version > 0) { /* caller wants us to verify - * channel version */ + if (expected_version > 0) { /* verify channel version */ unsigned long ver = readl(&((struct channel_header __iomem *) (ch))->version_id); if (ver != expected_version) { @@ -295,8 +314,7 @@ spar_check_channel_client(void __iomem *ch, return 0; } } - if (expected_signature > 0) { /* caller wants us to verify - * channel signature */ + if (expected_signature > 0) { /* verify channel signature */ unsigned long long sig = readq(&((struct channel_header __iomem *) (ch))->signature); @@ -319,8 +337,7 @@ static inline int spar_check_channel_server(uuid_le typeuuid, char *name, u64 expected_min_bytes, u64 actual_bytes) { - if (expected_min_bytes > 0) /* caller wants us to verify - * channel size */ + if (expected_min_bytes > 0) /* verify channel size */ if (actual_bytes < expected_min_bytes) { pr_err("Channel mismatch on channel=%s(%pUL) field=size expected=0x%-8.8llx actual=0x%-8.8llx\n", name, &typeuuid, expected_min_bytes, @@ -354,7 +371,8 @@ pathname_last_n_nodes(u8 *s, unsigned int n) if (p == s) break; /* should never happen, unless someone * is changing the string while we are - * looking at it!! */ + * looking at it!! + */ if ((*p == '/') || (*p == '\\')) n--; } @@ -395,7 +413,8 @@ spar_channel_client_acquire_os(void __iomem *ch, u8 *id) if (readl(&hdr->cli_state_os) == CHANNELCLI_OWNED) { if (readb(&hdr->cli_error_os) != 0) { /* we are in an error msg throttling state; - * come out of it */ + * come out of it + */ pr_info("%s Channel OS client acquire now successful\n", id); writeb(0, &hdr->cli_error_os); @@ -404,8 +423,9 @@ spar_channel_client_acquire_os(void __iomem *ch, u8 *id) } /* We have to do it the "hard way". We transition to BUSY, - * and can use the channel iff our competitor has not also - * transitioned to BUSY. */ + * and can use the channel iff our competitor has not also + * transitioned to BUSY. + */ if (readl(&hdr->cli_state_os) != CHANNELCLI_ATTACHED) { if ((readb(&hdr->cli_error_os) & ULTRA_CLIERROROS_THROTTLEMSG_NOTATTACHED) == 0) { From 3d05734fff784835ce8b83b029b6affbabc6faa4 Mon Sep 17 00:00:00 2001 From: Erik Arfvidson Date: Tue, 17 Nov 2015 13:34:58 -0500 Subject: [PATCH 441/843] staging: unisys: Fix periodic_work.c parenthesis alignment This patch fixes checkpatch.pl message: CHECK: Alignment should match open parenthesis Signed-off-by: Erik Arfvidson Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/periodic_work.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/staging/unisys/visorbus/periodic_work.c b/drivers/staging/unisys/visorbus/periodic_work.c index 115b7aa9560a..00b152764f84 100644 --- a/drivers/staging/unisys/visorbus/periodic_work.c +++ b/drivers/staging/unisys/visorbus/periodic_work.c @@ -43,11 +43,12 @@ static void periodic_work_func(struct work_struct *work) (*pw->workfunc)(pw->workfuncarg); } -struct periodic_work *visor_periodic_work_create(ulong jiffy_interval, - struct workqueue_struct *workqueue, - void (*workfunc)(void *), - void *workfuncarg, - const char *devnam) +struct periodic_work +*visor_periodic_work_create(ulong jiffy_interval, + struct workqueue_struct *workqueue, + void (*workfunc)(void *), + void *workfuncarg, + const char *devnam) { struct periodic_work *pw; From 1c192718fbafbfd8fcc9af924861a311820d5078 Mon Sep 17 00:00:00 2001 From: Erik Arfvidson Date: Tue, 17 Nov 2015 13:34:59 -0500 Subject: [PATCH 442/843] staging: unisys: controlvmcompletionstatus.h fix block comments This patch fixes the checkpatch warning messages in controlvmcompletionstatus.h. All the warning messages in this file are caused by "Block comments use atrailing */ on a separate line" Signed-off-by: Erik Arfvidson Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- .../visorbus/controlvmcompletionstatus.h | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/staging/unisys/visorbus/controlvmcompletionstatus.h b/drivers/staging/unisys/visorbus/controlvmcompletionstatus.h index 3c97ebac4f32..23ad0ea6c9fc 100644 --- a/drivers/staging/unisys/visorbus/controlvmcompletionstatus.h +++ b/drivers/staging/unisys/visorbus/controlvmcompletionstatus.h @@ -39,7 +39,8 @@ #define CONTROLVM_RESP_ERROR_MAX_DEVICES 202 /* DEVICE_CREATE */ /* Payload and Parameter Related------------------------------------[400-499] */ #define CONTROLVM_RESP_ERROR_PAYLOAD_INVALID 400 /* SWITCH_ATTACHEXTPORT, - * DEVICE_CONFIGURE */ + * DEVICE_CONFIGURE + */ #define CONTROLVM_RESP_ERROR_INITIATOR_PARAMETER_INVALID 401 /* Multiple */ #define CONTROLVM_RESP_ERROR_TARGET_PARAMETER_INVALID 402 /* DEVICE_CONFIGURE */ #define CONTROLVM_RESP_ERROR_CLIENT_PARAMETER_INVALID 403 /* DEVICE_CONFIGURE */ @@ -48,36 +49,43 @@ * BUS_CONFIGURE, * DEVICE_CREATE, * DEVICE_CONFIG - * DEVICE_DESTROY */ + * DEVICE_DESTROY + */ #define CONTROLVM_RESP_ERROR_DEVICE_INVALID 501 /* SWITCH_ATTACHINTPORT */ /* DEVICE_CREATE, * DEVICE_CONFIGURE, - * DEVICE_DESTROY */ + * DEVICE_DESTROY + */ #define CONTROLVM_RESP_ERROR_CHANNEL_INVALID 502 /* DEVICE_CREATE, - * DEVICE_CONFIGURE */ + * DEVICE_CONFIGURE + */ /* Partition Driver Callback Interface----------------------[600-699] */ #define CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE 604 /* BUS_CREATE, * BUS_DESTROY, * DEVICE_CREATE, - * DEVICE_DESTROY */ + * DEVICE_DESTROY + */ /* Unable to invoke VIRTPCI callback */ #define CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR 605 /* BUS_CREATE, * BUS_DESTROY, * DEVICE_CREATE, - * DEVICE_DESTROY */ + * DEVICE_DESTROY + */ /* VIRTPCI Callback returned error */ #define CONTROLVM_RESP_ERROR_GENERIC_DRIVER_CALLBACK_ERROR 606 /* SWITCH_ATTACHEXTPORT, * SWITCH_DETACHEXTPORT - * DEVICE_CONFIGURE */ + * DEVICE_CONFIGURE + */ /* generic device callback returned error */ /* Bus Related------------------------------------------------------[700-799] */ #define CONTROLVM_RESP_ERROR_BUS_DEVICE_ATTACHED 700 /* BUS_DESTROY */ /* Channel Related--------------------------------------------------[800-899] */ #define CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN 800 /* GET_CHANNELINFO, - * DEVICE_DESTROY */ + * DEVICE_DESTROY + */ #define CONTROLVM_RESP_ERROR_CHANNEL_SIZE_TOO_SMALL 801 /* DEVICE_CREATE */ /* Chipset Shutdown Related---------------------------------------[1000-1099] */ #define CONTROLVM_RESP_ERROR_CHIPSET_SHUTDOWN_FAILED 1000 From e3f8f77c41ceaf899351e2085b039610038ac2b9 Mon Sep 17 00:00:00 2001 From: Erik Arfvidson Date: Tue, 17 Nov 2015 13:35:00 -0500 Subject: [PATCH 443/843] staging: unisys: fix vbuschannel.h comments Fixes trailling */ from vbuschannel.h and alignment issue on the same comment block Signed-off-by: Erik Arfvidson Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/vbuschannel.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/unisys/visorbus/vbuschannel.h b/drivers/staging/unisys/visorbus/vbuschannel.h index 80e64477e547..90fa12e62f26 100644 --- a/drivers/staging/unisys/visorbus/vbuschannel.h +++ b/drivers/staging/unisys/visorbus/vbuschannel.h @@ -36,10 +36,11 @@ static const uuid_le spar_vbus_channel_protocol_uuid = #define SPAR_VBUS_CHANNEL_PROTOCOL_SIGNATURE ULTRA_CHANNEL_PROTOCOL_SIGNATURE /* Must increment this whenever you insert or delete fields within this channel -* struct. Also increment whenever you change the meaning of fields within this -* channel struct so as to break pre-existing software. Note that you can -* usually add fields to the END of the channel struct withOUT needing to -* increment this. */ + * struct. Also increment whenever you change the meaning of fields within this + * channel struct so as to break pre-existing software. Note that you can + * usually add fields to the END of the channel struct withOUT needing to + * increment this. + */ #define SPAR_VBUS_CHANNEL_PROTOCOL_VERSIONID 1 #define SPAR_VBUS_CHANNEL_OK_CLIENT(ch) \ From 52555a5d1058eec96c6bac2928bc965b0077c60e Mon Sep 17 00:00:00 2001 From: Dragos Bogdan Date: Wed, 18 Nov 2015 12:35:34 +0200 Subject: [PATCH 444/843] staging:iio:ad7780: Switch to the gpio descriptor interface Use the gpiod interface for the powerdown_gpio instead of the deprecated old non-descriptor interface. The powerdown pin can be tied high, so the gpio is optional. Remove the gpio_pdrst platform_data member since the new interface is used. Signed-off-by: Dragos Bogdan Acked-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/staging/iio/adc/ad7780.c | 27 +++++++++++---------------- drivers/staging/iio/adc/ad7780.h | 1 - 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/drivers/staging/iio/adc/ad7780.c b/drivers/staging/iio/adc/ad7780.c index 618b41faa289..98b5fc492eff 100644 --- a/drivers/staging/iio/adc/ad7780.c +++ b/drivers/staging/iio/adc/ad7780.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include @@ -42,7 +42,7 @@ struct ad7780_chip_info { struct ad7780_state { const struct ad7780_chip_info *chip_info; struct regulator *reg; - int powerdown_gpio; + struct gpio_desc *powerdown_gpio; unsigned int gain; u16 int_vref_mv; @@ -77,8 +77,7 @@ static int ad7780_set_mode(struct ad_sigma_delta *sigma_delta, break; } - if (gpio_is_valid(st->powerdown_gpio)) - gpio_set_value(st->powerdown_gpio, val); + gpiod_set_value(st->powerdown_gpio, val); return 0; } @@ -205,18 +204,14 @@ static int ad7780_probe(struct spi_device *spi) indio_dev->num_channels = 1; indio_dev->info = &ad7780_info; - if (pdata && gpio_is_valid(pdata->gpio_pdrst)) { - ret = devm_gpio_request_one(&spi->dev, - pdata->gpio_pdrst, - GPIOF_OUT_INIT_LOW, - "AD7780 /PDRST"); - if (ret) { - dev_err(&spi->dev, "failed to request GPIO PDRST\n"); - goto error_disable_reg; - } - st->powerdown_gpio = pdata->gpio_pdrst; - } else { - st->powerdown_gpio = -1; + st->powerdown_gpio = devm_gpiod_get_optional(&spi->dev, + "powerdown", + GPIOD_OUT_LOW); + if (IS_ERR(st->powerdown_gpio)) { + ret = PTR_ERR(st->powerdown_gpio); + dev_err(&spi->dev, "Failed to request powerdown GPIO: %d\n", + ret); + goto error_disable_reg; } ret = ad_sd_setup_buffer_and_trigger(indio_dev); diff --git a/drivers/staging/iio/adc/ad7780.h b/drivers/staging/iio/adc/ad7780.h index 67e511c3d6f0..46f61c9e798e 100644 --- a/drivers/staging/iio/adc/ad7780.h +++ b/drivers/staging/iio/adc/ad7780.h @@ -24,7 +24,6 @@ struct ad7780_platform_data { u16 vref_mv; - int gpio_pdrst; }; #endif /* IIO_ADC_AD7780_H_ */ From cef7e12585e61e2a03aea1c99331865213982f3a Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sun, 15 Nov 2015 21:00:02 +0100 Subject: [PATCH 445/843] iio: adc: xilinx: constify iio_buffer_setup_ops structure The iio_buffer_setup_ops structures are never modified, so declare this one as const, like the others. Done with the help of Coccinelle. Signed-off-by: Julia Lawall Acked-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/iio/adc/xilinx-xadc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c index 0370624a35db..c2b5f1095848 100644 --- a/drivers/iio/adc/xilinx-xadc-core.c +++ b/drivers/iio/adc/xilinx-xadc-core.c @@ -803,7 +803,7 @@ err: return ret; } -static struct iio_buffer_setup_ops xadc_buffer_ops = { +static const struct iio_buffer_setup_ops xadc_buffer_ops = { .preenable = &xadc_preenable, .postenable = &iio_triggered_buffer_postenable, .predisable = &iio_triggered_buffer_predisable, From a85994d5467a8fbcecc4ae4a42f9d4c1a0a54886 Mon Sep 17 00:00:00 2001 From: Othmar Pasteka Date: Mon, 16 Nov 2015 23:29:44 +0100 Subject: [PATCH 446/843] staging: vt6656: remove address from GPL text Cleanup errors from checkpatch.pl. Signed-off-by: Othmar Pasteka Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vt6656/baseband.c | 4 ---- drivers/staging/vt6656/baseband.h | 4 ---- drivers/staging/vt6656/card.c | 3 --- drivers/staging/vt6656/card.h | 3 --- drivers/staging/vt6656/channel.c | 4 ---- drivers/staging/vt6656/channel.h | 4 ---- drivers/staging/vt6656/desc.h | 3 --- drivers/staging/vt6656/device.h | 3 --- drivers/staging/vt6656/dpc.c | 3 --- drivers/staging/vt6656/dpc.h | 3 --- drivers/staging/vt6656/firmware.c | 4 ---- drivers/staging/vt6656/firmware.h | 4 ---- drivers/staging/vt6656/int.c | 4 ---- drivers/staging/vt6656/int.h | 4 ---- drivers/staging/vt6656/key.c | 4 ---- drivers/staging/vt6656/key.h | 4 ---- drivers/staging/vt6656/mac.c | 4 ---- drivers/staging/vt6656/mac.h | 4 ---- drivers/staging/vt6656/main_usb.c | 3 --- drivers/staging/vt6656/power.c | 4 ---- drivers/staging/vt6656/power.h | 3 --- drivers/staging/vt6656/rf.c | 4 ---- drivers/staging/vt6656/rf.h | 4 ---- drivers/staging/vt6656/rxtx.c | 3 --- drivers/staging/vt6656/rxtx.h | 3 --- drivers/staging/vt6656/usbpipe.c | 4 ---- drivers/staging/vt6656/usbpipe.h | 4 ---- drivers/staging/vt6656/wcmd.c | 3 --- drivers/staging/vt6656/wcmd.h | 3 --- 29 files changed, 104 deletions(-) diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index e5be261f2e69..9417c935fc30 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * * File: baseband.c * diff --git a/drivers/staging/vt6656/baseband.h b/drivers/staging/vt6656/baseband.h index 771ea4054174..807a5809b5d9 100644 --- a/drivers/staging/vt6656/baseband.h +++ b/drivers/staging/vt6656/baseband.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * * File: baseband.h * diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c index 927243ebcb56..a382fc6aa9d3 100644 --- a/drivers/staging/vt6656/card.c +++ b/drivers/staging/vt6656/card.c @@ -12,9 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * File: card.c * Purpose: Provide functions to setup NIC operation mode diff --git a/drivers/staging/vt6656/card.h b/drivers/staging/vt6656/card.h index 03fc1678896b..c2cde7e92c8f 100644 --- a/drivers/staging/vt6656/card.h +++ b/drivers/staging/vt6656/card.h @@ -12,9 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * File: card.h * diff --git a/drivers/staging/vt6656/channel.c b/drivers/staging/vt6656/channel.c index 8412d0532fb2..a0fe288c1322 100644 --- a/drivers/staging/vt6656/channel.c +++ b/drivers/staging/vt6656/channel.c @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * * File: channel.c * diff --git a/drivers/staging/vt6656/channel.h b/drivers/staging/vt6656/channel.h index 21c080803714..fcea6995fe26 100644 --- a/drivers/staging/vt6656/channel.h +++ b/drivers/staging/vt6656/channel.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * * File: channel.h * diff --git a/drivers/staging/vt6656/desc.h b/drivers/staging/vt6656/desc.h index f79af8513ff2..59e3071021bd 100644 --- a/drivers/staging/vt6656/desc.h +++ b/drivers/staging/vt6656/desc.h @@ -12,9 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * File: desc.h * diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index dec36f296f3d..76b5f4127f95 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -12,9 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * File: device.h * diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c index e6367ed3b0bb..6019aac8bdd5 100644 --- a/drivers/staging/vt6656/dpc.c +++ b/drivers/staging/vt6656/dpc.c @@ -12,9 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * File: dpc.c * diff --git a/drivers/staging/vt6656/dpc.h b/drivers/staging/vt6656/dpc.h index 95e0e83a487e..5a92bd86cee2 100644 --- a/drivers/staging/vt6656/dpc.h +++ b/drivers/staging/vt6656/dpc.h @@ -12,9 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * File: dpc.h * diff --git a/drivers/staging/vt6656/firmware.c b/drivers/staging/vt6656/firmware.c index d440f284bf18..1b48f9c86f63 100644 --- a/drivers/staging/vt6656/firmware.c +++ b/drivers/staging/vt6656/firmware.c @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * * File: baseband.c * diff --git a/drivers/staging/vt6656/firmware.h b/drivers/staging/vt6656/firmware.h index d594dbe1c147..e2b54acb8fdb 100644 --- a/drivers/staging/vt6656/firmware.h +++ b/drivers/staging/vt6656/firmware.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * * File: firmware.h * diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c index 14b8ebc6508d..8d05acbc0e23 100644 --- a/drivers/staging/vt6656/int.c +++ b/drivers/staging/vt6656/int.c @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * * File: int.c * diff --git a/drivers/staging/vt6656/int.h b/drivers/staging/vt6656/int.h index 154605c63947..97e55bacbb7c 100644 --- a/drivers/staging/vt6656/int.h +++ b/drivers/staging/vt6656/int.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * * File: int.h * diff --git a/drivers/staging/vt6656/key.c b/drivers/staging/vt6656/key.c index 1898fef1519c..0246a8fc47fe 100644 --- a/drivers/staging/vt6656/key.c +++ b/drivers/staging/vt6656/key.c @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * * File: key.c * diff --git a/drivers/staging/vt6656/key.h b/drivers/staging/vt6656/key.h index 3cb1291055ed..7861faf5138f 100644 --- a/drivers/staging/vt6656/key.h +++ b/drivers/staging/vt6656/key.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * * File: key.h * diff --git a/drivers/staging/vt6656/mac.c b/drivers/staging/vt6656/mac.c index 5dfac05b9cf1..eeed16e9124e 100644 --- a/drivers/staging/vt6656/mac.c +++ b/drivers/staging/vt6656/mac.c @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * * File: mac.c * diff --git a/drivers/staging/vt6656/mac.h b/drivers/staging/vt6656/mac.h index d53fcef87b4a..4c6e610f1bc1 100644 --- a/drivers/staging/vt6656/mac.h +++ b/drivers/staging/vt6656/mac.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * * File: mac.h * diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 01e642db311e..ee8d1e1a24c2 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -12,9 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * File: main_usb.c * diff --git a/drivers/staging/vt6656/power.c b/drivers/staging/vt6656/power.c index 13afce27951c..c025dab0f62c 100644 --- a/drivers/staging/vt6656/power.c +++ b/drivers/staging/vt6656/power.c @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * * File: power.c * diff --git a/drivers/staging/vt6656/power.h b/drivers/staging/vt6656/power.h index 7696b714850c..9d1ebb695f9d 100644 --- a/drivers/staging/vt6656/power.h +++ b/drivers/staging/vt6656/power.h @@ -12,9 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * File: power.h * diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c index c4286ccac320..816206c92f57 100644 --- a/drivers/staging/vt6656/rf.c +++ b/drivers/staging/vt6656/rf.c @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * * File: rf.c * diff --git a/drivers/staging/vt6656/rf.h b/drivers/staging/vt6656/rf.h index 3acdc65b1e56..c3d4f06d65f4 100644 --- a/drivers/staging/vt6656/rf.h +++ b/drivers/staging/vt6656/rf.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * * File: rf.h * diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index efb54f53b4f9..a0c69b697901 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -12,9 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * File: rxtx.c * diff --git a/drivers/staging/vt6656/rxtx.h b/drivers/staging/vt6656/rxtx.h index 90b34ab2f6ce..4a79c404275b 100644 --- a/drivers/staging/vt6656/rxtx.h +++ b/drivers/staging/vt6656/rxtx.h @@ -12,9 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * File: rxtx.h * diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c index c975c3b87093..351a99f3d684 100644 --- a/drivers/staging/vt6656/usbpipe.c +++ b/drivers/staging/vt6656/usbpipe.c @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * * File: usbpipe.c * diff --git a/drivers/staging/vt6656/usbpipe.h b/drivers/staging/vt6656/usbpipe.h index e74aa0809928..8bafd9aee1fa 100644 --- a/drivers/staging/vt6656/usbpipe.h +++ b/drivers/staging/vt6656/usbpipe.h @@ -12,10 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * * * File: usbpipe.h * diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index 3cbf4791bac1..4846a898d39b 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -12,9 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * File: wcmd.c * diff --git a/drivers/staging/vt6656/wcmd.h b/drivers/staging/vt6656/wcmd.h index 2b0ee285eb0b..764c09ccd42d 100644 --- a/drivers/staging/vt6656/wcmd.h +++ b/drivers/staging/vt6656/wcmd.h @@ -12,9 +12,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * File: wcmd.h * From b629a6f63d5d7a8aab1b57223e4353427824c6d7 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Sun, 8 Nov 2015 01:42:03 +0530 Subject: [PATCH 447/843] staging: rdma: amso1100: Remove unnecessary variables Remove unnecessary variable 'err' from functions c2_reject() and c2_service_destroy() since it can be replaced by a single line of code instead. Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/amso1100/c2_provider.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rdma/amso1100/c2_provider.c b/drivers/staging/rdma/amso1100/c2_provider.c index c707e45887c2..a092ac743c72 100644 --- a/drivers/staging/rdma/amso1100/c2_provider.c +++ b/drivers/staging/rdma/amso1100/c2_provider.c @@ -620,12 +620,9 @@ static int c2_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param) static int c2_reject(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len) { - int err; - pr_debug("%s:%u\n", __func__, __LINE__); - err = c2_llp_reject(cm_id, pdata, pdata_len); - return err; + return c2_llp_reject(cm_id, pdata, pdata_len); } static int c2_service_create(struct iw_cm_id *cm_id, int backlog) @@ -642,12 +639,9 @@ static int c2_service_create(struct iw_cm_id *cm_id, int backlog) static int c2_service_destroy(struct iw_cm_id *cm_id) { - int err; pr_debug("%s:%u\n", __func__, __LINE__); - err = c2_llp_service_destroy(cm_id); - - return err; + return c2_llp_service_destroy(cm_id); } static int c2_pseudo_up(struct net_device *netdev) From 8b3e676b0cb9444f8de18b54dee1ccb51f152460 Mon Sep 17 00:00:00 2001 From: Geliang Tang Date: Sun, 8 Nov 2015 22:17:52 +0800 Subject: [PATCH 448/843] staging: rdma: use kmalloc_array instead of kmalloc Use kmalloc_array instead of kmalloc to allocate memory for an array. Signed-off-by: Geliang Tang Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/amso1100/c2.c | 6 ++++-- drivers/staging/rdma/ipath/ipath_file_ops.c | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rdma/amso1100/c2.c b/drivers/staging/rdma/amso1100/c2.c index af043f023c7d..b46ebd1ae15a 100644 --- a/drivers/staging/rdma/amso1100/c2.c +++ b/drivers/staging/rdma/amso1100/c2.c @@ -111,7 +111,8 @@ static int c2_tx_ring_alloc(struct c2_ring *tx_ring, void *vaddr, struct c2_element *elem; int i; - tx_ring->start = kmalloc(sizeof(*elem) * tx_ring->count, GFP_KERNEL); + tx_ring->start = kmalloc_array(tx_ring->count, sizeof(*elem), + GFP_KERNEL); if (!tx_ring->start) return -ENOMEM; @@ -160,7 +161,8 @@ static int c2_rx_ring_alloc(struct c2_ring *rx_ring, void *vaddr, struct c2_element *elem; int i; - rx_ring->start = kmalloc(sizeof(*elem) * rx_ring->count, GFP_KERNEL); + rx_ring->start = kmalloc_array(rx_ring->count, sizeof(*elem), + GFP_KERNEL); if (!rx_ring->start) return -ENOMEM; diff --git a/drivers/staging/rdma/ipath/ipath_file_ops.c b/drivers/staging/rdma/ipath/ipath_file_ops.c index 13c3cd11ab92..6187b848b3ca 100644 --- a/drivers/staging/rdma/ipath/ipath_file_ops.c +++ b/drivers/staging/rdma/ipath/ipath_file_ops.c @@ -917,15 +917,15 @@ static int ipath_create_user_egr(struct ipath_portdata *pd) chunk = pd->port_rcvegrbuf_chunks; egrperchunk = pd->port_rcvegrbufs_perchunk; size = pd->port_rcvegrbuf_size; - pd->port_rcvegrbuf = kmalloc(chunk * sizeof(pd->port_rcvegrbuf[0]), - GFP_KERNEL); + pd->port_rcvegrbuf = kmalloc_array(chunk, sizeof(pd->port_rcvegrbuf[0]), + GFP_KERNEL); if (!pd->port_rcvegrbuf) { ret = -ENOMEM; goto bail; } pd->port_rcvegrbuf_phys = - kmalloc(chunk * sizeof(pd->port_rcvegrbuf_phys[0]), - GFP_KERNEL); + kmalloc_array(chunk, sizeof(pd->port_rcvegrbuf_phys[0]), + GFP_KERNEL); if (!pd->port_rcvegrbuf_phys) { ret = -ENOMEM; goto bail_rcvegrbuf; From c2f3ffb08593d8cf587ee0e4c40197b5eb68bd38 Mon Sep 17 00:00:00 2001 From: Mike Marciniszyn Date: Mon, 9 Nov 2015 19:13:57 -0500 Subject: [PATCH 449/843] staging/rdma/hfi1: move hfi1_migrate_qp Move hfi1_migrate_qp from ruc.c to qp.[hc] in prep for modifying the QP workqueue. Signed-off-by: Mike Marciniszyn Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/qp.c | 20 ++++++++++++++++++++ drivers/staging/rdma/hfi1/qp.h | 2 ++ drivers/staging/rdma/hfi1/ruc.c | 20 -------------------- drivers/staging/rdma/hfi1/verbs.h | 2 -- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/staging/rdma/hfi1/qp.c b/drivers/staging/rdma/hfi1/qp.c index f8c36166962f..a2bbf0b8316c 100644 --- a/drivers/staging/rdma/hfi1/qp.c +++ b/drivers/staging/rdma/hfi1/qp.c @@ -1685,3 +1685,23 @@ void qp_comm_est(struct hfi1_qp *qp) qp->ibqp.event_handler(&ev, qp->ibqp.qp_context); } } + +/* + * Switch to alternate path. + * The QP s_lock should be held and interrupts disabled. + */ +void hfi1_migrate_qp(struct hfi1_qp *qp) +{ + struct ib_event ev; + + qp->s_mig_state = IB_MIG_MIGRATED; + qp->remote_ah_attr = qp->alt_ah_attr; + qp->port_num = qp->alt_ah_attr.port_num; + qp->s_pkey_index = qp->s_alt_pkey_index; + qp->s_flags |= HFI1_S_AHG_CLEAR; + + ev.device = qp->ibqp.device; + ev.element.qp = &qp->ibqp; + ev.event = IB_EVENT_PATH_MIG; + qp->ibqp.event_handler(&ev, qp->ibqp.qp_context); +} diff --git a/drivers/staging/rdma/hfi1/qp.h b/drivers/staging/rdma/hfi1/qp.h index b9c1575990aa..bacfa9c5e8a8 100644 --- a/drivers/staging/rdma/hfi1/qp.h +++ b/drivers/staging/rdma/hfi1/qp.h @@ -247,4 +247,6 @@ void qp_iter_print(struct seq_file *s, struct qp_iter *iter); */ void qp_comm_est(struct hfi1_qp *qp); +void hfi1_migrate_qp(struct hfi1_qp *qp); + #endif /* _QP_H */ diff --git a/drivers/staging/rdma/hfi1/ruc.c b/drivers/staging/rdma/hfi1/ruc.c index 49bc9fd7a51a..cf8ac617552f 100644 --- a/drivers/staging/rdma/hfi1/ruc.c +++ b/drivers/staging/rdma/hfi1/ruc.c @@ -241,26 +241,6 @@ bail: return ret; } -/* - * Switch to alternate path. - * The QP s_lock should be held and interrupts disabled. - */ -void hfi1_migrate_qp(struct hfi1_qp *qp) -{ - struct ib_event ev; - - qp->s_mig_state = IB_MIG_MIGRATED; - qp->remote_ah_attr = qp->alt_ah_attr; - qp->port_num = qp->alt_ah_attr.port_num; - qp->s_pkey_index = qp->s_alt_pkey_index; - qp->s_flags |= HFI1_S_AHG_CLEAR; - - ev.device = qp->ibqp.device; - ev.element.qp = &qp->ibqp; - ev.event = IB_EVENT_PATH_MIG; - qp->ibqp.event_handler(&ev, qp->ibqp.qp_context); -} - static __be64 get_sguid(struct hfi1_ibport *ibp, unsigned index) { if (!index) { diff --git a/drivers/staging/rdma/hfi1/verbs.h b/drivers/staging/rdma/hfi1/verbs.h index 041ad07ee699..fa938fba8786 100644 --- a/drivers/staging/rdma/hfi1/verbs.h +++ b/drivers/staging/rdma/hfi1/verbs.h @@ -1069,8 +1069,6 @@ int hfi1_mmap(struct ib_ucontext *context, struct vm_area_struct *vma); int hfi1_get_rwqe(struct hfi1_qp *qp, int wr_id_only); -void hfi1_migrate_qp(struct hfi1_qp *qp); - int hfi1_ruc_check_hdr(struct hfi1_ibport *ibp, struct hfi1_ib_header *hdr, int has_grh, struct hfi1_qp *qp, u32 bth0); From 0a226edd203f1209e4ee6e07a6b41a9cfd8beeb8 Mon Sep 17 00:00:00 2001 From: Mike Marciniszyn Date: Mon, 9 Nov 2015 19:13:58 -0500 Subject: [PATCH 450/843] staging/rdma/hfi1: Use parallel workqueue for SDMA engines The workqueue is currently single threaded per port which for a small number of SDMA engines is ok. For hfi1, the there are up to 16 SDMA engines that can be fed descriptors in parallel. Use alloc_workqueue with a workqueue limit of the number of sdma engines and with WQ_CPU_INTENSIVE and WQ_HIGHPRI specified. Then change send to use the new scheduler which no longer needs to get the s_lock Reviewed-by: Dennis Dalessandro Signed-off-by: Mike Marciniszyn Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/chip.c | 1 + drivers/staging/rdma/hfi1/init.c | 13 +++++------ drivers/staging/rdma/hfi1/iowait.h | 6 +++-- drivers/staging/rdma/hfi1/qp.h | 35 ++++++++++++++++++++++++++++++ drivers/staging/rdma/hfi1/sdma.c | 8 ++++--- drivers/staging/rdma/hfi1/sdma.h | 8 ++++--- drivers/staging/rdma/hfi1/verbs.c | 20 ++++------------- drivers/staging/rdma/hfi1/verbs.h | 1 - 8 files changed, 60 insertions(+), 32 deletions(-) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index d858f36042b5..0b07b364f666 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -9044,6 +9044,7 @@ static int request_msix_irqs(struct hfi1_devdata *dd) if (handler == sdma_interrupt) { dd_dev_info(dd, "sdma engine %d cpu %d\n", sde->this_idx, sdma_cpu); + sde->cpu = sdma_cpu; cpumask_set_cpu(sdma_cpu, dd->msix_entries[i].mask); sdma_cpu = cpumask_next(sdma_cpu, def); if (sdma_cpu >= nr_cpu_ids) diff --git a/drivers/staging/rdma/hfi1/init.c b/drivers/staging/rdma/hfi1/init.c index 4a7974442154..635996742480 100644 --- a/drivers/staging/rdma/hfi1/init.c +++ b/drivers/staging/rdma/hfi1/init.c @@ -603,20 +603,19 @@ static int create_workqueues(struct hfi1_devdata *dd) for (pidx = 0; pidx < dd->num_pports; ++pidx) { ppd = dd->pport + pidx; if (!ppd->hfi1_wq) { - char wq_name[8]; /* 3 + 2 + 1 + 1 + 1 */ - - snprintf(wq_name, sizeof(wq_name), "hfi%d_%d", - dd->unit, pidx); ppd->hfi1_wq = - create_singlethread_workqueue(wq_name); + alloc_workqueue( + "hfi%d_%d", + WQ_SYSFS | WQ_HIGHPRI | WQ_CPU_INTENSIVE, + dd->num_sdma, + dd->unit, pidx); if (!ppd->hfi1_wq) goto wq_error; } } return 0; wq_error: - pr_err("create_singlethread_workqueue failed for port %d\n", - pidx + 1); + pr_err("alloc_workqueue failed for port %d\n", pidx + 1); for (pidx = 0; pidx < dd->num_pports; ++pidx) { ppd = dd->pport + pidx; if (ppd->hfi1_wq) { diff --git a/drivers/staging/rdma/hfi1/iowait.h b/drivers/staging/rdma/hfi1/iowait.h index fa361b405851..e8ba5606d08d 100644 --- a/drivers/staging/rdma/hfi1/iowait.h +++ b/drivers/staging/rdma/hfi1/iowait.h @@ -150,12 +150,14 @@ static inline void iowait_init( * iowait_schedule() - initialize wait structure * @wait: wait struct to schedule * @wq: workqueue for schedule + * @cpu: cpu */ static inline void iowait_schedule( struct iowait *wait, - struct workqueue_struct *wq) + struct workqueue_struct *wq, + int cpu) { - queue_work(wq, &wait->iowork); + queue_work_on(cpu, wq, &wait->iowork); } /** diff --git a/drivers/staging/rdma/hfi1/qp.h b/drivers/staging/rdma/hfi1/qp.h index bacfa9c5e8a8..e49cfa6e59e0 100644 --- a/drivers/staging/rdma/hfi1/qp.h +++ b/drivers/staging/rdma/hfi1/qp.h @@ -247,6 +247,41 @@ void qp_iter_print(struct seq_file *s, struct qp_iter *iter); */ void qp_comm_est(struct hfi1_qp *qp); +/** + * _hfi1_schedule_send - schedule progress + * @qp: the QP + * + * This schedules qp progress w/o regard to the s_flags. + * + * It is only used in the post send, which doesn't hold + * the s_lock. + */ +static inline void _hfi1_schedule_send(struct hfi1_qp *qp) +{ + struct hfi1_ibport *ibp = + to_iport(qp->ibqp.device, qp->port_num); + struct hfi1_pportdata *ppd = ppd_from_ibp(ibp); + struct hfi1_devdata *dd = dd_from_ibdev(qp->ibqp.device); + + iowait_schedule(&qp->s_iowait, ppd->hfi1_wq, + qp->s_sde ? + qp->s_sde->cpu : + cpumask_first(cpumask_of_node(dd->assigned_node_id))); +} + +/** + * hfi1_schedule_send - schedule progress + * @qp: the QP + * + * This schedules qp progress and caller should hold + * the s_lock. + */ +static inline void hfi1_schedule_send(struct hfi1_qp *qp) +{ + if (hfi1_send_ok(qp)) + _hfi1_schedule_send(qp); +} + void hfi1_migrate_qp(struct hfi1_qp *qp); #endif /* _QP_H */ diff --git a/drivers/staging/rdma/hfi1/sdma.c b/drivers/staging/rdma/hfi1/sdma.c index f1855457fa32..90b7072a9969 100644 --- a/drivers/staging/rdma/hfi1/sdma.c +++ b/drivers/staging/rdma/hfi1/sdma.c @@ -766,18 +766,19 @@ struct sdma_engine *sdma_select_engine_vl( struct sdma_engine *rval; if (WARN_ON(vl > 8)) - return NULL; + return &dd->per_sdma[0]; rcu_read_lock(); m = rcu_dereference(dd->sdma_map); if (unlikely(!m)) { rcu_read_unlock(); - return NULL; + return &dd->per_sdma[0]; } e = m->map[vl & m->mask]; rval = e->sde[selector & e->mask]; rcu_read_unlock(); + rval = !rval ? &dd->per_sdma[0] : rval; trace_hfi1_sdma_engine_select(dd, selector, vl, rval->this_idx); return rval; } @@ -1862,7 +1863,7 @@ static void dump_sdma_state(struct sdma_engine *sde) } #define SDE_FMT \ - "SDE %u STE %s C 0x%llx S 0x%016llx E 0x%llx T(HW) 0x%llx T(SW) 0x%x H(HW) 0x%llx H(SW) 0x%x H(D) 0x%llx DM 0x%llx GL 0x%llx R 0x%llx LIS 0x%llx AHGI 0x%llx TXT %u TXH %u DT %u DH %u FLNE %d DQF %u SLC 0x%llx\n" + "SDE %u CPU %d STE %s C 0x%llx S 0x%016llx E 0x%llx T(HW) 0x%llx T(SW) 0x%x H(HW) 0x%llx H(SW) 0x%x H(D) 0x%llx DM 0x%llx GL 0x%llx R 0x%llx LIS 0x%llx AHGI 0x%llx TXT %u TXH %u DT %u DH %u FLNE %d DQF %u SLC 0x%llx\n" /** * sdma_seqfile_dump_sde() - debugfs dump of sde * @s: seq file @@ -1882,6 +1883,7 @@ void sdma_seqfile_dump_sde(struct seq_file *s, struct sdma_engine *sde) head = sde->descq_head & sde->sdma_mask; tail = ACCESS_ONCE(sde->descq_tail) & sde->sdma_mask; seq_printf(s, SDE_FMT, sde->this_idx, + sde->cpu, sdma_state_name(sde->state.current_state), (unsigned long long)read_sde_csr(sde, SD(CTRL)), (unsigned long long)read_sde_csr(sde, SD(STATUS)), diff --git a/drivers/staging/rdma/hfi1/sdma.h b/drivers/staging/rdma/hfi1/sdma.h index cc22d2ee2054..85701eed1585 100644 --- a/drivers/staging/rdma/hfi1/sdma.h +++ b/drivers/staging/rdma/hfi1/sdma.h @@ -410,8 +410,6 @@ struct sdma_engine { u64 idle_mask; u64 progress_mask; /* private: */ - struct workqueue_struct *wq; - /* private: */ volatile __le64 *head_dma; /* DMA'ed by chip */ /* private: */ dma_addr_t head_phys; @@ -426,6 +424,8 @@ struct sdma_engine { u32 sdma_mask; /* private */ struct sdma_state state; + /* private */ + int cpu; /* private: */ u8 sdma_shift; /* private: */ @@ -990,7 +990,9 @@ static inline void sdma_iowait_schedule( struct sdma_engine *sde, struct iowait *wait) { - iowait_schedule(wait, sde->wq); + struct hfi1_pportdata *ppd = sde->dd->pport; + + iowait_schedule(wait, ppd->hfi1_wq, sde->cpu); } /* for use by interrupt handling */ diff --git a/drivers/staging/rdma/hfi1/verbs.c b/drivers/staging/rdma/hfi1/verbs.c index ea1d9e6303e2..38d2cd33a46f 100644 --- a/drivers/staging/rdma/hfi1/verbs.c +++ b/drivers/staging/rdma/hfi1/verbs.c @@ -162,6 +162,8 @@ static inline struct hfi1_ucontext *to_iucontext(struct ib_ucontext return container_of(ibucontext, struct hfi1_ucontext, ibucontext); } +static inline void _hfi1_schedule_send(struct hfi1_qp *qp); + /* * Translate ib_wr_opcode into ib_wc_opcode. */ @@ -509,9 +511,9 @@ static int post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, nreq++; } bail: - if (nreq && !call_send) - hfi1_schedule_send(qp); spin_unlock_irqrestore(&qp->s_lock, flags); + if (nreq && !call_send) + _hfi1_schedule_send(qp); if (nreq && call_send) hfi1_do_send(&qp->s_iowait.iowork); return err; @@ -2135,20 +2137,6 @@ void hfi1_unregister_ib_device(struct hfi1_devdata *dd) vfree(dev->lk_table.table); } -/* - * This must be called with s_lock held. - */ -void hfi1_schedule_send(struct hfi1_qp *qp) -{ - if (hfi1_send_ok(qp)) { - struct hfi1_ibport *ibp = - to_iport(qp->ibqp.device, qp->port_num); - struct hfi1_pportdata *ppd = ppd_from_ibp(ibp); - - iowait_schedule(&qp->s_iowait, ppd->hfi1_wq); - } -} - void hfi1_cnp_rcv(struct hfi1_packet *packet) { struct hfi1_ibport *ibp = &packet->rcd->ppd->ibport_data; diff --git a/drivers/staging/rdma/hfi1/verbs.h b/drivers/staging/rdma/hfi1/verbs.h index fa938fba8786..b5013f88ea3c 100644 --- a/drivers/staging/rdma/hfi1/verbs.h +++ b/drivers/staging/rdma/hfi1/verbs.h @@ -846,7 +846,6 @@ static inline int hfi1_send_ok(struct hfi1_qp *qp) /* * This must be called with s_lock held. */ -void hfi1_schedule_send(struct hfi1_qp *qp); void hfi1_bad_pqkey(struct hfi1_ibport *ibp, __be16 trap_num, u32 key, u32 sl, u32 qp1, u32 qp2, __be16 lid1, __be16 lid2); void hfi1_cap_mask_chg(struct hfi1_ibport *ibp); From d7b8ba5121e874fddd09e2e953f09646594a24a8 Mon Sep 17 00:00:00 2001 From: Mike Marciniszyn Date: Mon, 9 Nov 2015 19:13:59 -0500 Subject: [PATCH 451/843] staging/rdma/hfi1: pre-compute sc and sde for RC/UC QPs Now that we have a multi-threaded work queue we precomputed and store the SC and SDE on RC and UC QPs for faster access. Reviewed-by: Dennis Dalessandro Signed-off-by: Mike Marciniszyn Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/qp.c | 27 +++++++++++++++++++++------ drivers/staging/rdma/hfi1/qp.h | 1 - drivers/staging/rdma/hfi1/ruc.c | 10 ++-------- drivers/staging/rdma/hfi1/ud.c | 1 + drivers/staging/rdma/hfi1/verbs.c | 14 +++----------- drivers/staging/rdma/hfi1/verbs.h | 3 ++- 6 files changed, 29 insertions(+), 27 deletions(-) diff --git a/drivers/staging/rdma/hfi1/qp.c b/drivers/staging/rdma/hfi1/qp.c index a2bbf0b8316c..d37c4a77d1d8 100644 --- a/drivers/staging/rdma/hfi1/qp.c +++ b/drivers/staging/rdma/hfi1/qp.c @@ -617,7 +617,7 @@ int hfi1_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int mig = 0; int ret; u32 pmtu = 0; /* for gcc warning only */ - struct hfi1_devdata *dd; + struct hfi1_devdata *dd = dd_from_dev(dev); spin_lock_irq(&qp->r_lock); spin_lock(&qp->s_lock); @@ -631,23 +631,35 @@ int hfi1_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, goto inval; if (attr_mask & IB_QP_AV) { + u8 sc; + if (attr->ah_attr.dlid >= HFI1_MULTICAST_LID_BASE) goto inval; if (hfi1_check_ah(qp->ibqp.device, &attr->ah_attr)) goto inval; + sc = ah_to_sc(ibqp->device, &attr->ah_attr); + if (!qp_to_sdma_engine(qp, sc) && + dd->flags & HFI1_HAS_SEND_DMA) + goto inval; } if (attr_mask & IB_QP_ALT_PATH) { + u8 sc; + if (attr->alt_ah_attr.dlid >= HFI1_MULTICAST_LID_BASE) goto inval; if (hfi1_check_ah(qp->ibqp.device, &attr->alt_ah_attr)) goto inval; - if (attr->alt_pkey_index >= hfi1_get_npkeys(dd_from_dev(dev))) + if (attr->alt_pkey_index >= hfi1_get_npkeys(dd)) + goto inval; + sc = ah_to_sc(ibqp->device, &attr->alt_ah_attr); + if (!qp_to_sdma_engine(qp, sc) && + dd->flags & HFI1_HAS_SEND_DMA) goto inval; } if (attr_mask & IB_QP_PKEY_INDEX) - if (attr->pkey_index >= hfi1_get_npkeys(dd_from_dev(dev))) + if (attr->pkey_index >= hfi1_get_npkeys(dd)) goto inval; if (attr_mask & IB_QP_MIN_RNR_TIMER) @@ -792,6 +804,8 @@ int hfi1_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, qp->remote_ah_attr = attr->ah_attr; qp->s_srate = attr->ah_attr.static_rate; qp->srate_mbps = ib_rate_to_mbps(qp->s_srate); + qp->s_sc = ah_to_sc(ibqp->device, &qp->remote_ah_attr); + qp->s_sde = qp_to_sdma_engine(qp, qp->s_sc); } if (attr_mask & IB_QP_ALT_PATH) { @@ -806,6 +820,8 @@ int hfi1_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, qp->port_num = qp->alt_ah_attr.port_num; qp->s_pkey_index = qp->s_alt_pkey_index; qp->s_flags |= HFI1_S_AHG_CLEAR; + qp->s_sc = ah_to_sc(ibqp->device, &qp->remote_ah_attr); + qp->s_sde = qp_to_sdma_engine(qp, qp->s_sc); } } @@ -1528,9 +1544,6 @@ struct sdma_engine *qp_to_sdma_engine(struct hfi1_qp *qp, u8 sc5) if (!(dd->flags & HFI1_HAS_SEND_DMA)) return NULL; switch (qp->ibqp.qp_type) { - case IB_QPT_UC: - case IB_QPT_RC: - break; case IB_QPT_SMI: return NULL; default: @@ -1699,6 +1712,8 @@ void hfi1_migrate_qp(struct hfi1_qp *qp) qp->port_num = qp->alt_ah_attr.port_num; qp->s_pkey_index = qp->s_alt_pkey_index; qp->s_flags |= HFI1_S_AHG_CLEAR; + qp->s_sc = ah_to_sc(qp->ibqp.device, &qp->remote_ah_attr); + qp->s_sde = qp_to_sdma_engine(qp, qp->s_sc); ev.device = qp->ibqp.device; ev.element.qp = &qp->ibqp; diff --git a/drivers/staging/rdma/hfi1/qp.h b/drivers/staging/rdma/hfi1/qp.h index e49cfa6e59e0..94fd748a00a6 100644 --- a/drivers/staging/rdma/hfi1/qp.h +++ b/drivers/staging/rdma/hfi1/qp.h @@ -128,7 +128,6 @@ static inline void clear_ahg(struct hfi1_qp *qp) if (qp->s_sde && qp->s_ahgidx >= 0) sdma_ahg_free(qp->s_sde, qp->s_ahgidx); qp->s_ahgidx = -1; - qp->s_sde = NULL; } /** diff --git a/drivers/staging/rdma/hfi1/ruc.c b/drivers/staging/rdma/hfi1/ruc.c index cf8ac617552f..863092bb0684 100644 --- a/drivers/staging/rdma/hfi1/ruc.c +++ b/drivers/staging/rdma/hfi1/ruc.c @@ -694,11 +694,8 @@ static inline void build_ahg(struct hfi1_qp *qp, u32 npsn) clear_ahg(qp); if (!(qp->s_flags & HFI1_S_AHG_VALID)) { /* first middle that needs copy */ - if (qp->s_ahgidx < 0) { - if (!qp->s_sde) - qp->s_sde = qp_to_sdma_engine(qp, qp->s_sc); + if (qp->s_ahgidx < 0) qp->s_ahgidx = sdma_ahg_alloc(qp->s_sde); - } if (qp->s_ahgidx >= 0) { qp->s_ahgpsn = npsn; qp->s_hdr->tx_flags |= SDMA_TXREQ_F_AHG_COPY; @@ -741,7 +738,6 @@ void hfi1_make_ruc_header(struct hfi1_qp *qp, struct hfi1_other_headers *ohdr, u16 lrh0; u32 nwords; u32 extra_bytes; - u8 sc5; u32 bth1; /* Construct the header. */ @@ -755,9 +751,7 @@ void hfi1_make_ruc_header(struct hfi1_qp *qp, struct hfi1_other_headers *ohdr, lrh0 = HFI1_LRH_GRH; middle = 0; } - sc5 = ibp->sl_to_sc[qp->remote_ah_attr.sl]; - lrh0 |= (sc5 & 0xf) << 12 | (qp->remote_ah_attr.sl & 0xf) << 4; - qp->s_sc = sc5; + lrh0 |= (qp->s_sc & 0xf) << 12 | (qp->remote_ah_attr.sl & 0xf) << 4; /* * reset s_hdr/AHG fields * diff --git a/drivers/staging/rdma/hfi1/ud.c b/drivers/staging/rdma/hfi1/ud.c index 5a9c784bec04..54ff1f5416d4 100644 --- a/drivers/staging/rdma/hfi1/ud.c +++ b/drivers/staging/rdma/hfi1/ud.c @@ -383,6 +383,7 @@ int hfi1_make_ud_req(struct hfi1_qp *qp) lrh0 |= (sc5 & 0xf) << 12; qp->s_sc = sc5; } + qp->s_sde = qp_to_sdma_engine(qp, qp->s_sc); qp->s_hdr->ibh.lrh[0] = cpu_to_be16(lrh0); qp->s_hdr->ibh.lrh[1] = cpu_to_be16(ah_attr->dlid); /* DEST LID */ qp->s_hdr->ibh.lrh[2] = diff --git a/drivers/staging/rdma/hfi1/verbs.c b/drivers/staging/rdma/hfi1/verbs.c index 38d2cd33a46f..296b7cbf39a9 100644 --- a/drivers/staging/rdma/hfi1/verbs.c +++ b/drivers/staging/rdma/hfi1/verbs.c @@ -1011,7 +1011,6 @@ int hfi1_verbs_send_dma(struct hfi1_qp *qp, struct ahg_ib_header *ahdr, struct verbs_txreq *tx; struct sdma_txreq *stx; u64 pbc_flags = 0; - struct sdma_engine *sde; u8 sc5 = qp->s_sc; int ret; @@ -1032,12 +1031,7 @@ int hfi1_verbs_send_dma(struct hfi1_qp *qp, struct ahg_ib_header *ahdr, if (IS_ERR(tx)) goto bail_tx; - if (!qp->s_hdr->sde) { - tx->sde = sde = qp_to_sdma_engine(qp, sc5); - if (!sde) - goto bail_no_sde; - } else - tx->sde = sde = qp->s_hdr->sde; + tx->sde = qp->s_sde; if (likely(pbc == 0)) { u32 vl = sc_to_vlt(dd_from_ibdev(qp->ibqp.device), sc5); @@ -1052,17 +1046,15 @@ int hfi1_verbs_send_dma(struct hfi1_qp *qp, struct ahg_ib_header *ahdr, if (qp->s_rdma_mr) qp->s_rdma_mr = NULL; tx->hdr_dwords = hdrwords + 2; - ret = build_verbs_tx_desc(sde, ss, len, tx, ahdr, pbc); + ret = build_verbs_tx_desc(tx->sde, ss, len, tx, ahdr, pbc); if (unlikely(ret)) goto bail_build; trace_output_ibhdr(dd_from_ibdev(qp->ibqp.device), &ahdr->ibh); - ret = sdma_send_txreq(sde, &qp->s_iowait, &tx->txreq); + ret = sdma_send_txreq(tx->sde, &qp->s_iowait, &tx->txreq); if (unlikely(ret == -ECOMM)) goto bail_ecomm; return ret; -bail_no_sde: - hfi1_put_txreq(tx); bail_ecomm: /* The current one got "sent" */ return 0; diff --git a/drivers/staging/rdma/hfi1/verbs.h b/drivers/staging/rdma/hfi1/verbs.h index b5013f88ea3c..fdbe0f9d5f31 100644 --- a/drivers/staging/rdma/hfi1/verbs.h +++ b/drivers/staging/rdma/hfi1/verbs.h @@ -441,7 +441,8 @@ struct hfi1_qp { struct hfi1_swqe *s_wq; /* send work queue */ struct hfi1_mmap_info *ip; struct ahg_ib_header *s_hdr; /* next packet header to send */ - u8 s_sc; /* SC[0..4] for next packet */ + /* sc for UC/RC QPs - based on ah for UD */ + u8 s_sc; unsigned long timeout_jiffies; /* computed from timeout */ enum ib_mtu path_mtu; From 46b010d3eeb8eb29c740c4ef09c666485f5c07e6 Mon Sep 17 00:00:00 2001 From: "Mark F. Brown" Date: Mon, 9 Nov 2015 19:18:20 -0500 Subject: [PATCH 452/843] staging/rdma/hfi1: Workaround to prevent corruption during packet delivery Disabling one receive context when RX_DMA is receiving a packet can cause incorrect packet delivery for a subsequent packet on another receive context. This is resolved by doing the following: 1. Programming dummy tail address for every receive context before enabling it 2. While deallocating receive context resetting tail address to dummy address 3. Leaving the dummy address in when disabling tail update 4. When disabling receive context leaving tail update enabled Reviewed-by: Dennis Dalessandro Reviewed-by: Mike Marciniszyn Reviewed-by: Mitko Haralanov Signed-off-by: Mark F. Brown Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/chip.c | 18 +++++++++++++++--- drivers/staging/rdma/hfi1/hfi.h | 4 ++++ drivers/staging/rdma/hfi1/init.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index 0b07b364f666..456704e9629a 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -7785,6 +7785,17 @@ void hfi1_rcvctrl(struct hfi1_devdata *dd, unsigned int op, int ctxt) } if (op & HFI1_RCVCTRL_CTXT_DIS) { write_csr(dd, RCV_VL15, 0); + /* + * When receive context is being disabled turn on tail + * update with a dummy tail address and then disable + * receive context. + */ + if (dd->rcvhdrtail_dummy_physaddr) { + write_kctxt_csr(dd, ctxt, RCV_HDR_TAIL_ADDR, + dd->rcvhdrtail_dummy_physaddr); + rcvctrl |= RCV_CTXT_CTRL_TAIL_UPD_SMASK; + } + rcvctrl &= ~RCV_CTXT_CTRL_ENABLE_SMASK; } if (op & HFI1_RCVCTRL_INTRAVAIL_ENB) @@ -7854,10 +7865,11 @@ void hfi1_rcvctrl(struct hfi1_devdata *dd, unsigned int op, int ctxt) if (op & (HFI1_RCVCTRL_TAILUPD_DIS | HFI1_RCVCTRL_CTXT_DIS)) /* * If the context has been disabled and the Tail Update has - * been cleared, clear the RCV_HDR_TAIL_ADDR CSR so - * it doesn't contain an address that is invalid. + * been cleared, set the RCV_HDR_TAIL_ADDR CSR to dummy address + * so it doesn't contain an address that is invalid. */ - write_kctxt_csr(dd, ctxt, RCV_HDR_TAIL_ADDR, 0); + write_kctxt_csr(dd, ctxt, RCV_HDR_TAIL_ADDR, + dd->rcvhdrtail_dummy_physaddr); } u32 hfi1_read_cntrs(struct hfi1_devdata *dd, loff_t pos, char **namep, diff --git a/drivers/staging/rdma/hfi1/hfi.h b/drivers/staging/rdma/hfi1/hfi.h index 70891fbf89b0..1fd12411463c 100644 --- a/drivers/staging/rdma/hfi1/hfi.h +++ b/drivers/staging/rdma/hfi1/hfi.h @@ -1071,6 +1071,10 @@ struct hfi1_devdata { /* Save the enabled LCB error bits */ u64 lcb_err_en; u8 dc_shutdown; + + /* receive context tail dummy address */ + __le64 *rcvhdrtail_dummy_kvaddr; + dma_addr_t rcvhdrtail_dummy_physaddr; }; /* 8051 firmware version helper */ diff --git a/drivers/staging/rdma/hfi1/init.c b/drivers/staging/rdma/hfi1/init.c index 635996742480..c17cef6938fb 100644 --- a/drivers/staging/rdma/hfi1/init.c +++ b/drivers/staging/rdma/hfi1/init.c @@ -692,6 +692,18 @@ int hfi1_init(struct hfi1_devdata *dd, int reinit) if (ret) goto done; + /* allocate dummy tail memory for all receive contexts */ + dd->rcvhdrtail_dummy_kvaddr = dma_zalloc_coherent( + &dd->pcidev->dev, sizeof(u64), + &dd->rcvhdrtail_dummy_physaddr, + GFP_KERNEL); + + if (!dd->rcvhdrtail_dummy_kvaddr) { + dd_dev_err(dd, "cannot allocate dummy tail memory\n"); + ret = -ENOMEM; + goto done; + } + /* dd->rcd can be NULL if early initialization failed */ for (i = 0; dd->rcd && i < dd->first_user_ctxt; ++i) { /* @@ -1267,6 +1279,14 @@ static void cleanup_device_data(struct hfi1_devdata *dd) tmp = dd->rcd; dd->rcd = NULL; spin_unlock_irqrestore(&dd->uctxt_lock, flags); + + if (dd->rcvhdrtail_dummy_kvaddr) { + dma_free_coherent(&dd->pcidev->dev, sizeof(u64), + (void *)dd->rcvhdrtail_dummy_kvaddr, + dd->rcvhdrtail_dummy_physaddr); + dd->rcvhdrtail_dummy_kvaddr = NULL; + } + for (ctxt = 0; tmp && ctxt < dd->num_rcv_contexts; ctxt++) { struct hfi1_ctxtdata *rcd = tmp[ctxt]; @@ -1522,6 +1542,14 @@ int hfi1_create_rcvhdrq(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd) reg = (dd->rcvhdrsize & RCV_HDR_SIZE_HDR_SIZE_MASK) << RCV_HDR_SIZE_HDR_SIZE_SHIFT; write_kctxt_csr(dd, rcd->ctxt, RCV_HDR_SIZE, reg); + + /* + * Program dummy tail address for every receive context + * before enabling any receive context + */ + write_kctxt_csr(dd, rcd->ctxt, RCV_HDR_TAIL_ADDR, + dd->rcvhdrtail_dummy_physaddr); + return 0; bail_free: From 2fd36865b570667bf3deb0ad3e1f7739ce85c063 Mon Sep 17 00:00:00 2001 From: Mike Marciniszyn Date: Tue, 10 Nov 2015 09:13:55 -0500 Subject: [PATCH 453/843] staging/rdma/hfi1: add common routine for queuing acks This patch is a prelimary patch required to coalesce acks. The routine to "schedule" a QP for sending a NAK is now centralized in rc_defer_ack(). The flag is changed for clarity since the all acks will potentially use the deferral mechanism. Reviewed-by: Dennis Dalessandro Signed-off-by: Mike Marciniszyn Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/driver.c | 4 +-- drivers/staging/rdma/hfi1/rc.c | 42 +++++++++++------------------- drivers/staging/rdma/hfi1/verbs.h | 12 +++++---- 3 files changed, 24 insertions(+), 34 deletions(-) diff --git a/drivers/staging/rdma/hfi1/driver.c b/drivers/staging/rdma/hfi1/driver.c index 72ab5e145f49..487d58778d70 100644 --- a/drivers/staging/rdma/hfi1/driver.c +++ b/drivers/staging/rdma/hfi1/driver.c @@ -714,8 +714,8 @@ static inline void process_rcv_qp_work(struct hfi1_packet *packet) */ list_for_each_entry_safe(qp, nqp, &rcd->qp_wait_list, rspwait) { list_del_init(&qp->rspwait); - if (qp->r_flags & HFI1_R_RSP_NAK) { - qp->r_flags &= ~HFI1_R_RSP_NAK; + if (qp->r_flags & HFI1_R_RSP_DEFERED_ACK) { + qp->r_flags &= ~HFI1_R_RSP_DEFERED_ACK; hfi1_send_rc_ack(rcd, qp, 0); } if (qp->r_flags & HFI1_R_RSP_SEND) { diff --git a/drivers/staging/rdma/hfi1/rc.c b/drivers/staging/rdma/hfi1/rc.c index fd23907f18fe..0c10012cc397 100644 --- a/drivers/staging/rdma/hfi1/rc.c +++ b/drivers/staging/rdma/hfi1/rc.c @@ -1608,6 +1608,16 @@ bail: return; } +static inline void rc_defered_ack(struct hfi1_ctxtdata *rcd, + struct hfi1_qp *qp) +{ + if (list_empty(&qp->rspwait)) { + qp->r_flags |= HFI1_R_RSP_DEFERED_ACK; + atomic_inc(&qp->refcount); + list_add_tail(&qp->rspwait, &rcd->qp_wait_list); + } +} + /** * rc_rcv_error - process an incoming duplicate or error RC packet * @ohdr: the other headers for this packet @@ -1650,11 +1660,7 @@ static noinline int rc_rcv_error(struct hfi1_other_headers *ohdr, void *data, * in the receive queue have been processed. * Otherwise, we end up propagating congestion. */ - if (list_empty(&qp->rspwait)) { - qp->r_flags |= HFI1_R_RSP_NAK; - atomic_inc(&qp->refcount); - list_add_tail(&qp->rspwait, &rcd->qp_wait_list); - } + rc_defered_ack(rcd, qp); } goto done; } @@ -2337,11 +2343,7 @@ rnr_nak: qp->r_nak_state = IB_RNR_NAK | qp->r_min_rnr_timer; qp->r_ack_psn = qp->r_psn; /* Queue RNR NAK for later */ - if (list_empty(&qp->rspwait)) { - qp->r_flags |= HFI1_R_RSP_NAK; - atomic_inc(&qp->refcount); - list_add_tail(&qp->rspwait, &rcd->qp_wait_list); - } + rc_defered_ack(rcd, qp); return; nack_op_err: @@ -2349,11 +2351,7 @@ nack_op_err: qp->r_nak_state = IB_NAK_REMOTE_OPERATIONAL_ERROR; qp->r_ack_psn = qp->r_psn; /* Queue NAK for later */ - if (list_empty(&qp->rspwait)) { - qp->r_flags |= HFI1_R_RSP_NAK; - atomic_inc(&qp->refcount); - list_add_tail(&qp->rspwait, &rcd->qp_wait_list); - } + rc_defered_ack(rcd, qp); return; nack_inv_unlck: @@ -2363,11 +2361,7 @@ nack_inv: qp->r_nak_state = IB_NAK_INVALID_REQUEST; qp->r_ack_psn = qp->r_psn; /* Queue NAK for later */ - if (list_empty(&qp->rspwait)) { - qp->r_flags |= HFI1_R_RSP_NAK; - atomic_inc(&qp->refcount); - list_add_tail(&qp->rspwait, &rcd->qp_wait_list); - } + rc_defered_ack(rcd, qp); return; nack_acc_unlck: @@ -2421,13 +2415,7 @@ void hfi1_rc_hdrerr( * Otherwise, we end up * propagating congestion. */ - if (list_empty(&qp->rspwait)) { - qp->r_flags |= HFI1_R_RSP_NAK; - atomic_inc(&qp->refcount); - list_add_tail( - &qp->rspwait, - &rcd->qp_wait_list); - } + rc_defered_ack(rcd, qp); } /* Out of sequence NAK */ } /* QP Request NAKs */ } diff --git a/drivers/staging/rdma/hfi1/verbs.h b/drivers/staging/rdma/hfi1/verbs.h index fdbe0f9d5f31..6a49a3ca96b4 100644 --- a/drivers/staging/rdma/hfi1/verbs.h +++ b/drivers/staging/rdma/hfi1/verbs.h @@ -553,11 +553,13 @@ struct hfi1_qp { /* * Bit definitions for r_flags. */ -#define HFI1_R_REUSE_SGE 0x01 -#define HFI1_R_RDMAR_SEQ 0x02 -#define HFI1_R_RSP_NAK 0x04 -#define HFI1_R_RSP_SEND 0x08 -#define HFI1_R_COMM_EST 0x10 +#define HFI1_R_REUSE_SGE 0x01 +#define HFI1_R_RDMAR_SEQ 0x02 +/* defer ack until end of interrupt session */ +#define HFI1_R_RSP_DEFERED_ACK 0x04 +/* relay ack to send engine */ +#define HFI1_R_RSP_SEND 0x08 +#define HFI1_R_COMM_EST 0x10 /* * Bit definitions for s_flags. From 7c091e5c0685c463dc58e5115781f7ac0a1448d6 Mon Sep 17 00:00:00 2001 From: Mike Marciniszyn Date: Tue, 10 Nov 2015 09:14:01 -0500 Subject: [PATCH 454/843] staging/rdma/hfi1: add ACK coalescing logic Implement ACK coalesing logic using a 8 bit counter. The algorithm is send pio ack when: - fecn present - this is the first packet in an interrupt session - counter is >= HFI1_PSN_CREDIT Otherwise the ack is defered. Reviewed-by: Dennis Dalessandro Signed-off-by: Mike Marciniszyn Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/qp.c | 1 + drivers/staging/rdma/hfi1/rc.c | 29 +++++++++++++++++++++++++++-- drivers/staging/rdma/hfi1/verbs.h | 7 ++++--- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rdma/hfi1/qp.c b/drivers/staging/rdma/hfi1/qp.c index d37c4a77d1d8..ce036810d576 100644 --- a/drivers/staging/rdma/hfi1/qp.c +++ b/drivers/staging/rdma/hfi1/qp.c @@ -378,6 +378,7 @@ static void reset_qp(struct hfi1_qp *qp, enum ib_qp_type type) } qp->s_ack_state = IB_OPCODE_RC_ACKNOWLEDGE; qp->r_nak_state = 0; + qp->r_adefered = 0; qp->r_aflags = 0; qp->r_flags = 0; qp->s_head = 0; diff --git a/drivers/staging/rdma/hfi1/rc.c b/drivers/staging/rdma/hfi1/rc.c index 0c10012cc397..6f4a155f7931 100644 --- a/drivers/staging/rdma/hfi1/rc.c +++ b/drivers/staging/rdma/hfi1/rc.c @@ -1618,6 +1618,17 @@ static inline void rc_defered_ack(struct hfi1_ctxtdata *rcd, } } +static inline void rc_cancel_ack(struct hfi1_qp *qp) +{ + qp->r_adefered = 0; + if (list_empty(&qp->rspwait)) + return; + list_del_init(&qp->rspwait); + qp->r_flags &= ~HFI1_R_RSP_DEFERED_ACK; + if (atomic_dec_and_test(&qp->refcount)) + wake_up(&qp->wait); +} + /** * rc_rcv_error - process an incoming duplicate or error RC packet * @ohdr: the other headers for this packet @@ -2335,8 +2346,22 @@ send_last: qp->r_ack_psn = psn; qp->r_nak_state = 0; /* Send an ACK if requested or required. */ - if (psn & (1 << 31)) - goto send_ack; + if (psn & IB_BTH_REQ_ACK) { + if (packet->numpkt == 0) { + rc_cancel_ack(qp); + goto send_ack; + } + if (qp->r_adefered >= HFI1_PSN_CREDIT) { + rc_cancel_ack(qp); + goto send_ack; + } + if (unlikely(is_fecn)) { + rc_cancel_ack(qp); + goto send_ack; + } + qp->r_adefered++; + rc_defered_ack(rcd, qp); + } return; rnr_nak: diff --git a/drivers/staging/rdma/hfi1/verbs.h b/drivers/staging/rdma/hfi1/verbs.h index 6a49a3ca96b4..cdc844f56c6b 100644 --- a/drivers/staging/rdma/hfi1/verbs.h +++ b/drivers/staging/rdma/hfi1/verbs.h @@ -120,9 +120,9 @@ struct hfi1_packet; #define HFI1_VENDOR_IPG cpu_to_be16(0xFFA0) -#define IB_BTH_REQ_ACK (1 << 31) -#define IB_BTH_SOLICITED (1 << 23) -#define IB_BTH_MIG_REQ (1 << 22) +#define IB_BTH_REQ_ACK BIT(31) +#define IB_BTH_SOLICITED BIT(23) +#define IB_BTH_MIG_REQ BIT(22) #define IB_GRH_VERSION 6 #define IB_GRH_VERSION_MASK 0xF @@ -490,6 +490,7 @@ struct hfi1_qp { u32 r_psn; /* expected rcv packet sequence number */ u32 r_msn; /* message sequence number */ + u8 r_adefered; /* number of acks defered */ u8 r_state; /* opcode of last packet received */ u8 r_flags; u8 r_head_ack_queue; /* index into s_ack_queue[] */ From d46e51448a9a79817b85e9af04506d453ef5e279 Mon Sep 17 00:00:00 2001 From: Dennis Dalessandro Date: Wed, 11 Nov 2015 00:34:37 -0500 Subject: [PATCH 455/843] staging/rdma/hfi1: Reduce number of parameters passed to send handlers The current send function handlers are passed a bunch of parameters that are already part of the data structure that is passed in first (qp). This patch removes all of this and just passes the QP. Reviewed-by: Mike Marciniszyn Signed-off-by: Dennis Dalessandro Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/diag.c | 27 +++++++-------- drivers/staging/rdma/hfi1/hfi.h | 20 +++++------ drivers/staging/rdma/hfi1/ruc.c | 15 +++++---- drivers/staging/rdma/hfi1/verbs.c | 55 ++++++++++++++----------------- drivers/staging/rdma/hfi1/verbs.h | 23 ++++++++----- 5 files changed, 71 insertions(+), 69 deletions(-) diff --git a/drivers/staging/rdma/hfi1/diag.c b/drivers/staging/rdma/hfi1/diag.c index 88414d720469..0aaad7412842 100644 --- a/drivers/staging/rdma/hfi1/diag.c +++ b/drivers/staging/rdma/hfi1/diag.c @@ -1618,14 +1618,12 @@ int snoop_recv_handler(struct hfi1_packet *packet) /* * Handle snooping and capturing packets when sdma is being used. */ -int snoop_send_dma_handler(struct hfi1_qp *qp, struct ahg_ib_header *ibhdr, - u32 hdrwords, struct hfi1_sge_state *ss, u32 len, - u32 plen, u32 dwords, u64 pbc) +int snoop_send_dma_handler(struct hfi1_qp *qp, struct hfi1_pkt_state *ps, + u64 pbc) { - pr_alert("Snooping/Capture of Send DMA Packets Is Not Supported!\n"); + pr_alert("Snooping/Capture of Send DMA Packets Is Not Supported!\n"); snoop_dbg("Unsupported Operation"); - return hfi1_verbs_send_dma(qp, ibhdr, hdrwords, ss, len, plen, dwords, - 0); + return hfi1_verbs_send_dma(qp, ps, 0); } /* @@ -1633,12 +1631,16 @@ int snoop_send_dma_handler(struct hfi1_qp *qp, struct ahg_ib_header *ibhdr, * bypass packets. The only way to send a bypass packet currently is to use the * diagpkt interface. When that interface is enable snoop/capture is not. */ -int snoop_send_pio_handler(struct hfi1_qp *qp, struct ahg_ib_header *ahdr, - u32 hdrwords, struct hfi1_sge_state *ss, u32 len, - u32 plen, u32 dwords, u64 pbc) +int snoop_send_pio_handler(struct hfi1_qp *qp, struct hfi1_pkt_state *ps, + u64 pbc) { - struct hfi1_ibport *ibp = to_iport(qp->ibqp.device, qp->port_num); - struct hfi1_pportdata *ppd = ppd_from_ibp(ibp); + struct ahg_ib_header *ahdr = qp->s_hdr; + u32 hdrwords = qp->s_hdrwords; + struct hfi1_sge_state *ss = qp->s_cur_sge; + u32 len = qp->s_cur_size; + u32 dwords = (len + 3) >> 2; + u32 plen = hdrwords + dwords + 2; /* includes pbc */ + struct hfi1_pportdata *ppd = ps->ppd; struct snoop_packet *s_packet = NULL; u32 *hdr = (u32 *)&ahdr->ibh; u32 length = 0; @@ -1783,8 +1785,7 @@ int snoop_send_pio_handler(struct hfi1_qp *qp, struct ahg_ib_header *ahdr, break; } out: - return hfi1_verbs_send_pio(qp, ahdr, hdrwords, ss, len, plen, dwords, - md.u.pbc); + return hfi1_verbs_send_pio(qp, ps, md.u.pbc); } /* diff --git a/drivers/staging/rdma/hfi1/hfi.h b/drivers/staging/rdma/hfi1/hfi.h index 1fd12411463c..b048cf6960d9 100644 --- a/drivers/staging/rdma/hfi1/hfi.h +++ b/drivers/staging/rdma/hfi1/hfi.h @@ -1048,12 +1048,10 @@ struct hfi1_devdata { * Handlers for outgoing data so that snoop/capture does not * have to have its hooks in the send path */ - int (*process_pio_send)(struct hfi1_qp *qp, struct ahg_ib_header *ibhdr, - u32 hdrwords, struct hfi1_sge_state *ss, - u32 len, u32 plen, u32 dwords, u64 pbc); - int (*process_dma_send)(struct hfi1_qp *qp, struct ahg_ib_header *ibhdr, - u32 hdrwords, struct hfi1_sge_state *ss, - u32 len, u32 plen, u32 dwords, u64 pbc); + int (*process_pio_send)(struct hfi1_qp *qp, struct hfi1_pkt_state *ps, + u64 pbc); + int (*process_dma_send)(struct hfi1_qp *qp, struct hfi1_pkt_state *ps, + u64 pbc); void (*pio_inline_send)(struct hfi1_devdata *dd, struct pio_buf *pbuf, u64 pbc, const void *from, size_t count); @@ -1405,12 +1403,10 @@ void reset_link_credits(struct hfi1_devdata *dd); void assign_remote_cm_au_table(struct hfi1_devdata *dd, u8 vcu); int snoop_recv_handler(struct hfi1_packet *packet); -int snoop_send_dma_handler(struct hfi1_qp *qp, struct ahg_ib_header *ibhdr, - u32 hdrwords, struct hfi1_sge_state *ss, u32 len, - u32 plen, u32 dwords, u64 pbc); -int snoop_send_pio_handler(struct hfi1_qp *qp, struct ahg_ib_header *ibhdr, - u32 hdrwords, struct hfi1_sge_state *ss, u32 len, - u32 plen, u32 dwords, u64 pbc); +int snoop_send_dma_handler(struct hfi1_qp *qp, struct hfi1_pkt_state *ps, + u64 pbc); +int snoop_send_pio_handler(struct hfi1_qp *qp, struct hfi1_pkt_state *ps, + u64 pbc); void snoop_inline_pio_send(struct hfi1_devdata *dd, struct pio_buf *pbuf, u64 pbc, const void *from, size_t count); diff --git a/drivers/staging/rdma/hfi1/ruc.c b/drivers/staging/rdma/hfi1/ruc.c index 863092bb0684..317bf6ff46a8 100644 --- a/drivers/staging/rdma/hfi1/ruc.c +++ b/drivers/staging/rdma/hfi1/ruc.c @@ -809,16 +809,20 @@ void hfi1_do_send(struct work_struct *work) { struct iowait *wait = container_of(work, struct iowait, iowork); struct hfi1_qp *qp = container_of(wait, struct hfi1_qp, s_iowait); - struct hfi1_ibport *ibp = to_iport(qp->ibqp.device, qp->port_num); - struct hfi1_pportdata *ppd = ppd_from_ibp(ibp); + struct hfi1_pkt_state ps; int (*make_req)(struct hfi1_qp *qp); unsigned long flags; unsigned long timeout; + ps.dev = to_idev(qp->ibqp.device); + ps.ibp = to_iport(qp->ibqp.device, qp->port_num); + ps.ppd = ppd_from_ibp(ps.ibp); + if ((qp->ibqp.qp_type == IB_QPT_RC || qp->ibqp.qp_type == IB_QPT_UC) && !loopback && - (qp->remote_ah_attr.dlid & ~((1 << ppd->lmc) - 1)) == ppd->lid) { + (qp->remote_ah_attr.dlid & ~((1 << ps.ppd->lmc) - 1)) == + ps.ppd->lid) { ruc_loopback(qp); return; } @@ -850,8 +854,7 @@ void hfi1_do_send(struct work_struct *work) * If the packet cannot be sent now, return and * the send tasklet will be woken up later. */ - if (hfi1_verbs_send(qp, qp->s_hdr, qp->s_hdrwords, - qp->s_cur_sge, qp->s_cur_size)) + if (hfi1_verbs_send(qp, &ps)) break; /* Record that s_hdr is empty. */ qp->s_hdrwords = 0; @@ -860,7 +863,7 @@ void hfi1_do_send(struct work_struct *work) /* allow other tasks to run */ if (unlikely(time_after(jiffies, timeout))) { cond_resched(); - ppd->dd->verbs_dev.n_send_schedule++; + ps.ppd->dd->verbs_dev.n_send_schedule++; timeout = jiffies + SEND_RESCHED_TIMEOUT; } } while (make_req(qp)); diff --git a/drivers/staging/rdma/hfi1/verbs.c b/drivers/staging/rdma/hfi1/verbs.c index 296b7cbf39a9..ef0feaa684a4 100644 --- a/drivers/staging/rdma/hfi1/verbs.c +++ b/drivers/staging/rdma/hfi1/verbs.c @@ -1001,13 +1001,16 @@ bail_txadd: return ret; } -int hfi1_verbs_send_dma(struct hfi1_qp *qp, struct ahg_ib_header *ahdr, - u32 hdrwords, struct hfi1_sge_state *ss, u32 len, - u32 plen, u32 dwords, u64 pbc) +int hfi1_verbs_send_dma(struct hfi1_qp *qp, struct hfi1_pkt_state *ps, + u64 pbc) { - struct hfi1_ibdev *dev = to_idev(qp->ibqp.device); - struct hfi1_ibport *ibp = to_iport(qp->ibqp.device, qp->port_num); - struct hfi1_pportdata *ppd = ppd_from_ibp(ibp); + struct ahg_ib_header *ahdr = qp->s_hdr; + u32 hdrwords = qp->s_hdrwords; + struct hfi1_sge_state *ss = qp->s_cur_sge; + u32 len = qp->s_cur_size; + u32 plen = hdrwords + ((len + 3) >> 2) + 2; /* includes pbc */ + struct hfi1_ibdev *dev = ps->dev; + struct hfi1_pportdata *ppd = ps->ppd; struct verbs_txreq *tx; struct sdma_txreq *stx; u64 pbc_flags = 0; @@ -1120,12 +1123,16 @@ struct send_context *qp_to_send_context(struct hfi1_qp *qp, u8 sc5) return dd->vld[vl].sc; } -int hfi1_verbs_send_pio(struct hfi1_qp *qp, struct ahg_ib_header *ahdr, - u32 hdrwords, struct hfi1_sge_state *ss, u32 len, - u32 plen, u32 dwords, u64 pbc) +int hfi1_verbs_send_pio(struct hfi1_qp *qp, struct hfi1_pkt_state *ps, + u64 pbc) { - struct hfi1_ibport *ibp = to_iport(qp->ibqp.device, qp->port_num); - struct hfi1_pportdata *ppd = ppd_from_ibp(ibp); + struct ahg_ib_header *ahdr = qp->s_hdr; + u32 hdrwords = qp->s_hdrwords; + struct hfi1_sge_state *ss = qp->s_cur_sge; + u32 len = qp->s_cur_size; + u32 dwords = (len + 3) >> 2; + u32 plen = hdrwords + dwords + 2; /* includes pbc */ + struct hfi1_pportdata *ppd = ps->ppd; u32 *hdr = (u32 *)&ahdr->ibh; u64 pbc_flags = 0; u32 sc5; @@ -1297,23 +1304,18 @@ bad: /** * hfi1_verbs_send - send a packet * @qp: the QP to send on - * @ahdr: the packet header - * @hdrwords: the number of 32-bit words in the header - * @ss: the SGE to send - * @len: the length of the packet in bytes + * @ps: the state of the packet to send * * Return zero if packet is sent or queued OK. * Return non-zero and clear qp->s_flags HFI1_S_BUSY otherwise. */ -int hfi1_verbs_send(struct hfi1_qp *qp, struct ahg_ib_header *ahdr, - u32 hdrwords, struct hfi1_sge_state *ss, u32 len) +int hfi1_verbs_send(struct hfi1_qp *qp, struct hfi1_pkt_state *ps) { struct hfi1_devdata *dd = dd_from_ibdev(qp->ibqp.device); - u32 plen; + struct ahg_ib_header *ahdr = qp->s_hdr; int ret; int pio = 0; unsigned long flags = 0; - u32 dwords = (len + 3) >> 2; /* * VL15 packets (IB_QPT_SMI) will always use PIO, so we @@ -1344,23 +1346,16 @@ int hfi1_verbs_send(struct hfi1_qp *qp, struct ahg_ib_header *ahdr, return -EINVAL; } - /* - * Calculate the send buffer trigger address. - * The +2 counts for the pbc control qword - */ - plen = hdrwords + dwords + 2; - if (pio) { - ret = dd->process_pio_send( - qp, ahdr, hdrwords, ss, len, plen, dwords, 0); + ret = dd->process_pio_send(qp, ps, 0); } else { #ifdef CONFIG_SDMA_VERBOSITY dd_dev_err(dd, "CONFIG SDMA %s:%d %s()\n", slashstrip(__FILE__), __LINE__, __func__); - dd_dev_err(dd, "SDMA hdrwords = %u, len = %u\n", hdrwords, len); + dd_dev_err(dd, "SDMA hdrwords = %u, len = %u\n", qp->s_hdrwords, + qp->s_cur_size); #endif - ret = dd->process_dma_send( - qp, ahdr, hdrwords, ss, len, plen, dwords, 0); + ret = dd->process_dma_send(qp, ps, 0); } return ret; diff --git a/drivers/staging/rdma/hfi1/verbs.h b/drivers/staging/rdma/hfi1/verbs.h index cdc844f56c6b..7e27531c430a 100644 --- a/drivers/staging/rdma/hfi1/verbs.h +++ b/drivers/staging/rdma/hfi1/verbs.h @@ -545,6 +545,16 @@ struct hfi1_qp { ____cacheline_aligned_in_smp; }; +/* + * This structure is used to hold commonly lookedup and computed values during + * the send engine progress. + */ +struct hfi1_pkt_state { + struct hfi1_ibdev *dev; + struct hfi1_ibport *ibp; + struct hfi1_pportdata *ppd; +}; + /* * Atomic bit definitions for r_aflags. */ @@ -930,8 +940,7 @@ int hfi1_mcast_tree_empty(struct hfi1_ibport *ibp); struct verbs_txreq; void hfi1_put_txreq(struct verbs_txreq *tx); -int hfi1_verbs_send(struct hfi1_qp *qp, struct ahg_ib_header *ahdr, - u32 hdrwords, struct hfi1_sge_state *ss, u32 len); +int hfi1_verbs_send(struct hfi1_qp *qp, struct hfi1_pkt_state *ps); void hfi1_copy_sge(struct hfi1_sge_state *ss, void *data, u32 length, int release); @@ -1102,13 +1111,11 @@ void hfi1_ib_rcv(struct hfi1_packet *packet); unsigned hfi1_get_npkeys(struct hfi1_devdata *); -int hfi1_verbs_send_dma(struct hfi1_qp *qp, struct ahg_ib_header *hdr, - u32 hdrwords, struct hfi1_sge_state *ss, u32 len, - u32 plen, u32 dwords, u64 pbc); +int hfi1_verbs_send_dma(struct hfi1_qp *qp, struct hfi1_pkt_state *ps, + u64 pbc); -int hfi1_verbs_send_pio(struct hfi1_qp *qp, struct ahg_ib_header *hdr, - u32 hdrwords, struct hfi1_sge_state *ss, u32 len, - u32 plen, u32 dwords, u64 pbc); +int hfi1_verbs_send_pio(struct hfi1_qp *qp, struct hfi1_pkt_state *ps, + u64 pbc); struct send_context *qp_to_send_context(struct hfi1_qp *qp, u8 sc5); From 82c2611daaf010500720a569ca733d216d81968e Mon Sep 17 00:00:00 2001 From: Niranjana Vishwanathapura Date: Wed, 11 Nov 2015 00:35:19 -0500 Subject: [PATCH 456/843] staging/rdma/hfi1: Handle packets with invalid RHF on context 0 Context 0 (which handles the error packets) can potentially receive an invalid rhf. Hence, it can not depend on RHF sequence number and can only use DMA_RTAIL mechanism. Detect such packets with invalid rhf using rhf sequence counting mechanism and drop them. As DMA_RTAIL mechanism has performance penalties, do not use context 0 for performance critical verbs path. Use context 0 for VL15 (MAD), multicast and error packets. Reviewed-by: Arthur Kepner Reviewed-by: Mike Marciniszyn Reviewed-by: Dennis Dalessandro Reviewed-by: Dean Luick Reviewed-by: Mitko Haralanov Signed-off-by: Niranjana Vishwanathapura Signed-off-by: Mike Marciniszyn Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/chip.c | 74 ++++++++++---------- drivers/staging/rdma/hfi1/driver.c | 108 +++++++++++++++++++++++++---- drivers/staging/rdma/hfi1/hfi.h | 8 ++- drivers/staging/rdma/hfi1/init.c | 9 ++- 4 files changed, 146 insertions(+), 53 deletions(-) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index 456704e9629a..dc6915947c78 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -121,8 +121,8 @@ struct flag_table { #define SEC_SC_HALTED 0x4 /* per-context only */ #define SEC_SPC_FREEZE 0x8 /* per-HFI only */ -#define VL15CTXT 1 #define MIN_KERNEL_KCTXTS 2 +#define FIRST_KERNEL_KCTXT 1 #define NUM_MAP_REGS 32 /* Bit offset into the GUID which carries HFI id information */ @@ -7780,8 +7780,8 @@ void hfi1_rcvctrl(struct hfi1_devdata *dd, unsigned int op, int ctxt) & RCV_TID_CTRL_TID_BASE_INDEX_MASK) << RCV_TID_CTRL_TID_BASE_INDEX_SHIFT); write_kctxt_csr(dd, ctxt, RCV_TID_CTRL, reg); - if (ctxt == VL15CTXT) - write_csr(dd, RCV_VL15, VL15CTXT); + if (ctxt == HFI1_CTRL_CTXT) + write_csr(dd, RCV_VL15, HFI1_CTRL_CTXT); } if (op & HFI1_RCVCTRL_CTXT_DIS) { write_csr(dd, RCV_VL15, 0); @@ -8908,7 +8908,7 @@ static int request_msix_irqs(struct hfi1_devdata *dd) int first_general, last_general; int first_sdma, last_sdma; int first_rx, last_rx; - int first_cpu, restart_cpu, curr_cpu; + int first_cpu, curr_cpu; int rcv_cpu, sdma_cpu; int i, ret = 0, possible; int ht; @@ -8947,22 +8947,19 @@ static int request_msix_irqs(struct hfi1_devdata *dd) topology_sibling_cpumask(cpumask_first(local_mask))); for (i = possible/ht; i < possible; i++) cpumask_clear_cpu(i, def); - /* reset possible */ - possible = cpumask_weight(def); /* def now has full cores on chosen node*/ first_cpu = cpumask_first(def); if (nr_cpu_ids >= first_cpu) first_cpu++; - restart_cpu = first_cpu; - curr_cpu = restart_cpu; + curr_cpu = first_cpu; - for (i = first_cpu; i < dd->n_krcv_queues + first_cpu; i++) { + /* One context is reserved as control context */ + for (i = first_cpu; i < dd->n_krcv_queues + first_cpu - 1; i++) { cpumask_clear_cpu(curr_cpu, def); cpumask_set_cpu(curr_cpu, rcv); - if (curr_cpu >= possible) - curr_cpu = restart_cpu; - else - curr_cpu++; + curr_cpu = cpumask_next(curr_cpu, def); + if (curr_cpu >= nr_cpu_ids) + break; } /* def mask has non-rcv, rcv has recv mask */ rcv_cpu = cpumask_first(rcv); @@ -9062,12 +9059,20 @@ static int request_msix_irqs(struct hfi1_devdata *dd) if (sdma_cpu >= nr_cpu_ids) sdma_cpu = cpumask_first(def); } else if (handler == receive_context_interrupt) { - dd_dev_info(dd, "rcv ctxt %d cpu %d\n", - rcd->ctxt, rcv_cpu); - cpumask_set_cpu(rcv_cpu, dd->msix_entries[i].mask); - rcv_cpu = cpumask_next(rcv_cpu, rcv); - if (rcv_cpu >= nr_cpu_ids) - rcv_cpu = cpumask_first(rcv); + dd_dev_info(dd, "rcv ctxt %d cpu %d\n", rcd->ctxt, + (rcd->ctxt == HFI1_CTRL_CTXT) ? + cpumask_first(def) : rcv_cpu); + if (rcd->ctxt == HFI1_CTRL_CTXT) { + /* map to first default */ + cpumask_set_cpu(cpumask_first(def), + dd->msix_entries[i].mask); + } else { + cpumask_set_cpu(rcv_cpu, + dd->msix_entries[i].mask); + rcv_cpu = cpumask_next(rcv_cpu, rcv); + if (rcv_cpu >= nr_cpu_ids) + rcv_cpu = cpumask_first(rcv); + } } else { /* otherwise first def */ dd_dev_info(dd, "%s cpu %d\n", @@ -9200,11 +9205,18 @@ static int set_up_context_variables(struct hfi1_devdata *dd) /* * Kernel contexts: (to be fixed later): * - min or 2 or 1 context/numa - * - Context 0 - default/errors - * - Context 1 - VL15 + * - Context 0 - control context (VL15/multicast/error) + * - Context 1 - default context */ if (n_krcvqs) - num_kernel_contexts = n_krcvqs + MIN_KERNEL_KCTXTS; + /* + * Don't count context 0 in n_krcvqs since + * is isn't used for normal verbs traffic. + * + * krcvqs will reflect number of kernel + * receive contexts above 0. + */ + num_kernel_contexts = n_krcvqs + MIN_KERNEL_KCTXTS - 1; else num_kernel_contexts = num_online_nodes(); num_kernel_contexts = @@ -10053,12 +10065,6 @@ static void init_qpmap_table(struct hfi1_devdata *dd, u64 ctxt = first_ctxt; for (i = 0; i < 256;) { - if (ctxt == VL15CTXT) { - ctxt++; - if (ctxt > last_ctxt) - ctxt = first_ctxt; - continue; - } reg |= ctxt << (8 * (i % 8)); i++; ctxt++; @@ -10171,19 +10177,13 @@ static void init_qos(struct hfi1_devdata *dd, u32 first_ctxt) /* Enable RSM */ add_rcvctrl(dd, RCV_CTRL_RCV_RSM_ENABLE_SMASK); kfree(rsmmap); - /* map everything else (non-VL15) to context 0 */ - init_qpmap_table( - dd, - 0, - 0); + /* map everything else to first context */ + init_qpmap_table(dd, FIRST_KERNEL_KCTXT, MIN_KERNEL_KCTXTS - 1); dd->qos_shift = n + 1; return; bail: dd->qos_shift = 1; - init_qpmap_table( - dd, - dd->n_krcv_queues > MIN_KERNEL_KCTXTS ? MIN_KERNEL_KCTXTS : 0, - dd->n_krcv_queues - 1); + init_qpmap_table(dd, FIRST_KERNEL_KCTXT, dd->n_krcv_queues - 1); } static void init_rxe(struct hfi1_devdata *dd) diff --git a/drivers/staging/rdma/hfi1/driver.c b/drivers/staging/rdma/hfi1/driver.c index 487d58778d70..4c52e785de68 100644 --- a/drivers/staging/rdma/hfi1/driver.c +++ b/drivers/staging/rdma/hfi1/driver.c @@ -509,28 +509,49 @@ static inline void init_ps_mdata(struct ps_mdata *mdata, mdata->maxcnt = packet->maxcnt; mdata->ps_head = packet->rhqoff; - if (HFI1_CAP_IS_KSET(DMA_RTAIL)) { + if (HFI1_CAP_KGET_MASK(rcd->flags, DMA_RTAIL)) { mdata->ps_tail = get_rcvhdrtail(rcd); - mdata->ps_seq = 0; /* not used with DMA_RTAIL */ + if (rcd->ctxt == HFI1_CTRL_CTXT) + mdata->ps_seq = rcd->seq_cnt; + else + mdata->ps_seq = 0; /* not used with DMA_RTAIL */ } else { mdata->ps_tail = 0; /* used only with DMA_RTAIL*/ mdata->ps_seq = rcd->seq_cnt; } } -static inline int ps_done(struct ps_mdata *mdata, u64 rhf) +static inline int ps_done(struct ps_mdata *mdata, u64 rhf, + struct hfi1_ctxtdata *rcd) { - if (HFI1_CAP_IS_KSET(DMA_RTAIL)) + if (HFI1_CAP_KGET_MASK(rcd->flags, DMA_RTAIL)) return mdata->ps_head == mdata->ps_tail; return mdata->ps_seq != rhf_rcv_seq(rhf); } -static inline void update_ps_mdata(struct ps_mdata *mdata) +static inline int ps_skip(struct ps_mdata *mdata, u64 rhf, + struct hfi1_ctxtdata *rcd) +{ + /* + * Control context can potentially receive an invalid rhf. + * Drop such packets. + */ + if ((rcd->ctxt == HFI1_CTRL_CTXT) && (mdata->ps_head != mdata->ps_tail)) + return mdata->ps_seq != rhf_rcv_seq(rhf); + + return 0; +} + +static inline void update_ps_mdata(struct ps_mdata *mdata, + struct hfi1_ctxtdata *rcd) { mdata->ps_head += mdata->rsize; if (mdata->ps_head >= mdata->maxcnt) mdata->ps_head = 0; - if (!HFI1_CAP_IS_KSET(DMA_RTAIL)) { + + /* Control context must do seq counting */ + if (!HFI1_CAP_KGET_MASK(rcd->flags, DMA_RTAIL) || + (rcd->ctxt == HFI1_CTRL_CTXT)) { if (++mdata->ps_seq > 13) mdata->ps_seq = 1; } @@ -566,9 +587,12 @@ static void prescan_rxq(struct hfi1_packet *packet) int is_ecn = 0; u8 lnh; - if (ps_done(&mdata, rhf)) + if (ps_done(&mdata, rhf, rcd)) break; + if (ps_skip(&mdata, rhf, rcd)) + goto next; + if (etype != RHF_RCV_TYPE_IB) goto next; @@ -606,9 +630,35 @@ static void prescan_rxq(struct hfi1_packet *packet) bth1 &= ~(HFI1_FECN_SMASK | HFI1_BECN_SMASK); ohdr->bth[1] = cpu_to_be32(bth1); next: - update_ps_mdata(&mdata); + update_ps_mdata(&mdata, rcd); } } + +static inline int skip_rcv_packet(struct hfi1_packet *packet, int thread) +{ + int ret = RCV_PKT_OK; + + /* Set up for the next packet */ + packet->rhqoff += packet->rsize; + if (packet->rhqoff >= packet->maxcnt) + packet->rhqoff = 0; + + packet->numpkt++; + if (unlikely((packet->numpkt & (MAX_PKT_RECV - 1)) == 0)) { + if (thread) { + cond_resched(); + } else { + ret = RCV_PKT_LIMIT; + this_cpu_inc(*packet->rcd->dd->rcv_limit); + } + } + + packet->rhf_addr = (__le32 *)packet->rcd->rcvhdrq + packet->rhqoff + + packet->rcd->dd->rhf_offset; + packet->rhf = rhf_to_cpu(packet->rhf_addr); + + return ret; +} #endif /* CONFIG_PRESCAN_RXQ */ static inline int process_rcv_packet(struct hfi1_packet *packet, int thread) @@ -784,7 +834,6 @@ int handle_receive_interrupt_dma_rtail(struct hfi1_ctxtdata *rcd, int thread) while (last == RCV_PKT_OK) { last = process_rcv_packet(&packet, thread); - hdrqtail = get_rcvhdrtail(rcd); if (packet.rhqoff == hdrqtail) last = RCV_PKT_DONE; process_rcv_update(last, &packet); @@ -799,7 +848,7 @@ static inline void set_all_nodma_rtail(struct hfi1_devdata *dd) { int i; - for (i = 0; i < dd->first_user_ctxt; i++) + for (i = HFI1_CTRL_CTXT + 1; i < dd->first_user_ctxt; i++) dd->rcd[i]->do_interrupt = &handle_receive_interrupt_nodma_rtail; } @@ -808,7 +857,7 @@ static inline void set_all_dma_rtail(struct hfi1_devdata *dd) { int i; - for (i = 0; i < dd->first_user_ctxt; i++) + for (i = HFI1_CTRL_CTXT + 1; i < dd->first_user_ctxt; i++) dd->rcd[i]->do_interrupt = &handle_receive_interrupt_dma_rtail; } @@ -824,12 +873,16 @@ int handle_receive_interrupt(struct hfi1_ctxtdata *rcd, int thread) { struct hfi1_devdata *dd = rcd->dd; u32 hdrqtail; - int last = RCV_PKT_OK, needset = 1; + int needset, last = RCV_PKT_OK; struct hfi1_packet packet; + int skip_pkt = 0; + + /* Control context will always use the slow path interrupt handler */ + needset = (rcd->ctxt == HFI1_CTRL_CTXT) ? 0 : 1; init_packet(rcd, &packet); - if (!HFI1_CAP_IS_KSET(DMA_RTAIL)) { + if (!HFI1_CAP_KGET_MASK(rcd->flags, DMA_RTAIL)) { u32 seq = rhf_rcv_seq(packet.rhf); if (seq != rcd->seq_cnt) { @@ -844,6 +897,17 @@ int handle_receive_interrupt(struct hfi1_ctxtdata *rcd, int thread) goto bail; } smp_rmb(); /* prevent speculative reads of dma'ed hdrq */ + + /* + * Control context can potentially receive an invalid + * rhf. Drop such packets. + */ + if (rcd->ctxt == HFI1_CTRL_CTXT) { + u32 seq = rhf_rcv_seq(packet.rhf); + + if (seq != rcd->seq_cnt) + skip_pkt = 1; + } } prescan_rxq(&packet); @@ -861,11 +925,14 @@ int handle_receive_interrupt(struct hfi1_ctxtdata *rcd, int thread) dd->rhf_offset; packet.rhf = rhf_to_cpu(packet.rhf_addr); + } else if (skip_pkt) { + last = skip_rcv_packet(&packet, thread); + skip_pkt = 0; } else { last = process_rcv_packet(&packet, thread); } - if (!HFI1_CAP_IS_KSET(DMA_RTAIL)) { + if (!HFI1_CAP_KGET_MASK(rcd->flags, DMA_RTAIL)) { u32 seq = rhf_rcv_seq(packet.rhf); if (++rcd->seq_cnt > 13) @@ -881,6 +948,19 @@ int handle_receive_interrupt(struct hfi1_ctxtdata *rcd, int thread) } else { if (packet.rhqoff == hdrqtail) last = RCV_PKT_DONE; + /* + * Control context can potentially receive an invalid + * rhf. Drop such packets. + */ + if (rcd->ctxt == HFI1_CTRL_CTXT) { + u32 seq = rhf_rcv_seq(packet.rhf); + + if (++rcd->seq_cnt > 13) + rcd->seq_cnt = 1; + if (!last && (seq != rcd->seq_cnt)) + skip_pkt = 1; + } + if (needset) { dd_dev_info(dd, "Switching to DMA_RTAIL\n"); diff --git a/drivers/staging/rdma/hfi1/hfi.h b/drivers/staging/rdma/hfi1/hfi.h index b048cf6960d9..54ed6b36c1a7 100644 --- a/drivers/staging/rdma/hfi1/hfi.h +++ b/drivers/staging/rdma/hfi1/hfi.h @@ -99,6 +99,12 @@ extern unsigned long hfi1_cap_mask; #define HFI1_MISC_GET() ((hfi1_cap_mask >> HFI1_CAP_MISC_SHIFT) & \ HFI1_CAP_MISC_MASK) +/* + * Control context is always 0 and handles the error packets. + * It also handles the VL15 and multicast packets. + */ +#define HFI1_CTRL_CTXT 0 + /* * per driver stats, either not device nor port-specific, or * summed over all of the devices and ports. @@ -234,7 +240,7 @@ struct hfi1_ctxtdata { /* chip offset of PIO buffers for this ctxt */ u32 piobufs; /* per-context configuration flags */ - u16 flags; + u32 flags; /* per-context event flags for fileops/intr communication */ unsigned long event_flags; /* WAIT_RCV that timed out, no interrupt */ diff --git a/drivers/staging/rdma/hfi1/init.c b/drivers/staging/rdma/hfi1/init.c index c17cef6938fb..1c8286f4c00c 100644 --- a/drivers/staging/rdma/hfi1/init.c +++ b/drivers/staging/rdma/hfi1/init.c @@ -90,7 +90,7 @@ MODULE_PARM_DESC( u8 krcvqs[RXE_NUM_DATA_VL]; int krcvqsset; module_param_array(krcvqs, byte, &krcvqsset, S_IRUGO); -MODULE_PARM_DESC(krcvqs, "Array of the number of kernel receive queues by VL"); +MODULE_PARM_DESC(krcvqs, "Array of the number of non-control kernel receive queues by VL"); /* computed based on above array */ unsigned n_krcvqs; @@ -130,6 +130,9 @@ int hfi1_create_ctxts(struct hfi1_devdata *dd) int ret; int local_node_id = pcibus_to_node(dd->pcidev->bus); + /* Control context has to be always 0 */ + BUILD_BUG_ON(HFI1_CTRL_CTXT != 0); + if (local_node_id < 0) local_node_id = numa_node_id(); dd->assigned_node_id = local_node_id; @@ -159,6 +162,10 @@ int hfi1_create_ctxts(struct hfi1_devdata *dd) HFI1_CAP_KGET(NODROP_RHQ_FULL) | HFI1_CAP_KGET(NODROP_EGR_FULL) | HFI1_CAP_KGET(DMA_RTAIL); + + /* Control context must use DMA_RTAIL */ + if (rcd->ctxt == HFI1_CTRL_CTXT) + rcd->flags |= HFI1_CAP_DMA_RTAIL; rcd->seq_cnt = 1; rcd->sc = sc_alloc(dd, SC_ACK, rcd->rcvhdrqentsize, dd->node); From b26baffbc91693c9a3b81704a4870a474f169871 Mon Sep 17 00:00:00 2001 From: Anjali Menon Date: Mon, 16 Nov 2015 22:49:19 +0530 Subject: [PATCH 457/843] staging: rdma: ehca: Added a blank line Added a blank line after declarations to remove the coding style error detected by the checkpatch.pl. WARNING: Missing a blank line after declarations Signed-off-by: Anjali Menon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/ehca/ehca_av.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/rdma/ehca/ehca_av.c b/drivers/staging/rdma/ehca/ehca_av.c index 465926319f3d..fd7b6d044ec1 100644 --- a/drivers/staging/rdma/ehca/ehca_av.c +++ b/drivers/staging/rdma/ehca/ehca_av.c @@ -105,6 +105,7 @@ struct ib_ah *ehca_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr) if (ehca_static_rate < 0) { u32 ipd; + if (ehca_calc_ipd(shca, ah_attr->port_num, ah_attr->static_rate, &ipd)) { ret = -EINVAL; @@ -128,6 +129,7 @@ struct ib_ah *ehca_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr) int rc; struct ib_port_attr port_attr; union ib_gid gid; + memset(&port_attr, 0, sizeof(port_attr)); rc = ehca_query_port(pd->device, ah_attr->port_num, &port_attr); @@ -192,6 +194,7 @@ int ehca_modify_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr) int rc; struct ib_port_attr port_attr; union ib_gid gid; + memset(&port_attr, 0, sizeof(port_attr)); rc = ehca_query_port(ah->device, ah_attr->port_num, &port_attr); From 8ffedc1b128af336ab650cef4883015d1c49269d Mon Sep 17 00:00:00 2001 From: Dragos Bogdan Date: Wed, 18 Nov 2015 16:16:34 +0200 Subject: [PATCH 458/843] staging:iio:ad7780: Remove the ad7780_platform_data The ad7780_platform_data contains just the reference voltage information. Since the preferred way of specifying this information is using the Linux regulator framework and the ad7780 platform_data is not used by other users, it can be completely removed. Signed-off-by: Dragos Bogdan Acked-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- drivers/staging/iio/adc/ad7780.c | 9 ++------- drivers/staging/iio/adc/ad7780.h | 29 ----------------------------- 2 files changed, 2 insertions(+), 36 deletions(-) delete mode 100644 drivers/staging/iio/adc/ad7780.h diff --git a/drivers/staging/iio/adc/ad7780.c b/drivers/staging/iio/adc/ad7780.c index 98b5fc492eff..498e86b71ae7 100644 --- a/drivers/staging/iio/adc/ad7780.c +++ b/drivers/staging/iio/adc/ad7780.c @@ -22,8 +22,6 @@ #include #include -#include "ad7780.h" - #define AD7780_RDY BIT(7) #define AD7780_FILTER BIT(6) #define AD7780_ERR BIT(5) @@ -162,7 +160,6 @@ static const struct iio_info ad7780_info = { static int ad7780_probe(struct spi_device *spi) { - struct ad7780_platform_data *pdata = spi->dev.platform_data; struct ad7780_state *st; struct iio_dev *indio_dev; int ret, voltage_uv = 0; @@ -188,12 +185,10 @@ static int ad7780_probe(struct spi_device *spi) st->chip_info = &ad7780_chip_info_tbl[spi_get_device_id(spi)->driver_data]; - if (pdata && pdata->vref_mv) - st->int_vref_mv = pdata->vref_mv; - else if (voltage_uv) + if (voltage_uv) st->int_vref_mv = voltage_uv / 1000; else - dev_warn(&spi->dev, "reference voltage unspecified\n"); + dev_warn(&spi->dev, "Reference voltage unspecified\n"); spi_set_drvdata(spi, indio_dev); diff --git a/drivers/staging/iio/adc/ad7780.h b/drivers/staging/iio/adc/ad7780.h deleted file mode 100644 index 46f61c9e798e..000000000000 --- a/drivers/staging/iio/adc/ad7780.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * AD7780/AD7781 SPI ADC driver - * - * Copyright 2011 Analog Devices Inc. - * - * Licensed under the GPL-2. - */ -#ifndef IIO_ADC_AD7780_H_ -#define IIO_ADC_AD7780_H_ - -/* - * TODO: struct ad7780_platform_data needs to go into include/linux/iio - */ - -/* NOTE: - * The AD7780 doesn't feature a dedicated SPI chip select, in addition it - * features a dual use data out ready DOUT/RDY output. - * In order to avoid contentions on the SPI bus, it's therefore necessary - * to use spi bus locking combined with a dedicated GPIO to control the - * power down reset signal of the AD7780. - * - * The DOUT/RDY output must also be wired to an interrupt capable GPIO. - */ - -struct ad7780_platform_data { - u16 vref_mv; -}; - -#endif /* IIO_ADC_AD7780_H_ */ From 438f13a283e776957779e9beb0503100801ea84f Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Sat, 21 Nov 2015 18:20:06 +0000 Subject: [PATCH 459/843] staging:iio: Delete some commented out lines in Kconfig and Makefile. These should have been removed with the driver move out of staging but instead were commented out. This was missed in reviews at the time so fixing it up now. Signed-off-by: Jonathan Cameron --- drivers/staging/iio/Kconfig | 28 ---------------------------- drivers/staging/iio/Makefile | 7 ------- 2 files changed, 35 deletions(-) diff --git a/drivers/staging/iio/Kconfig b/drivers/staging/iio/Kconfig index 85de1985df8e..0e044cb0def8 100644 --- a/drivers/staging/iio/Kconfig +++ b/drivers/staging/iio/Kconfig @@ -17,32 +17,4 @@ source "drivers/staging/iio/meter/Kconfig" source "drivers/staging/iio/resolver/Kconfig" source "drivers/staging/iio/trigger/Kconfig" -#config IIO_DUMMY_EVGEN -# tristate -# -#config IIO_SIMPLE_DUMMY -# tristate "An example driver with no hardware requirements" -# help -# Driver intended mainly as documentation for how to write -# a driver. May also be useful for testing userspace code -# without hardware. - -#if IIO_SIMPLE_DUMMY - -#config IIO_SIMPLE_DUMMY_EVENTS -# bool "Event generation support" -# select IIO_DUMMY_EVGEN -# help -# Add some dummy events to the simple dummy driver. - -#config IIO_SIMPLE_DUMMY_BUFFER -# bool "Buffered capture support" -# select IIO_BUFFER -# select IIO_TRIGGER -# select IIO_KFIFO_BUF -# help -# Add buffered data capture to the simple dummy driver. - -#endif # IIO_SIMPLE_DUMMY - endmenu diff --git a/drivers/staging/iio/Makefile b/drivers/staging/iio/Makefile index 355824ab733b..3e616b4437f5 100644 --- a/drivers/staging/iio/Makefile +++ b/drivers/staging/iio/Makefile @@ -2,13 +2,6 @@ # Makefile for the industrial I/O core. # -#obj-$(CONFIG_IIO_SIMPLE_DUMMY) += iio_dummy.o -#iio_dummy-y := iio_simple_dummy.o -#iio_dummy-$(CONFIG_IIO_SIMPLE_DUMMY_EVENTS) += iio_simple_dummy_events.o -#iio_dummy-$(CONFIG_IIO_SIMPLE_DUMMY_BUFFER) += iio_simple_dummy_buffer.o - -#obj-$(CONFIG_IIO_DUMMY_EVGEN) += iio_dummy_evgen.o - obj-y += accel/ obj-y += adc/ obj-y += addac/ From 3fba9b5ff837ed57a993e98245378c30911ab4ee Mon Sep 17 00:00:00 2001 From: Nizam Haider Date: Mon, 16 Nov 2015 05:35:57 +0530 Subject: [PATCH 460/843] IIO: adc: at91_adc.c Prefer kmalloc_array over kmalloc with multiply So this patch swaps that use out for kmalloc_array instead. Signed-off-by Nizam Haider Signed-off-by: Jonathan Cameron --- drivers/iio/adc/at91_adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index 7b40925dd4ff..f284cd6a93d6 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c @@ -742,7 +742,7 @@ static int at91_adc_of_get_resolution(struct at91_adc_state *st, return count; } - resolutions = kmalloc(count * sizeof(*resolutions), GFP_KERNEL); + resolutions = kmalloc_array(count, sizeof(*resolutions), GFP_KERNEL); if (!resolutions) return -ENOMEM; From 4ac4e086fd8c59e6b69089e6f7605500b63a6d17 Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Sun, 15 Nov 2015 17:20:05 -0800 Subject: [PATCH 461/843] iio: pulsedlight-lidar-lite: add runtime PM Add runtime PM support for the lidar-lite module to enable low power mode when last device requested reading is over a second. Signed-off-by: Matt Ranostay Signed-off-by: Jonathan Cameron --- .../iio/proximity/pulsedlight-lidar-lite-v2.c | 56 ++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c index 961f9f990faf..be8ccef735f8 100644 --- a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +++ b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c @@ -13,7 +13,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * TODO: runtime pm, interrupt mode, and signal strength reporting + * TODO: interrupt mode, and signal strength reporting */ #include @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -37,6 +38,7 @@ #define LIDAR_REG_DATA_HBYTE 0x0f #define LIDAR_REG_DATA_LBYTE 0x10 +#define LIDAR_REG_PWR_CONTROL 0x65 #define LIDAR_DRV_NAME "lidar" @@ -90,6 +92,12 @@ static inline int lidar_write_control(struct lidar_data *data, int val) return i2c_smbus_write_byte_data(data->client, LIDAR_REG_CONTROL, val); } +static inline int lidar_write_power(struct lidar_data *data, int val) +{ + return i2c_smbus_write_byte_data(data->client, + LIDAR_REG_PWR_CONTROL, val); +} + static int lidar_read_measurement(struct lidar_data *data, u16 *reg) { int ret; @@ -116,6 +124,8 @@ static int lidar_get_measurement(struct lidar_data *data, u16 *reg) int tries = 10; int ret; + pm_runtime_get_sync(&client->dev); + /* start sample */ ret = lidar_write_control(data, LIDAR_REG_CONTROL_ACQUIRE); if (ret < 0) { @@ -144,6 +154,8 @@ static int lidar_get_measurement(struct lidar_data *data, u16 *reg) } ret = -EIO; } + pm_runtime_mark_last_busy(&client->dev); + pm_runtime_put_autosuspend(&client->dev); return ret; } @@ -243,6 +255,17 @@ static int lidar_probe(struct i2c_client *client, if (ret) goto error_unreg_buffer; + pm_runtime_set_autosuspend_delay(&client->dev, 1000); + pm_runtime_use_autosuspend(&client->dev); + + ret = pm_runtime_set_active(&client->dev); + if (ret) + goto error_unreg_buffer; + pm_runtime_enable(&client->dev); + + pm_runtime_mark_last_busy(&client->dev); + pm_runtime_idle(&client->dev); + return 0; error_unreg_buffer: @@ -258,6 +281,9 @@ static int lidar_remove(struct i2c_client *client) iio_device_unregister(indio_dev); iio_triggered_buffer_cleanup(indio_dev); + pm_runtime_disable(&client->dev); + pm_runtime_set_suspended(&client->dev); + return 0; } @@ -273,10 +299,38 @@ static const struct of_device_id lidar_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, lidar_dt_ids); +#ifdef CONFIG_PM +static int lidar_pm_runtime_suspend(struct device *dev) +{ + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); + struct lidar_data *data = iio_priv(indio_dev); + + return lidar_write_power(data, 0x0f); +} + +static int lidar_pm_runtime_resume(struct device *dev) +{ + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); + struct lidar_data *data = iio_priv(indio_dev); + int ret = lidar_write_power(data, 0); + + /* regulator and FPGA needs settling time */ + usleep_range(15000, 20000); + + return ret; +} +#endif + +static const struct dev_pm_ops lidar_pm_ops = { + SET_RUNTIME_PM_OPS(lidar_pm_runtime_suspend, + lidar_pm_runtime_resume, NULL) +}; + static struct i2c_driver lidar_driver = { .driver = { .name = LIDAR_DRV_NAME, .of_match_table = of_match_ptr(lidar_dt_ids), + .pm = &lidar_pm_ops, }, .probe = lidar_probe, .remove = lidar_remove, From 24e394b08e11be8fdc7a769f757a775367a36b7d Mon Sep 17 00:00:00 2001 From: Egor Uleyskiy Date: Sun, 22 Nov 2015 11:27:52 +0200 Subject: [PATCH 462/843] drivers: staging: vme: Fixed indention Signed-off-by: Egor Uleyskiy Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_pio2_cntr.c | 2 +- drivers/staging/vme/devices/vme_pio2_core.c | 16 +++++++------- drivers/staging/vme/devices/vme_pio2_gpio.c | 24 ++++++++++----------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/staging/vme/devices/vme_pio2_cntr.c b/drivers/staging/vme/devices/vme_pio2_cntr.c index 6335471faa36..486c30c4956f 100644 --- a/drivers/staging/vme/devices/vme_pio2_cntr.c +++ b/drivers/staging/vme/devices/vme_pio2_cntr.c @@ -61,7 +61,7 @@ int pio2_cntr_reset(struct pio2_card *card) /* Ensure all counter interrupts are cleared */ do { retval = vme_master_read(card->window, ®, 1, - PIO2_REGS_INT_STAT_CNTR); + PIO2_REGS_INT_STAT_CNTR); if (retval < 0) return retval; } while (reg != 0); diff --git a/drivers/staging/vme/devices/vme_pio2_core.c b/drivers/staging/vme/devices/vme_pio2_core.c index 35c6ce5047de..f3b878b441ee 100644 --- a/drivers/staging/vme/devices/vme_pio2_core.c +++ b/drivers/staging/vme/devices/vme_pio2_core.c @@ -90,7 +90,7 @@ static void pio2_int(int level, int vector, void *ptr) case 4: /* Channels 0 to 7 */ retval = vme_master_read(card->window, ®, 1, - PIO2_REGS_INT_STAT[vec - 1]); + PIO2_REGS_INT_STAT[vec - 1]); if (retval < 0) { dev_err(&card->vdev->dev, "Unable to read IRQ status register\n"); @@ -100,8 +100,8 @@ static void pio2_int(int level, int vector, void *ptr) channel = ((vec - 1) * 8) + i; if (reg & PIO2_CHANNEL_BIT[channel]) dev_info(&card->vdev->dev, - "Interrupt on I/O channel %d\n", - channel); + "Interrupt on I/O channel %d\n", + channel); } break; case 5: @@ -289,7 +289,7 @@ static int pio2_probe(struct vme_dev *vdev) } retval = vme_master_set(card->window, 1, card->base, 0x10000, VME_A24, - (VME_SCT | VME_USER | VME_DATA), VME_D16); + (VME_SCT | VME_USER | VME_DATA), VME_D16); if (retval) { dev_err(&card->vdev->dev, "Unable to configure VME master resource\n"); @@ -335,7 +335,7 @@ static int pio2_probe(struct vme_dev *vdev) /* Set VME vector */ retval = vme_master_write(card->window, &card->irq_vector, 1, - PIO2_REGS_VME_VECTOR); + PIO2_REGS_VME_VECTOR); if (retval < 0) return retval; @@ -343,7 +343,7 @@ static int pio2_probe(struct vme_dev *vdev) vec = card->irq_vector | PIO2_VME_VECTOR_SPUR; retval = vme_irq_request(vdev, card->irq_level, vec, - &pio2_int, (void *)card); + &pio2_int, (void *)card); if (retval < 0) { dev_err(&card->vdev->dev, "Unable to attach VME interrupt vector0x%x, level 0x%x\n", @@ -356,7 +356,7 @@ static int pio2_probe(struct vme_dev *vdev) vec = card->irq_vector | PIO2_VECTOR_BANK[i]; retval = vme_irq_request(vdev, card->irq_level, vec, - &pio2_int, (void *)card); + &pio2_int, (void *)card); if (retval < 0) { dev_err(&card->vdev->dev, "Unable to attach VME interrupt vector0x%x, level 0x%x\n", @@ -397,7 +397,7 @@ static int pio2_probe(struct vme_dev *vdev) dev_set_drvdata(&card->vdev->dev, card); dev_info(&card->vdev->dev, - "PIO2 (variant %s) configured at 0x%lx\n", card->variant, + "PIO2 (variant %s) configured at 0x%lx\n", card->variant, card->base); return 0; diff --git a/drivers/staging/vme/devices/vme_pio2_gpio.c b/drivers/staging/vme/devices/vme_pio2_gpio.c index 77901b345a71..0b72dac16d56 100644 --- a/drivers/staging/vme/devices/vme_pio2_gpio.c +++ b/drivers/staging/vme/devices/vme_pio2_gpio.c @@ -37,14 +37,14 @@ static int pio2_gpio_get(struct gpio_chip *chip, unsigned int offset) struct pio2_card *card = gpio_to_pio2_card(chip); if ((card->bank[PIO2_CHANNEL_BANK[offset]].config == OUTPUT) | - (card->bank[PIO2_CHANNEL_BANK[offset]].config == NOFIT)) { + (card->bank[PIO2_CHANNEL_BANK[offset]].config == NOFIT)) { dev_err(&card->vdev->dev, "Channel not available as input\n"); return 0; } retval = vme_master_read(card->window, ®, 1, - PIO2_REGS_DATA[PIO2_CHANNEL_BANK[offset]]); + PIO2_REGS_DATA[PIO2_CHANNEL_BANK[offset]]); if (retval < 0) { dev_err(&card->vdev->dev, "Unable to read from GPIO\n"); return 0; @@ -67,15 +67,15 @@ static int pio2_gpio_get(struct gpio_chip *chip, unsigned int offset) return 0; } -static void pio2_gpio_set(struct gpio_chip *chip, unsigned int offset, - int value) +static void pio2_gpio_set(struct gpio_chip *chip, + unsigned int offset, int value) { u8 reg; int retval; struct pio2_card *card = gpio_to_pio2_card(chip); if ((card->bank[PIO2_CHANNEL_BANK[offset]].config == INPUT) | - (card->bank[PIO2_CHANNEL_BANK[offset]].config == NOFIT)) { + (card->bank[PIO2_CHANNEL_BANK[offset]].config == NOFIT)) { dev_err(&card->vdev->dev, "Channel not available as output\n"); return; @@ -89,7 +89,7 @@ static void pio2_gpio_set(struct gpio_chip *chip, unsigned int offset, ~PIO2_CHANNEL_BIT[offset]; retval = vme_master_write(card->window, ®, 1, - PIO2_REGS_DATA[PIO2_CHANNEL_BANK[offset]]); + PIO2_REGS_DATA[PIO2_CHANNEL_BANK[offset]]); if (retval < 0) { dev_err(&card->vdev->dev, "Unable to write to GPIO\n"); return; @@ -105,7 +105,7 @@ static int pio2_gpio_dir_in(struct gpio_chip *chip, unsigned offset) struct pio2_card *card = gpio_to_pio2_card(chip); if ((card->bank[PIO2_CHANNEL_BANK[offset]].config == OUTPUT) | - (card->bank[PIO2_CHANNEL_BANK[offset]].config == NOFIT)) { + (card->bank[PIO2_CHANNEL_BANK[offset]].config == NOFIT)) { dev_err(&card->vdev->dev, "Channel directionality not configurable at runtime\n"); @@ -124,7 +124,7 @@ static int pio2_gpio_dir_out(struct gpio_chip *chip, unsigned offset, int value) struct pio2_card *card = gpio_to_pio2_card(chip); if ((card->bank[PIO2_CHANNEL_BANK[offset]].config == INPUT) | - (card->bank[PIO2_CHANNEL_BANK[offset]].config == NOFIT)) { + (card->bank[PIO2_CHANNEL_BANK[offset]].config == NOFIT)) { dev_err(&card->vdev->dev, "Channel directionality not configurable at runtime\n"); @@ -150,7 +150,7 @@ int pio2_gpio_reset(struct pio2_card *card) /* Zero output registers */ for (i = 0; i < 4; i++) { retval = vme_master_write(card->window, &data, 1, - PIO2_REGS_DATA[i]); + PIO2_REGS_DATA[i]); if (retval < 0) return retval; card->bank[i].value = 0; @@ -159,12 +159,12 @@ int pio2_gpio_reset(struct pio2_card *card) /* Set input interrupt masks */ for (i = 0; i < 4; i++) { retval = vme_master_write(card->window, &data, 1, - PIO2_REGS_INT_MASK[i * 2]); + PIO2_REGS_INT_MASK[i * 2]); if (retval < 0) return retval; retval = vme_master_write(card->window, &data, 1, - PIO2_REGS_INT_MASK[(i * 2) + 1]); + PIO2_REGS_INT_MASK[(i * 2) + 1]); if (retval < 0) return retval; @@ -176,7 +176,7 @@ int pio2_gpio_reset(struct pio2_card *card) for (i = 0; i < 4; i++) { do { retval = vme_master_read(card->window, &data, 1, - PIO2_REGS_INT_STAT[i]); + PIO2_REGS_INT_STAT[i]); if (retval < 0) return retval; } while (data != 0); From cad5636db7a28693dbed3268cb1ee4fe7ddaf6b4 Mon Sep 17 00:00:00 2001 From: Egor Uleyskiy Date: Sun, 22 Nov 2015 11:27:53 +0200 Subject: [PATCH 463/843] drivers: staging: vme: Deleted extra empty lines Signed-off-by: Egor Uleyskiy Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_pio2_gpio.c | 2 -- drivers/staging/vme/devices/vme_user.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/drivers/staging/vme/devices/vme_pio2_gpio.c b/drivers/staging/vme/devices/vme_pio2_gpio.c index 0b72dac16d56..e09f6bb881b6 100644 --- a/drivers/staging/vme/devices/vme_pio2_gpio.c +++ b/drivers/staging/vme/devices/vme_pio2_gpio.c @@ -38,7 +38,6 @@ static int pio2_gpio_get(struct gpio_chip *chip, unsigned int offset) if ((card->bank[PIO2_CHANNEL_BANK[offset]].config == OUTPUT) | (card->bank[PIO2_CHANNEL_BANK[offset]].config == NOFIT)) { - dev_err(&card->vdev->dev, "Channel not available as input\n"); return 0; } @@ -76,7 +75,6 @@ static void pio2_gpio_set(struct gpio_chip *chip, if ((card->bank[PIO2_CHANNEL_BANK[offset]].config == INPUT) | (card->bank[PIO2_CHANNEL_BANK[offset]].config == NOFIT)) { - dev_err(&card->vdev->dev, "Channel not available as output\n"); return; } diff --git a/drivers/staging/vme/devices/vme_user.h b/drivers/staging/vme/devices/vme_user.h index b8cc7bc78a73..a6cb75686fa4 100644 --- a/drivers/staging/vme/devices/vme_user.h +++ b/drivers/staging/vme/devices/vme_user.h @@ -20,7 +20,6 @@ struct vme_master { #endif } __packed; - /* * IOCTL Commands and structures */ @@ -28,7 +27,6 @@ struct vme_master { /* Magic number for use in ioctls */ #define VME_IOC_MAGIC 0xAE - /* VMEbus Slave Window Configuration Structure */ struct vme_slave { __u32 enable; /* State of Window */ From 93a28666a9fadc56fa700e496bb549faf490f3a4 Mon Sep 17 00:00:00 2001 From: Egor Uleyskiy Date: Sun, 22 Nov 2015 11:27:54 +0200 Subject: [PATCH 464/843] drivers: staging: vme: Fixed the using of sizeof Constructions that looks like card = kzalloc(sizeof(struct pio2_card), GFP_KERNEL); are changed to card = kzalloc(sizeof(*card), GFP_KERNEL); Signed-off-by: Egor Uleyskiy Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_pio2_core.c | 2 +- drivers/staging/vme/devices/vme_user.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/vme/devices/vme_pio2_core.c b/drivers/staging/vme/devices/vme_pio2_core.c index f3b878b441ee..a30282a57b6b 100644 --- a/drivers/staging/vme/devices/vme_pio2_core.c +++ b/drivers/staging/vme/devices/vme_pio2_core.c @@ -215,7 +215,7 @@ static int pio2_probe(struct vme_dev *vdev) u8 reg; int vec; - card = kzalloc(sizeof(struct pio2_card), GFP_KERNEL); + card = kzalloc(sizeof(*card), GFP_KERNEL); if (!card) { retval = -ENOMEM; goto err_struct; diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index 8e61a3b3e7e4..a05a065686de 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -308,7 +308,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, switch (cmd) { case VME_IRQ_GEN: copied = copy_from_user(&irq_req, argp, - sizeof(struct vme_irq_id)); + sizeof(irq_req)); if (copied != 0) { pr_warn("Partial copy from userspace\n"); return -EFAULT; @@ -322,7 +322,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, case MASTER_MINOR: switch (cmd) { case VME_GET_MASTER: - memset(&master, 0, sizeof(struct vme_master)); + memset(&master, 0, sizeof(master)); /* XXX We do not want to push aspace, cycle and width * to userspace as they are @@ -334,7 +334,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, &master.cycle, &master.dwidth); copied = copy_to_user(argp, &master, - sizeof(struct vme_master)); + sizeof(master)); if (copied != 0) { pr_warn("Partial copy to userspace\n"); return -EFAULT; @@ -368,7 +368,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, case SLAVE_MINOR: switch (cmd) { case VME_GET_SLAVE: - memset(&slave, 0, sizeof(struct vme_slave)); + memset(&slave, 0, sizeof(slave)); /* XXX We do not want to push aspace, cycle and width * to userspace as they are @@ -379,7 +379,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, &slave.aspace, &slave.cycle); copied = copy_to_user(argp, &slave, - sizeof(struct vme_slave)); + sizeof(slave)); if (copied != 0) { pr_warn("Partial copy to userspace\n"); return -EFAULT; From 48a42206dd343f490f40ddaf44e8f0f9fb3aed37 Mon Sep 17 00:00:00 2001 From: Egor Uleyskiy Date: Sun, 22 Nov 2015 11:27:55 +0200 Subject: [PATCH 465/843] drivers: staging: vme: Deleted extra bracking * Deleted extra bracking of VME_* constants * Deleted extra bracking of address operator Signed-off-by: Egor Uleyskiy Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_pio2_core.c | 2 +- drivers/staging/vme/devices/vme_pio2_gpio.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/vme/devices/vme_pio2_core.c b/drivers/staging/vme/devices/vme_pio2_core.c index a30282a57b6b..296551f9499b 100644 --- a/drivers/staging/vme/devices/vme_pio2_core.c +++ b/drivers/staging/vme/devices/vme_pio2_core.c @@ -289,7 +289,7 @@ static int pio2_probe(struct vme_dev *vdev) } retval = vme_master_set(card->window, 1, card->base, 0x10000, VME_A24, - (VME_SCT | VME_USER | VME_DATA), VME_D16); + VME_SCT | VME_USER | VME_DATA, VME_D16); if (retval) { dev_err(&card->vdev->dev, "Unable to configure VME master resource\n"); diff --git a/drivers/staging/vme/devices/vme_pio2_gpio.c b/drivers/staging/vme/devices/vme_pio2_gpio.c index e09f6bb881b6..65fdb562e903 100644 --- a/drivers/staging/vme/devices/vme_pio2_gpio.c +++ b/drivers/staging/vme/devices/vme_pio2_gpio.c @@ -205,7 +205,7 @@ int pio2_gpio_init(struct pio2_card *card) card->gc.set = pio2_gpio_set; /* This function adds a memory mapped GPIO chip */ - retval = gpiochip_add(&(card->gc)); + retval = gpiochip_add(&card->gc); if (retval) { dev_err(&card->vdev->dev, "Unable to register GPIO\n"); kfree(card->gc.label); @@ -218,7 +218,7 @@ void pio2_gpio_exit(struct pio2_card *card) { const char *label = card->gc.label; - gpiochip_remove(&(card->gc)); + gpiochip_remove(&card->gc); kfree(label); } From 59a04f11350bcf5653aee760fb3d5e06a651b640 Mon Sep 17 00:00:00 2001 From: Egor Uleyskiy Date: Sun, 22 Nov 2015 11:27:56 +0200 Subject: [PATCH 466/843] drivers: staging: vme: Fixed checking NULL and 0 code style Signed-off-by: Egor Uleyskiy Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_pio2_core.c | 2 +- drivers/staging/vme/devices/vme_pio2_gpio.c | 2 +- drivers/staging/vme/devices/vme_user.c | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/vme/devices/vme_pio2_core.c b/drivers/staging/vme/devices/vme_pio2_core.c index 296551f9499b..30712daf54fe 100644 --- a/drivers/staging/vme/devices/vme_pio2_core.c +++ b/drivers/staging/vme/devices/vme_pio2_core.c @@ -230,7 +230,7 @@ static int pio2_probe(struct vme_dev *vdev) card->vdev = vdev; for (i = 0; i < PIO2_VARIANT_LENGTH; i++) { - if (isdigit(card->variant[i]) == 0) { + if (!isdigit(card->variant[i])) { dev_err(&card->vdev->dev, "Variant invalid\n"); retval = -EINVAL; goto err_variant; diff --git a/drivers/staging/vme/devices/vme_pio2_gpio.c b/drivers/staging/vme/devices/vme_pio2_gpio.c index 65fdb562e903..df992c3cb5ce 100644 --- a/drivers/staging/vme/devices/vme_pio2_gpio.c +++ b/drivers/staging/vme/devices/vme_pio2_gpio.c @@ -190,7 +190,7 @@ int pio2_gpio_init(struct pio2_card *card) label = kasprintf(GFP_KERNEL, "%s@%s", driver_name, dev_name(&card->vdev->dev)); - if (label == NULL) + if (!label) return -ENOMEM; card->gc.label = label; diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index a05a065686de..b95883bc68fe 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -309,7 +309,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, case VME_IRQ_GEN: copied = copy_from_user(&irq_req, argp, sizeof(irq_req)); - if (copied != 0) { + if (copied) { pr_warn("Partial copy from userspace\n"); return -EFAULT; } @@ -335,7 +335,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, copied = copy_to_user(argp, &master, sizeof(master)); - if (copied != 0) { + if (copied) { pr_warn("Partial copy to userspace\n"); return -EFAULT; } @@ -350,7 +350,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, } copied = copy_from_user(&master, argp, sizeof(master)); - if (copied != 0) { + if (copied) { pr_warn("Partial copy from userspace\n"); return -EFAULT; } @@ -380,7 +380,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, copied = copy_to_user(argp, &slave, sizeof(slave)); - if (copied != 0) { + if (copied) { pr_warn("Partial copy to userspace\n"); return -EFAULT; } @@ -390,7 +390,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, case VME_SET_SLAVE: copied = copy_from_user(&slave, argp, sizeof(slave)); - if (copied != 0) { + if (copied) { pr_warn("Partial copy from userspace\n"); return -EFAULT; } @@ -757,7 +757,7 @@ static int __init vme_user_init(void) * we just change the code in vme_user_match(). */ retval = vme_register_driver(&vme_user_driver, VME_MAX_SLOTS); - if (retval != 0) + if (retval) goto err_reg; return retval; From 6e23ec4a1118e8dbabee8e62ec20ef78e9aa804d Mon Sep 17 00:00:00 2001 From: Egor Uleyskiy Date: Sun, 22 Nov 2015 11:27:57 +0200 Subject: [PATCH 467/843] drivers: staging: vme: Deleted casting to (void *) Signed-off-by: Egor Uleyskiy Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/devices/vme_pio2_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/vme/devices/vme_pio2_core.c b/drivers/staging/vme/devices/vme_pio2_core.c index 30712daf54fe..4f3cdbcedb3e 100644 --- a/drivers/staging/vme/devices/vme_pio2_core.c +++ b/drivers/staging/vme/devices/vme_pio2_core.c @@ -343,7 +343,7 @@ static int pio2_probe(struct vme_dev *vdev) vec = card->irq_vector | PIO2_VME_VECTOR_SPUR; retval = vme_irq_request(vdev, card->irq_level, vec, - &pio2_int, (void *)card); + &pio2_int, card); if (retval < 0) { dev_err(&card->vdev->dev, "Unable to attach VME interrupt vector0x%x, level 0x%x\n", @@ -356,7 +356,7 @@ static int pio2_probe(struct vme_dev *vdev) vec = card->irq_vector | PIO2_VECTOR_BANK[i]; retval = vme_irq_request(vdev, card->irq_level, vec, - &pio2_int, (void *)card); + &pio2_int, card); if (retval < 0) { dev_err(&card->vdev->dev, "Unable to attach VME interrupt vector0x%x, level 0x%x\n", @@ -370,7 +370,7 @@ static int pio2_probe(struct vme_dev *vdev) vec = card->irq_vector | PIO2_VECTOR_CNTR[i]; retval = vme_irq_request(vdev, card->irq_level, vec, - &pio2_int, (void *)card); + &pio2_int, card); if (retval < 0) { dev_err(&card->vdev->dev, "Unable to attach VME interrupt vector0x%x, level 0x%x\n", From f2fd578f16c49256ae493d4bf192e361be9224fe Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Sat, 7 Nov 2015 11:16:39 +0530 Subject: [PATCH 468/843] Staging: lustre: obd_cksum.h: Remove unused cksum_types_supported_server cksum_types_supported_server is defined in header file but not used anywhere. Hence remove it. Signed-off-by: Shraddha Barke Acked-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/include/obd_cksum.h | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd_cksum.h b/drivers/staging/lustre/lustre/include/obd_cksum.h index a0099d71773a..01db60405393 100644 --- a/drivers/staging/lustre/lustre/include/obd_cksum.h +++ b/drivers/staging/lustre/lustre/include/obd_cksum.h @@ -133,29 +133,6 @@ static inline cksum_type_t cksum_types_supported_client(void) return ret; } -/* Server uses algos that perform at 50% or better of the Adler */ -static inline cksum_type_t cksum_types_supported_server(void) -{ - int base_speed; - cksum_type_t ret = OBD_CKSUM_ADLER; - - CDEBUG(D_INFO, "Crypto hash speed: crc %d, crc32c %d, adler %d\n", - cfs_crypto_hash_speed(cksum_obd2cfs(OBD_CKSUM_CRC32)), - cfs_crypto_hash_speed(cksum_obd2cfs(OBD_CKSUM_CRC32C)), - cfs_crypto_hash_speed(cksum_obd2cfs(OBD_CKSUM_ADLER))); - - base_speed = cfs_crypto_hash_speed(cksum_obd2cfs(OBD_CKSUM_ADLER)) / 2; - - if (cfs_crypto_hash_speed(cksum_obd2cfs(OBD_CKSUM_CRC32C)) >= - base_speed) - ret |= OBD_CKSUM_CRC32C; - if (cfs_crypto_hash_speed(cksum_obd2cfs(OBD_CKSUM_CRC32)) >= - base_speed) - ret |= OBD_CKSUM_CRC32; - - return ret; -} - /* Select the best checksum algorithm among those supplied in the cksum_types * input. * From 24069d287cba5bc0279eac83b34eae8f59fd10ef Mon Sep 17 00:00:00 2001 From: Anjali Menon Date: Fri, 20 Nov 2015 18:34:37 +0530 Subject: [PATCH 469/843] staging: unisys: visornic: Removed the blank line Removed the blank line before the close brace to remove the check detected by the checkpatch.pl CHECK: Blank lines aren't necessary before a close brace '}' Signed-off-by: Anjali Menon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visornic/visornic_main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 296b11cea247..05194707278a 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -1742,7 +1742,6 @@ poll_for_irq(unsigned long v) atomic_set(&devdata->interrupt_rcvd, 0); mod_timer(&devdata->irq_poll_timer, msecs_to_jiffies(2)); - } /** From f84a187019ccfce97fbf38fa9f3a8261fef91d8e Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Tue, 24 Nov 2015 09:53:29 -0500 Subject: [PATCH 470/843] staging: unisys: better config switch comments We should provide more information in the Kconfig help for visorbus and visorinput. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/visorbus/Kconfig | 7 ++++++- drivers/staging/unisys/visorinput/Kconfig | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/staging/unisys/visorbus/Kconfig b/drivers/staging/unisys/visorbus/Kconfig index 9b299ac86015..511388075ffa 100644 --- a/drivers/staging/unisys/visorbus/Kconfig +++ b/drivers/staging/unisys/visorbus/Kconfig @@ -6,4 +6,9 @@ config UNISYS_VISORBUS tristate "Unisys visorbus driver" depends on UNISYSSPAR ---help--- - If you say Y here, you will enable the Unisys visorbus driver. + The visorbus driver is a virtualized bus for the Unisys s-Par firmware. + Virtualized devices allow Linux guests on a system to share disks and + network cards that do not have SR-IOV support, and to be accessed using + the partition desktop application. The visorbus driver is required to + discover devices on an s-Par guest, and must be present for any other + s-Par guest driver to function correctly. diff --git a/drivers/staging/unisys/visorinput/Kconfig b/drivers/staging/unisys/visorinput/Kconfig index d83deb4137e8..3476d419d32c 100644 --- a/drivers/staging/unisys/visorinput/Kconfig +++ b/drivers/staging/unisys/visorinput/Kconfig @@ -6,5 +6,10 @@ config UNISYS_VISORINPUT tristate "Unisys visorinput driver" depends on UNISYSSPAR && UNISYS_VISORBUS && FB ---help--- - If you say Y here, you will enable the Unisys visorinput driver. + The Unisys s-Par visorinput driver provides a virtualized system + console (keyboard and mouse) that is accessible through the + s-Par firmware's user interface. s-Par provides video using the EFI + GOP protocol, so If this driver is not present, the Linux guest should + still boot with visible output in the partition desktop, but keyboard + and mouse interaction will not be available. From 78f16dbda5eee2f9379a6313cd01792160e2ec70 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Fri, 27 Nov 2015 14:52:51 +0100 Subject: [PATCH 471/843] iio: adc: mcp3422: Add mcp3421 support The mcp3421 is the single channel variant of the mcp342x family. Support is straight forward, only the channels array has to be added for this chip. Signed-off-by: Sascha Hauer Signed-off-by: Jonathan Cameron --- drivers/iio/adc/mcp3422.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/iio/adc/mcp3422.c b/drivers/iio/adc/mcp3422.c index 3555122008b4..6eca7aea8a37 100644 --- a/drivers/iio/adc/mcp3422.c +++ b/drivers/iio/adc/mcp3422.c @@ -305,6 +305,10 @@ static const struct attribute_group mcp3422_attribute_group = { .attrs = mcp3422_attributes, }; +static const struct iio_chan_spec mcp3421_channels[] = { + MCP3422_CHAN(0), +}; + static const struct iio_chan_spec mcp3422_channels[] = { MCP3422_CHAN(0), MCP3422_CHAN(1), @@ -352,6 +356,10 @@ static int mcp3422_probe(struct i2c_client *client, indio_dev->info = &mcp3422_info; switch (adc->id) { + case 1: + indio_dev->channels = mcp3421_channels; + indio_dev->num_channels = ARRAY_SIZE(mcp3421_channels); + break; case 2: case 3: case 6: @@ -383,6 +391,7 @@ static int mcp3422_probe(struct i2c_client *client, } static const struct i2c_device_id mcp3422_id[] = { + { "mcp3421", 1 }, { "mcp3422", 2 }, { "mcp3423", 3 }, { "mcp3424", 4 }, From 930cc0f39b07a830e6939c5634f9a310f306c4b1 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Fri, 27 Nov 2015 14:52:52 +0100 Subject: [PATCH 472/843] dt-bindings: iio: adc: Update mcp342x binding for the mcp3421 The mcp3421 is the single channel variant of the mcp342x family and can be supported by the mcp342x driver. Signed-off-by: Sascha Hauer Cc: devicetree@vger.kernel.org Acked-by: Rob Herring Signed-off-by: Jonathan Cameron --- Documentation/devicetree/bindings/iio/adc/mcp3422.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/iio/adc/mcp3422.txt b/Documentation/devicetree/bindings/iio/adc/mcp3422.txt index 333139cc0bfb..dcae4ccfcc52 100644 --- a/Documentation/devicetree/bindings/iio/adc/mcp3422.txt +++ b/Documentation/devicetree/bindings/iio/adc/mcp3422.txt @@ -1,7 +1,8 @@ -* Microchip mcp3422/3/4/6/7/8 chip family (ADC) +* Microchip mcp3421/2/3/4/6/7/8 chip family (ADC) Required properties: - compatible: Should be + "microchip,mcp3421" or "microchip,mcp3422" or "microchip,mcp3423" or "microchip,mcp3424" or From c3304c212326cfcabb1faf6a0035d0c631778d5b Mon Sep 17 00:00:00 2001 From: Adriana Reus Date: Tue, 24 Nov 2015 12:59:48 +0200 Subject: [PATCH 473/843] iio: light: us5182d: Add property for choosing default power mode This chip supports two power modes. 1. "one-shot" mode - the chip activates and executes one complete conversion loop and then shuts itself down. This is the default mode chosen for raw reads. 2. "continuous" mode - the chip takes continuous measurements. Continuous mode is more expensive power-wise but may be more reliable. Add a property so that if preferred, the default power mode for raw reads can be set to continuous. Separate one-shot enabling in a separate function that will be used depending on the chosen power mode. Also create a function for powering the chip on and off. Signed-off-by: Adriana Reus Signed-off-by: Jonathan Cameron --- drivers/iio/light/us5182d.c | 90 ++++++++++++++++++++++++++++++++----- 1 file changed, 78 insertions(+), 12 deletions(-) diff --git a/drivers/iio/light/us5182d.c b/drivers/iio/light/us5182d.c index 49dab3cb3e23..855f183ba216 100644 --- a/drivers/iio/light/us5182d.c +++ b/drivers/iio/light/us5182d.c @@ -99,6 +99,11 @@ enum mode { US5182D_PX_ONLY }; +enum pmode { + US5182D_CONTINUOUS, + US5182D_ONESHOT +}; + struct us5182d_data { struct i2c_client *client; struct mutex lock; @@ -112,6 +117,9 @@ struct us5182d_data { u16 *us5182d_dark_ths; u8 opmode; + u8 power_mode; + + bool default_continuous; }; static IIO_CONST_ATTR(in_illuminance_scale_available, @@ -130,13 +138,11 @@ static const struct { u8 reg; u8 val; } us5182d_regvals[] = { - {US5182D_REG_CFG0, (US5182D_CFG0_SHUTDOWN_EN | - US5182D_CFG0_WORD_ENABLE)}, + {US5182D_REG_CFG0, US5182D_CFG0_WORD_ENABLE}, {US5182D_REG_CFG1, US5182D_CFG1_ALS_RES16}, {US5182D_REG_CFG2, (US5182D_CFG2_PX_RES16 | US5182D_CFG2_PXGAIN_DEFAULT)}, {US5182D_REG_CFG3, US5182D_CFG3_LED_CURRENT100}, - {US5182D_REG_MODE_STORE, US5182D_STORE_MODE}, {US5182D_REG_CFG4, 0x00}, }; @@ -169,7 +175,7 @@ static int us5182d_get_als(struct us5182d_data *data) return result; } -static int us5182d_set_opmode(struct us5182d_data *data, u8 mode) +static int us5182d_oneshot_en(struct us5182d_data *data) { int ret; @@ -183,6 +189,20 @@ static int us5182d_set_opmode(struct us5182d_data *data, u8 mode) */ ret = ret | US5182D_CFG0_ONESHOT_EN; + return i2c_smbus_write_byte_data(data->client, US5182D_REG_CFG0, ret); +} + +static int us5182d_set_opmode(struct us5182d_data *data, u8 mode) +{ + int ret; + + if (mode == data->opmode) + return 0; + + ret = i2c_smbus_read_byte_data(data->client, US5182D_REG_CFG0); + if (ret < 0) + return ret; + /* update mode */ ret = ret & ~US5182D_OPMODE_MASK; ret = ret | (mode << US5182D_OPMODE_SHIFT); @@ -196,9 +216,6 @@ static int us5182d_set_opmode(struct us5182d_data *data, u8 mode) if (ret < 0) return ret; - if (mode == data->opmode) - return 0; - ret = i2c_smbus_write_byte_data(data->client, US5182D_REG_MODE_STORE, US5182D_STORE_MODE); if (ret < 0) @@ -210,6 +227,23 @@ static int us5182d_set_opmode(struct us5182d_data *data, u8 mode) return 0; } +static int us5182d_shutdown_en(struct us5182d_data *data, u8 state) +{ + int ret; + + if (data->power_mode == US5182D_ONESHOT) + return 0; + + ret = i2c_smbus_read_byte_data(data->client, US5182D_REG_CFG0); + if (ret < 0) + return ret; + + ret = ret & ~US5182D_CFG0_SHUTDOWN_EN; + ret = ret | state; + + return i2c_smbus_write_byte_data(data->client, US5182D_REG_CFG0, ret); +} + static int us5182d_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val, int *val2, long mask) @@ -222,6 +256,11 @@ static int us5182d_read_raw(struct iio_dev *indio_dev, switch (chan->type) { case IIO_LIGHT: mutex_lock(&data->lock); + if (data->power_mode == US5182D_ONESHOT) { + ret = us5182d_oneshot_en(data); + if (ret < 0) + goto out_err; + } ret = us5182d_set_opmode(data, US5182D_OPMODE_ALS); if (ret < 0) goto out_err; @@ -234,6 +273,11 @@ static int us5182d_read_raw(struct iio_dev *indio_dev, return IIO_VAL_INT; case IIO_PROXIMITY: mutex_lock(&data->lock); + if (data->power_mode == US5182D_ONESHOT) { + ret = us5182d_oneshot_en(data); + if (ret < 0) + goto out_err; + } ret = us5182d_set_opmode(data, US5182D_OPMODE_PX); if (ret < 0) goto out_err; @@ -368,6 +412,7 @@ static int us5182d_init(struct iio_dev *indio_dev) return ret; data->opmode = 0; + data->power_mode = US5182D_CONTINUOUS; for (i = 0; i < ARRAY_SIZE(us5182d_regvals); i++) { ret = i2c_smbus_write_byte_data(data->client, us5182d_regvals[i].reg, @@ -376,7 +421,15 @@ static int us5182d_init(struct iio_dev *indio_dev) return ret; } - return 0; + if (!data->default_continuous) { + ret = us5182d_shutdown_en(data, US5182D_CFG0_SHUTDOWN_EN); + if (ret < 0) + return ret; + data->power_mode = US5182D_ONESHOT; + } + + + return ret; } static void us5182d_get_platform_data(struct iio_dev *indio_dev) @@ -399,6 +452,8 @@ static void us5182d_get_platform_data(struct iio_dev *indio_dev) "upisemi,lower-dark-gain", &data->lower_dark_gain)) data->lower_dark_gain = US5182D_REG_AUTO_LDARK_GAIN_DEFAULT; + data->default_continuous = device_property_read_bool(&data->client->dev, + "upisemi,continuous"); } static int us5182d_dark_gain_config(struct iio_dev *indio_dev) @@ -464,16 +519,27 @@ static int us5182d_probe(struct i2c_client *client, ret = us5182d_dark_gain_config(indio_dev); if (ret < 0) - return ret; + goto out_err; + + ret = iio_device_register(indio_dev); + if (ret < 0) + goto out_err; + + return 0; + +out_err: + us5182d_shutdown_en(data, US5182D_CFG0_SHUTDOWN_EN); + return ret; - return iio_device_register(indio_dev); } static int us5182d_remove(struct i2c_client *client) { + struct us5182d_data *data = iio_priv(i2c_get_clientdata(client)); + iio_device_unregister(i2c_get_clientdata(client)); - return i2c_smbus_write_byte_data(client, US5182D_REG_CFG0, - US5182D_CFG0_SHUTDOWN_EN); + + return us5182d_shutdown_en(data, US5182D_CFG0_SHUTDOWN_EN); } static const struct acpi_device_id us5182d_acpi_match[] = { From 023e30fb0d3a3b9d6b8dc9e47590aa544d58a22f Mon Sep 17 00:00:00 2001 From: Adriana Reus Date: Tue, 24 Nov 2015 12:59:49 +0200 Subject: [PATCH 474/843] Documentation: devicetree: Add property for controlling power saving mode for the us5182 als sensor Add a property to allow changing the default power-saving mode. By default, at read raw the chip will activate and provide one measurent, then it will shut itself down. However, the chip can also work in "continuous" mode which may be more reliable but is also more power consuming. Signed-off-by: Adriana Reus Acked-by: Rob Herring Signed-off-by: Jonathan Cameron --- .../devicetree/bindings/iio/light/us5182d.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/light/us5182d.txt b/Documentation/devicetree/bindings/iio/light/us5182d.txt index 6f0a530144fd..a61979997f37 100644 --- a/Documentation/devicetree/bindings/iio/light/us5182d.txt +++ b/Documentation/devicetree/bindings/iio/light/us5182d.txt @@ -7,13 +7,24 @@ Required properties: Optional properties: - upisemi,glass-coef: glass attenuation factor - compensation factor of resolution 1000 for material transmittance. + - upisemi,dark-ths: array of 8 elements containing 16-bit thresholds (adc counts) corresponding to every scale. + - upisemi,upper-dark-gain: 8-bit dark gain compensation factor(4 int and 4 fractional bits - Q4.4) applied when light > threshold + - upisemi,lower-dark-gain: 8-bit dark gain compensation factor(4 int and 4 fractional bits - Q4.4) applied when light < threshold +- upisemi,continuous: This chip has two power modes: one-shot (chip takes one + measurement and then shuts itself down) and continuous ( + chip takes continuous measurements). The one-shot mode is + more power-friendly but the continuous mode may be more + reliable. If this property is specified the continuous + mode will be used instead of the default one-shot one for + raw reads. + If the optional properties are not specified these factors will default to the values in the below example. The glass-coef defaults to no compensation for the covering material. From a22a3c5c40deb31f03c2810a46e669bedbf476c5 Mon Sep 17 00:00:00 2001 From: Adriana Reus Date: Tue, 24 Nov 2015 12:59:50 +0200 Subject: [PATCH 475/843] iio: light: us5182d: Add functions for selectively enabling als and proximity Keep track of the als and px enabled/disabled status in order to enable them selectively. Signed-off-by: Adriana Reus Signed-off-by: Jonathan Cameron --- drivers/iio/light/us5182d.c | 66 ++++++++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/us5182d.c b/drivers/iio/light/us5182d.c index 855f183ba216..e67956c1f296 100644 --- a/drivers/iio/light/us5182d.c +++ b/drivers/iio/light/us5182d.c @@ -119,6 +119,9 @@ struct us5182d_data { u8 opmode; u8 power_mode; + bool als_enabled; + bool px_enabled; + bool default_continuous; }; @@ -227,6 +230,50 @@ static int us5182d_set_opmode(struct us5182d_data *data, u8 mode) return 0; } +static int us5182d_als_enable(struct us5182d_data *data) +{ + int ret; + u8 mode; + + if (data->power_mode == US5182D_ONESHOT) + return us5182d_set_opmode(data, US5182D_ALS_ONLY); + + if (data->als_enabled) + return 0; + + mode = data->px_enabled ? US5182D_ALS_PX : US5182D_ALS_ONLY; + + ret = us5182d_set_opmode(data, mode); + if (ret < 0) + return ret; + + data->als_enabled = true; + + return 0; +} + +static int us5182d_px_enable(struct us5182d_data *data) +{ + int ret; + u8 mode; + + if (data->power_mode == US5182D_ONESHOT) + return us5182d_set_opmode(data, US5182D_PX_ONLY); + + if (data->px_enabled) + return 0; + + mode = data->als_enabled ? US5182D_ALS_PX : US5182D_PX_ONLY; + + ret = us5182d_set_opmode(data, mode); + if (ret < 0) + return ret; + + data->px_enabled = true; + + return 0; +} + static int us5182d_shutdown_en(struct us5182d_data *data, u8 state) { int ret; @@ -241,7 +288,16 @@ static int us5182d_shutdown_en(struct us5182d_data *data, u8 state) ret = ret & ~US5182D_CFG0_SHUTDOWN_EN; ret = ret | state; - return i2c_smbus_write_byte_data(data->client, US5182D_REG_CFG0, ret); + ret = i2c_smbus_write_byte_data(data->client, US5182D_REG_CFG0, ret); + if (ret < 0) + return ret; + + if (state & US5182D_CFG0_SHUTDOWN_EN) { + data->als_enabled = false; + data->px_enabled = false; + } + + return ret; } static int us5182d_read_raw(struct iio_dev *indio_dev, @@ -261,7 +317,7 @@ static int us5182d_read_raw(struct iio_dev *indio_dev, if (ret < 0) goto out_err; } - ret = us5182d_set_opmode(data, US5182D_OPMODE_ALS); + ret = us5182d_als_enable(data); if (ret < 0) goto out_err; @@ -278,7 +334,7 @@ static int us5182d_read_raw(struct iio_dev *indio_dev, if (ret < 0) goto out_err; } - ret = us5182d_set_opmode(data, US5182D_OPMODE_PX); + ret = us5182d_px_enable(data); if (ret < 0) goto out_err; @@ -421,6 +477,9 @@ static int us5182d_init(struct iio_dev *indio_dev) return ret; } + data->als_enabled = true; + data->px_enabled = true; + if (!data->default_continuous) { ret = us5182d_shutdown_en(data, US5182D_CFG0_SHUTDOWN_EN); if (ret < 0) @@ -428,7 +487,6 @@ static int us5182d_init(struct iio_dev *indio_dev) data->power_mode = US5182D_ONESHOT; } - return ret; } From f0e5f57d3ac25aa2afb25dc94d2b42a8defa8a19 Mon Sep 17 00:00:00 2001 From: Adriana Reus Date: Tue, 24 Nov 2015 12:59:51 +0200 Subject: [PATCH 476/843] iio: light: us8152d: Add power management support Add power management for sleep as well as runtime pm. Signed-off-by: Adriana Reus Signed-off-by: Jonathan Cameron --- drivers/iio/light/us5182d.c | 95 ++++++++++++++++++++++++++++++++++--- 1 file changed, 88 insertions(+), 7 deletions(-) diff --git a/drivers/iio/light/us5182d.c b/drivers/iio/light/us5182d.c index e67956c1f296..256c4bc12d21 100644 --- a/drivers/iio/light/us5182d.c +++ b/drivers/iio/light/us5182d.c @@ -23,6 +23,8 @@ #include #include #include +#include +#include #define US5182D_REG_CFG0 0x00 #define US5182D_CFG0_ONESHOT_EN BIT(6) @@ -81,6 +83,7 @@ #define US5182D_READ_BYTE 1 #define US5182D_READ_WORD 2 #define US5182D_OPSTORE_SLEEP_TIME 20 /* ms */ +#define US5182D_SLEEP_MS 3000 /* ms */ /* Available ranges: [12354, 7065, 3998, 2202, 1285, 498, 256, 138] lux */ static const int us5182d_scales[] = {188500, 107800, 61000, 33600, 19600, 7600, @@ -300,6 +303,26 @@ static int us5182d_shutdown_en(struct us5182d_data *data, u8 state) return ret; } + +static int us5182d_set_power_state(struct us5182d_data *data, bool on) +{ + int ret; + + if (data->power_mode == US5182D_ONESHOT) + return 0; + + if (on) { + ret = pm_runtime_get_sync(&data->client->dev); + if (ret < 0) + pm_runtime_put_noidle(&data->client->dev); + } else { + pm_runtime_mark_last_busy(&data->client->dev); + ret = pm_runtime_put_autosuspend(&data->client->dev); + } + + return ret; +} + static int us5182d_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val, int *val2, long mask) @@ -317,15 +340,20 @@ static int us5182d_read_raw(struct iio_dev *indio_dev, if (ret < 0) goto out_err; } - ret = us5182d_als_enable(data); + ret = us5182d_set_power_state(data, true); if (ret < 0) goto out_err; - + ret = us5182d_als_enable(data); + if (ret < 0) + goto out_poweroff; ret = us5182d_get_als(data); + if (ret < 0) + goto out_poweroff; + *val = ret; + ret = us5182d_set_power_state(data, false); if (ret < 0) goto out_err; mutex_unlock(&data->lock); - *val = ret; return IIO_VAL_INT; case IIO_PROXIMITY: mutex_lock(&data->lock); @@ -334,17 +362,22 @@ static int us5182d_read_raw(struct iio_dev *indio_dev, if (ret < 0) goto out_err; } - ret = us5182d_px_enable(data); + ret = us5182d_set_power_state(data, true); if (ret < 0) goto out_err; - + ret = us5182d_px_enable(data); + if (ret < 0) + goto out_poweroff; ret = i2c_smbus_read_word_data(data->client, US5182D_REG_PDL); + if (ret < 0) + goto out_poweroff; + *val = ret; + ret = us5182d_set_power_state(data, false); if (ret < 0) goto out_err; mutex_unlock(&data->lock); - *val = ret; - return IIO_VAL_INT; + return IIO_VAL_INT; default: return -EINVAL; } @@ -363,6 +396,9 @@ static int us5182d_read_raw(struct iio_dev *indio_dev, } return -EINVAL; + +out_poweroff: + us5182d_set_power_state(data, false); out_err: mutex_unlock(&data->lock); return ret; @@ -579,6 +615,17 @@ static int us5182d_probe(struct i2c_client *client, if (ret < 0) goto out_err; + if (data->default_continuous) { + pm_runtime_set_active(&client->dev); + if (ret < 0) + goto out_err; + } + + pm_runtime_enable(&client->dev); + pm_runtime_set_autosuspend_delay(&client->dev, + US5182D_SLEEP_MS); + pm_runtime_use_autosuspend(&client->dev); + ret = iio_device_register(indio_dev); if (ret < 0) goto out_err; @@ -597,9 +644,42 @@ static int us5182d_remove(struct i2c_client *client) iio_device_unregister(i2c_get_clientdata(client)); + pm_runtime_disable(&client->dev); + pm_runtime_set_suspended(&client->dev); + return us5182d_shutdown_en(data, US5182D_CFG0_SHUTDOWN_EN); } +#if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM) +static int us5182d_suspend(struct device *dev) +{ + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); + struct us5182d_data *data = iio_priv(indio_dev); + + if (data->power_mode == US5182D_CONTINUOUS) + return us5182d_shutdown_en(data, US5182D_CFG0_SHUTDOWN_EN); + + return 0; +} + +static int us5182d_resume(struct device *dev) +{ + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); + struct us5182d_data *data = iio_priv(indio_dev); + + if (data->power_mode == US5182D_CONTINUOUS) + return us5182d_shutdown_en(data, + ~US5182D_CFG0_SHUTDOWN_EN & 0xff); + + return 0; +} +#endif + +static const struct dev_pm_ops us5182d_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(us5182d_suspend, us5182d_resume) + SET_RUNTIME_PM_OPS(us5182d_suspend, us5182d_resume, NULL) +}; + static const struct acpi_device_id us5182d_acpi_match[] = { { "USD5182", 0}, {} @@ -617,6 +697,7 @@ MODULE_DEVICE_TABLE(i2c, us5182d_id); static struct i2c_driver us5182d_driver = { .driver = { .name = US5182D_DRV_NAME, + .pm = &us5182d_pm_ops, .acpi_match_table = ACPI_PTR(us5182d_acpi_match), }, .probe = us5182d_probe, From 22b19ab3e2d6da666be816e649af67bf721b8561 Mon Sep 17 00:00:00 2001 From: Nizam Haider Date: Mon, 23 Nov 2015 23:03:07 +0530 Subject: [PATCH 477/843] Staging: iio: adc: use dev_get_platdata() Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. Signed-off-by: Nizam Haider Signed-off-by: Jonathan Cameron --- drivers/staging/iio/adc/ad7192.c | 2 +- drivers/staging/iio/adc/ad7280a.c | 2 +- drivers/staging/iio/adc/ad7816.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c index bb40f3728742..92211039ffa9 100644 --- a/drivers/staging/iio/adc/ad7192.c +++ b/drivers/staging/iio/adc/ad7192.c @@ -609,7 +609,7 @@ static const struct iio_chan_spec ad7192_channels[] = { static int ad7192_probe(struct spi_device *spi) { - const struct ad7192_platform_data *pdata = spi->dev.platform_data; + const struct ad7192_platform_data *pdata = dev_get_platdata(&spi->dev); struct ad7192_state *st; struct iio_dev *indio_dev; int ret, voltage_uv = 0; diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c index 35acb1a4669b..f45ebedb7a05 100644 --- a/drivers/staging/iio/adc/ad7280a.c +++ b/drivers/staging/iio/adc/ad7280a.c @@ -833,7 +833,7 @@ static const struct ad7280_platform_data ad7793_default_pdata = { static int ad7280_probe(struct spi_device *spi) { - const struct ad7280_platform_data *pdata = spi->dev.platform_data; + const struct ad7280_platform_data *pdata = dev_get_platdata(&spi->dev); struct ad7280_state *st; int ret; const unsigned short tACQ_ns[4] = {465, 1010, 1460, 1890}; diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c index c8e156646528..22260512cf01 100644 --- a/drivers/staging/iio/adc/ad7816.c +++ b/drivers/staging/iio/adc/ad7816.c @@ -345,7 +345,7 @@ static int ad7816_probe(struct spi_device *spi_dev) { struct ad7816_chip_info *chip; struct iio_dev *indio_dev; - unsigned short *pins = spi_dev->dev.platform_data; + unsigned short *pins = dev_get_platdata(&spi_dev->dev); int ret = 0; int i; From a260527f83dfebe7c49bd6582ed6aa1be29f355a Mon Sep 17 00:00:00 2001 From: Nizam Haider Date: Mon, 23 Nov 2015 23:18:50 +0530 Subject: [PATCH 478/843] Staging: iio: light: tsl2x7x_core: use dev_get_platdata() Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. Signed-off-by: Nizam Haider Signed-off-by: Jonathan Cameron --- drivers/staging/iio/light/tsl2x7x_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c index 9dfd04855a1b..5b1c1650a0e4 100644 --- a/drivers/staging/iio/light/tsl2x7x_core.c +++ b/drivers/staging/iio/light/tsl2x7x_core.c @@ -1898,7 +1898,7 @@ static int tsl2x7x_probe(struct i2c_client *clientp, mutex_init(&chip->prox_mutex); chip->tsl2x7x_chip_status = TSL2X7X_CHIP_UNKNOWN; - chip->pdata = clientp->dev.platform_data; + chip->pdata = dev_get_platdata(&clientp->dev); chip->id = id->driver_data; chip->chip_info = &tsl2x7x_chip_info_tbl[device_channel_config[id->driver_data]]; From 7221819ac48195ea9f1e179c3f812939319d9e7b Mon Sep 17 00:00:00 2001 From: Nizam Haider Date: Mon, 23 Nov 2015 23:37:16 +0530 Subject: [PATCH 479/843] Staging: iio: frequency: use dev_get_platdata() Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. Signed-off-by: Nizam Haider Signed-off-by: Jonathan Cameron --- drivers/staging/iio/frequency/ad9832.c | 2 +- drivers/staging/iio/frequency/ad9834.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c index 2b65faa6296a..18b27a1984b2 100644 --- a/drivers/staging/iio/frequency/ad9832.c +++ b/drivers/staging/iio/frequency/ad9832.c @@ -201,7 +201,7 @@ static const struct iio_info ad9832_info = { static int ad9832_probe(struct spi_device *spi) { - struct ad9832_platform_data *pdata = spi->dev.platform_data; + struct ad9832_platform_data *pdata = dev_get_platdata(&spi->dev); struct iio_dev *indio_dev; struct ad9832_state *st; struct regulator *reg; diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c index 6464f2cbe94b..6366216e4f37 100644 --- a/drivers/staging/iio/frequency/ad9834.c +++ b/drivers/staging/iio/frequency/ad9834.c @@ -318,7 +318,7 @@ static const struct iio_info ad9833_info = { static int ad9834_probe(struct spi_device *spi) { - struct ad9834_platform_data *pdata = spi->dev.platform_data; + struct ad9834_platform_data *pdata = dev_get_platdata(&spi->dev); struct ad9834_state *st; struct iio_dev *indio_dev; struct regulator *reg; From f89c2b39ce676cb08b6ed8848cde76dcb21cc672 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Wed, 2 Dec 2015 18:24:45 +0000 Subject: [PATCH 480/843] staging:iio:mxs-lradc Fix large integer implicitly truncated to unsigned warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The change to using BIT(20) for one of the bit shifts resulted in a constant becoming unsigned. When combined with the existing signed constants in a couple of places, this caused possible trouble, hence the warnings: drivers/staging/iio/adc/mxs-lradc.c: In function ‘mxs_lradc_complete_touch_event’: drivers/staging/iio/adc/mxs-lradc.c:325:5: warning: large integer implicitly truncated to unsigned type [-Woverflow] (((x) << LRADC_DELAY_TRIGGER_LRADCS_OFFSET) & \ ^ drivers/staging/iio/adc/mxs-lradc.c:734:7: note: in expansion of macro ‘LRADC_DELAY_TRIGGER’ LRADC_DELAY_TRIGGER(1 << TOUCHSCREEN_VCHANNEL1) | ^ LD [M] drivers/staging/iio/accel/adis16201.o drivers/staging/iio/adc/mxs-lradc.c: In function ‘mxs_lradc_buffer_preenable’: drivers/staging/iio/adc/mxs-lradc.c:322:42: warning: large integer implicitly truncated to unsigned type [-Woverflow] #define LRADC_DELAY_TRIGGER_LRADCS_MASK (0xff << 24) ^ drivers/staging/iio/adc/mxs-lradc.c:1308:29: note: in expansion of macro ‘LRADC_DELAY_TRIGGER_LRADCS_MASK’ mxs_lradc_reg_clear(lradc, LRADC_DELAY_TRIGGER_LRADCS_MASK | ^ drivers/staging/iio/adc/mxs-lradc.c: In function ‘mxs_lradc_buffer_postdisable’: drivers/staging/iio/adc/mxs-lradc.c:322:42: warning: large integer implicitly truncated to unsigned type [-Woverflow] #define LRADC_DELAY_TRIGGER_LRADCS_MASK (0xff << 24) ^ drivers/staging/iio/adc/mxs-lradc.c:1327:29: note: in expansion of macro ‘LRADC_DELAY_TRIGGER_LRADCS_MASK’ mxs_lradc_reg_clear(lradc, LRADC_DELAY_TRIGGER_LRADCS_MASK | The simplest fix is to force LRADC_DELAY_TRIGGER_LRADCS_MASK to be a shift of an unsigned 0xff rather than a signed one. This is ugly considering it is the only constant in the driver which is so forced, but it does deal with the issue. Fixes: e0c961bdaf27 (iio: adc: mxs-lradc: Prefer using the BIT macro) Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/adc/mxs-lradc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index 5f1375c465e6..bb1f15224ac8 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -319,7 +319,7 @@ struct mxs_lradc { #define LRADC_CH_VALUE_OFFSET 0 #define LRADC_DELAY(n) (0xd0 + (0x10 * (n))) -#define LRADC_DELAY_TRIGGER_LRADCS_MASK (0xff << 24) +#define LRADC_DELAY_TRIGGER_LRADCS_MASK (0xffUL << 24) #define LRADC_DELAY_TRIGGER_LRADCS_OFFSET 24 #define LRADC_DELAY_TRIGGER(x) \ (((x) << LRADC_DELAY_TRIGGER_LRADCS_OFFSET) & \ From 8261d961d1f397925d7a470864c14663d01ed714 Mon Sep 17 00:00:00 2001 From: Daniel Baluta Date: Mon, 9 Nov 2015 09:13:59 +0200 Subject: [PATCH 481/843] iio: core: Introduce IIO configfs support This patch creates the IIO configfs root group. The group will appear under /iio/, usually /config/iio. We introduce configfs support in IIO in order to be able to easily create IIO objects from userspace. The first supported IIO objects are triggers introduced with next patches. Signed-off-by: Daniel Baluta Tested-by: Matt Ranostay Signed-off-by: Jonathan Cameron --- drivers/iio/Kconfig | 8 +++++ drivers/iio/Makefile | 1 + drivers/iio/industrialio-configfs.c | 50 +++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 drivers/iio/industrialio-configfs.c diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig index 6b8c77c97d40..9509b8a4c551 100644 --- a/drivers/iio/Kconfig +++ b/drivers/iio/Kconfig @@ -22,6 +22,14 @@ if IIO_BUFFER source "drivers/iio/buffer/Kconfig" endif # IIO_BUFFER +config IIO_CONFIGFS + tristate "Enable IIO configuration via configfs" + select CONFIGFS_FS + help + This allows configuring various IIO bits through configfs + (e.g. software triggers). For more info see + Documentation/iio/iio_configfs.txt. + config IIO_TRIGGER bool "Enable triggered sampling support" help diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile index 6769f2f43e86..39d119f18f2e 100644 --- a/drivers/iio/Makefile +++ b/drivers/iio/Makefile @@ -7,6 +7,7 @@ industrialio-y := industrialio-core.o industrialio-event.o inkern.o industrialio-$(CONFIG_IIO_BUFFER) += industrialio-buffer.o industrialio-$(CONFIG_IIO_TRIGGER) += industrialio-trigger.o +obj-$(CONFIG_IIO_CONFIGFS) += industrialio-configfs.o obj-$(CONFIG_IIO_TRIGGERED_EVENT) += industrialio-triggered-event.o obj-y += accel/ diff --git a/drivers/iio/industrialio-configfs.c b/drivers/iio/industrialio-configfs.c new file mode 100644 index 000000000000..83563dd7fcf4 --- /dev/null +++ b/drivers/iio/industrialio-configfs.c @@ -0,0 +1,50 @@ +/* + * Industrial I/O configfs bits + * + * Copyright (c) 2015 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#include +#include +#include +#include +#include + +#include + +static struct config_item_type iio_root_group_type = { + .ct_owner = THIS_MODULE, +}; + +struct configfs_subsystem iio_configfs_subsys = { + .su_group = { + .cg_item = { + .ci_namebuf = "iio", + .ci_type = &iio_root_group_type, + }, + }, + .su_mutex = __MUTEX_INITIALIZER(iio_configfs_subsys.su_mutex), +}; +EXPORT_SYMBOL(iio_configfs_subsys); + +static int __init iio_configfs_init(void) +{ + config_group_init(&iio_configfs_subsys.su_group); + + return configfs_register_subsystem(&iio_configfs_subsys); +} +module_init(iio_configfs_init); + +static void __exit iio_configfs_exit(void) +{ + configfs_unregister_subsystem(&iio_configfs_subsys); +} +module_exit(iio_configfs_exit); + +MODULE_AUTHOR("Daniel Baluta "); +MODULE_DESCRIPTION("Industrial I/O configfs support"); +MODULE_LICENSE("GPL v2"); From b662f809d41009749a9ee6f9a4db3d9af579e171 Mon Sep 17 00:00:00 2001 From: Daniel Baluta Date: Mon, 9 Nov 2015 09:14:00 +0200 Subject: [PATCH 482/843] iio: core: Introduce IIO software triggers A software trigger associates an IIO device trigger with a software interrupt source (e.g: timer, sysfs). This patch adds the generic infrastructure for handling software triggers. Software interrupts sources are kept in a iio_trigger_types_list and registered separately when the associated kernel module is loaded. Software triggers can be created directly from drivers or from user space via configfs interface. To sum up, this dynamically creates "triggers" group to be found under /config/iio/triggers and offers the possibility of dynamically creating trigger types groups. The first supported trigger type is "hrtimer" found under /config/iio/triggers/hrtimer. Signed-off-by: Daniel Baluta Signed-off-by: Jonathan Cameron --- drivers/iio/Kconfig | 8 ++ drivers/iio/Makefile | 1 + drivers/iio/industrialio-sw-trigger.c | 183 ++++++++++++++++++++++++++ include/linux/iio/sw_trigger.h | 71 ++++++++++ 4 files changed, 263 insertions(+) create mode 100644 drivers/iio/industrialio-sw-trigger.c create mode 100644 include/linux/iio/sw_trigger.h diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig index 9509b8a4c551..ac8715e56ba1 100644 --- a/drivers/iio/Kconfig +++ b/drivers/iio/Kconfig @@ -46,6 +46,14 @@ config IIO_CONSUMERS_PER_TRIGGER This value controls the maximum number of consumers that a given trigger may handle. Default is 2. +config IIO_SW_TRIGGER + tristate "Enable software triggers support" + select IIO_CONFIGFS + help + Provides IIO core support for software triggers. A software + trigger can be created via configfs or directly by a driver + using the API provided. + config IIO_TRIGGERED_EVENT tristate select IIO_TRIGGER diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile index 39d119f18f2e..f670b82298aa 100644 --- a/drivers/iio/Makefile +++ b/drivers/iio/Makefile @@ -8,6 +8,7 @@ industrialio-$(CONFIG_IIO_BUFFER) += industrialio-buffer.o industrialio-$(CONFIG_IIO_TRIGGER) += industrialio-trigger.o obj-$(CONFIG_IIO_CONFIGFS) += industrialio-configfs.o +obj-$(CONFIG_IIO_SW_TRIGGER) += industrialio-sw-trigger.o obj-$(CONFIG_IIO_TRIGGERED_EVENT) += industrialio-triggered-event.o obj-y += accel/ diff --git a/drivers/iio/industrialio-sw-trigger.c b/drivers/iio/industrialio-sw-trigger.c new file mode 100644 index 000000000000..4825cfd9c4ea --- /dev/null +++ b/drivers/iio/industrialio-sw-trigger.c @@ -0,0 +1,183 @@ +/* + * The Industrial I/O core, software trigger functions + * + * Copyright (c) 2015 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#include +#include +#include +#include +#include + +#include +#include + +static struct config_group *iio_triggers_group; +static struct config_item_type iio_trigger_type_group_type; + +static struct config_item_type iio_triggers_group_type = { + .ct_owner = THIS_MODULE, +}; + +static LIST_HEAD(iio_trigger_types_list); +static DEFINE_MUTEX(iio_trigger_types_lock); + +static +struct iio_sw_trigger_type *__iio_find_sw_trigger_type(const char *name, + unsigned len) +{ + struct iio_sw_trigger_type *t = NULL, *iter; + + list_for_each_entry(iter, &iio_trigger_types_list, list) + if (!strcmp(iter->name, name)) { + t = iter; + break; + } + + return t; +} + +int iio_register_sw_trigger_type(struct iio_sw_trigger_type *t) +{ + struct iio_sw_trigger_type *iter; + int ret = 0; + + mutex_lock(&iio_trigger_types_lock); + iter = __iio_find_sw_trigger_type(t->name, strlen(t->name)); + if (iter) + ret = -EBUSY; + else + list_add_tail(&t->list, &iio_trigger_types_list); + mutex_unlock(&iio_trigger_types_lock); + + if (ret) + return ret; + + t->group = configfs_register_default_group(iio_triggers_group, t->name, + &iio_trigger_type_group_type); + if (IS_ERR(t->group)) + ret = PTR_ERR(t->group); + + return ret; +} +EXPORT_SYMBOL(iio_register_sw_trigger_type); + +void iio_unregister_sw_trigger_type(struct iio_sw_trigger_type *t) +{ + struct iio_sw_trigger_type *iter; + + mutex_lock(&iio_trigger_types_lock); + iter = __iio_find_sw_trigger_type(t->name, strlen(t->name)); + if (iter) + list_del(&t->list); + mutex_unlock(&iio_trigger_types_lock); + + configfs_unregister_default_group(t->group); +} +EXPORT_SYMBOL(iio_unregister_sw_trigger_type); + +static +struct iio_sw_trigger_type *iio_get_sw_trigger_type(const char *name) +{ + struct iio_sw_trigger_type *t; + + mutex_lock(&iio_trigger_types_lock); + t = __iio_find_sw_trigger_type(name, strlen(name)); + if (t && !try_module_get(t->owner)) + t = NULL; + mutex_unlock(&iio_trigger_types_lock); + + return t; +} + +struct iio_sw_trigger *iio_sw_trigger_create(const char *type, const char *name) +{ + struct iio_sw_trigger *t; + struct iio_sw_trigger_type *tt; + + tt = iio_get_sw_trigger_type(type); + if (!tt) { + pr_err("Invalid trigger type: %s\n", type); + return ERR_PTR(-EINVAL); + } + t = tt->ops->probe(name); + if (IS_ERR(t)) + goto out_module_put; + + t->trigger_type = tt; + + return t; +out_module_put: + module_put(tt->owner); + return t; +} +EXPORT_SYMBOL(iio_sw_trigger_create); + +void iio_sw_trigger_destroy(struct iio_sw_trigger *t) +{ + struct iio_sw_trigger_type *tt = t->trigger_type; + + tt->ops->remove(t); + module_put(tt->owner); +} +EXPORT_SYMBOL(iio_sw_trigger_destroy); + +static struct config_group *trigger_make_group(struct config_group *group, + const char *name) +{ + struct iio_sw_trigger *t; + + t = iio_sw_trigger_create(group->cg_item.ci_name, name); + if (IS_ERR(t)) + return ERR_CAST(t); + + config_item_set_name(&t->group.cg_item, "%s", name); + + return &t->group; +} + +static void trigger_drop_group(struct config_group *group, + struct config_item *item) +{ + struct iio_sw_trigger *t = to_iio_sw_trigger(item); + + iio_sw_trigger_destroy(t); + config_item_put(item); +} + +static struct configfs_group_operations trigger_ops = { + .make_group = &trigger_make_group, + .drop_item = &trigger_drop_group, +}; + +static struct config_item_type iio_trigger_type_group_type = { + .ct_group_ops = &trigger_ops, + .ct_owner = THIS_MODULE, +}; + +static int __init iio_sw_trigger_init(void) +{ + iio_triggers_group = + configfs_register_default_group(&iio_configfs_subsys.su_group, + "triggers", + &iio_triggers_group_type); + if (IS_ERR(iio_triggers_group)) + return PTR_ERR(iio_triggers_group); + return 0; +} +module_init(iio_sw_trigger_init); + +static void __exit iio_sw_trigger_exit(void) +{ + configfs_unregister_default_group(iio_triggers_group); +} +module_exit(iio_sw_trigger_exit); + +MODULE_AUTHOR("Daniel Baluta "); +MODULE_DESCRIPTION("Industrial I/O software triggers support"); +MODULE_LICENSE("GPL v2"); diff --git a/include/linux/iio/sw_trigger.h b/include/linux/iio/sw_trigger.h new file mode 100644 index 000000000000..c2f33b2b35a5 --- /dev/null +++ b/include/linux/iio/sw_trigger.h @@ -0,0 +1,71 @@ +/* + * Industrial I/O software trigger interface + * + * Copyright (c) 2015 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#ifndef __IIO_SW_TRIGGER +#define __IIO_SW_TRIGGER + +#include +#include +#include +#include + +#define module_iio_sw_trigger_driver(__iio_sw_trigger_type) \ + module_driver(__iio_sw_trigger_type, iio_register_sw_trigger_type, \ + iio_unregister_sw_trigger_type) + +extern struct configfs_subsystem iio_configfs_subsys; +struct iio_sw_trigger_ops; + +struct iio_sw_trigger_type { + const char *name; + struct module *owner; + const struct iio_sw_trigger_ops *ops; + struct list_head list; + struct config_group *group; +}; + +struct iio_sw_trigger { + struct iio_trigger *trigger; + struct iio_sw_trigger_type *trigger_type; + struct config_group group; +}; + +struct iio_sw_trigger_ops { + struct iio_sw_trigger* (*probe)(const char *); + int (*remove)(struct iio_sw_trigger *); +}; + +static inline +struct iio_sw_trigger *to_iio_sw_trigger(struct config_item *item) +{ + return container_of(to_config_group(item), struct iio_sw_trigger, + group); +} + +int iio_register_sw_trigger_type(struct iio_sw_trigger_type *tt); +void iio_unregister_sw_trigger_type(struct iio_sw_trigger_type *tt); + +struct iio_sw_trigger *iio_sw_trigger_create(const char *, const char *); +void iio_sw_trigger_destroy(struct iio_sw_trigger *); + +int iio_sw_trigger_type_configfs_register(struct iio_sw_trigger_type *tt); +void iio_sw_trigger_type_configfs_unregister(struct iio_sw_trigger_type *tt); + +static inline +void iio_swt_group_init_type_name(struct iio_sw_trigger *t, + const char *name, + struct config_item_type *type) +{ +#ifdef CONFIG_CONFIGFS_FS + config_group_init_type_name(&t->group, name, type); +#endif +} + +#endif /* __IIO_SW_TRIGGER */ From ac5006a2a558a2441a840c7be1e0e717839d5e07 Mon Sep 17 00:00:00 2001 From: Daniel Baluta Date: Mon, 9 Nov 2015 09:14:01 +0200 Subject: [PATCH 483/843] iio: trigger: Introduce IIO hrtimer based trigger This patch registers a new IIO software trigger interrupt source based on high resolution timers. Notice that if configfs is enabled we create sampling_frequency attribute allowing users to change hrtimer period (1/sampling_frequency). The IIO hrtimer trigger has a long history, this patch is based on an older version from Marten and Lars-Peter. Signed-off-by: Marten Svanfeldt Signed-off-by: Lars-Peter Clausen Signed-off-by: Daniel Baluta Signed-off-by: Jonathan Cameron --- drivers/iio/trigger/Kconfig | 10 ++ drivers/iio/trigger/Makefile | 2 + drivers/iio/trigger/iio-trig-hrtimer.c | 193 +++++++++++++++++++++++++ 3 files changed, 205 insertions(+) create mode 100644 drivers/iio/trigger/iio-trig-hrtimer.c diff --git a/drivers/iio/trigger/Kconfig b/drivers/iio/trigger/Kconfig index 79996123a71b..519e6772f6f5 100644 --- a/drivers/iio/trigger/Kconfig +++ b/drivers/iio/trigger/Kconfig @@ -5,6 +5,16 @@ menu "Triggers - standalone" +config IIO_HRTIMER_TRIGGER + tristate "High resolution timer trigger" + depends on IIO_SW_TRIGGER + help + Provides a frequency based IIO trigger using high resolution + timers as interrupt source. + + To compile this driver as a module, choose M here: the + module will be called iio-trig-hrtimer. + config IIO_INTERRUPT_TRIGGER tristate "Generic interrupt trigger" help diff --git a/drivers/iio/trigger/Makefile b/drivers/iio/trigger/Makefile index 0694daecaf22..fe06eb564367 100644 --- a/drivers/iio/trigger/Makefile +++ b/drivers/iio/trigger/Makefile @@ -3,5 +3,7 @@ # # When adding new entries keep the list in alphabetical order + +obj-$(CONFIG_IIO_HRTIMER_TRIGGER) += iio-trig-hrtimer.o obj-$(CONFIG_IIO_INTERRUPT_TRIGGER) += iio-trig-interrupt.o obj-$(CONFIG_IIO_SYSFS_TRIGGER) += iio-trig-sysfs.o diff --git a/drivers/iio/trigger/iio-trig-hrtimer.c b/drivers/iio/trigger/iio-trig-hrtimer.c new file mode 100644 index 000000000000..5e6d451febeb --- /dev/null +++ b/drivers/iio/trigger/iio-trig-hrtimer.c @@ -0,0 +1,193 @@ +/** + * The industrial I/O periodic hrtimer trigger driver + * + * Copyright (C) Intuitive Aerial AB + * Written by Marten Svanfeldt, marten@intuitiveaerial.com + * Copyright (C) 2012, Analog Device Inc. + * Author: Lars-Peter Clausen + * Copyright (C) 2015, Intel Corporation + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + * + */ +#include +#include +#include + +#include +#include +#include + +/* default sampling frequency - 100Hz */ +#define HRTIMER_DEFAULT_SAMPLING_FREQUENCY 100 + +struct iio_hrtimer_info { + struct iio_sw_trigger swt; + struct hrtimer timer; + unsigned long sampling_frequency; + ktime_t period; +}; + +static struct config_item_type iio_hrtimer_type = { + .ct_owner = THIS_MODULE, +}; + +static +ssize_t iio_hrtimer_show_sampling_frequency(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct iio_trigger *trig = to_iio_trigger(dev); + struct iio_hrtimer_info *info = iio_trigger_get_drvdata(trig); + + return snprintf(buf, PAGE_SIZE, "%lu\n", info->sampling_frequency); +} + +static +ssize_t iio_hrtimer_store_sampling_frequency(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct iio_trigger *trig = to_iio_trigger(dev); + struct iio_hrtimer_info *info = iio_trigger_get_drvdata(trig); + unsigned long val; + int ret; + + ret = kstrtoul(buf, 10, &val); + if (ret) + return ret; + + if (!val || val > NSEC_PER_SEC) + return -EINVAL; + + info->sampling_frequency = val; + info->period = ktime_set(0, NSEC_PER_SEC / val); + + return len; +} + +static DEVICE_ATTR(sampling_frequency, S_IRUGO | S_IWUSR, + iio_hrtimer_show_sampling_frequency, + iio_hrtimer_store_sampling_frequency); + +static struct attribute *iio_hrtimer_attrs[] = { + &dev_attr_sampling_frequency.attr, + NULL +}; + +static const struct attribute_group iio_hrtimer_attr_group = { + .attrs = iio_hrtimer_attrs, +}; + +static const struct attribute_group *iio_hrtimer_attr_groups[] = { + &iio_hrtimer_attr_group, + NULL +}; + +static enum hrtimer_restart iio_hrtimer_trig_handler(struct hrtimer *timer) +{ + struct iio_hrtimer_info *info; + + info = container_of(timer, struct iio_hrtimer_info, timer); + + hrtimer_forward_now(timer, info->period); + iio_trigger_poll(info->swt.trigger); + + return HRTIMER_RESTART; +} + +static int iio_trig_hrtimer_set_state(struct iio_trigger *trig, bool state) +{ + struct iio_hrtimer_info *trig_info; + + trig_info = iio_trigger_get_drvdata(trig); + + if (state) + hrtimer_start(&trig_info->timer, trig_info->period, + HRTIMER_MODE_REL); + else + hrtimer_cancel(&trig_info->timer); + + return 0; +} + +static const struct iio_trigger_ops iio_hrtimer_trigger_ops = { + .owner = THIS_MODULE, + .set_trigger_state = iio_trig_hrtimer_set_state, +}; + +static struct iio_sw_trigger *iio_trig_hrtimer_probe(const char *name) +{ + struct iio_hrtimer_info *trig_info; + int ret; + + trig_info = kzalloc(sizeof(*trig_info), GFP_KERNEL); + if (!trig_info) + return ERR_PTR(-ENOMEM); + + trig_info->swt.trigger = iio_trigger_alloc("%s", name); + if (!trig_info->swt.trigger) { + ret = -ENOMEM; + goto err_free_trig_info; + } + + iio_trigger_set_drvdata(trig_info->swt.trigger, trig_info); + trig_info->swt.trigger->ops = &iio_hrtimer_trigger_ops; + trig_info->swt.trigger->dev.groups = iio_hrtimer_attr_groups; + + hrtimer_init(&trig_info->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); + trig_info->timer.function = iio_hrtimer_trig_handler; + + trig_info->sampling_frequency = HRTIMER_DEFAULT_SAMPLING_FREQUENCY; + trig_info->period = ktime_set(0, NSEC_PER_SEC / + trig_info->sampling_frequency); + + ret = iio_trigger_register(trig_info->swt.trigger); + if (ret) + goto err_free_trigger; + + iio_swt_group_init_type_name(&trig_info->swt, name, &iio_hrtimer_type); + return &trig_info->swt; +err_free_trigger: + iio_trigger_free(trig_info->swt.trigger); +err_free_trig_info: + kfree(trig_info); + + return ERR_PTR(ret); +} + +static int iio_trig_hrtimer_remove(struct iio_sw_trigger *swt) +{ + struct iio_hrtimer_info *trig_info; + + trig_info = iio_trigger_get_drvdata(swt->trigger); + + iio_trigger_unregister(swt->trigger); + + /* cancel the timer after unreg to make sure no one rearms it */ + hrtimer_cancel(&trig_info->timer); + iio_trigger_free(swt->trigger); + kfree(trig_info); + + return 0; +} + +static const struct iio_sw_trigger_ops iio_trig_hrtimer_ops = { + .probe = iio_trig_hrtimer_probe, + .remove = iio_trig_hrtimer_remove, +}; + +static struct iio_sw_trigger_type iio_trig_hrtimer = { + .name = "hrtimer", + .owner = THIS_MODULE, + .ops = &iio_trig_hrtimer_ops, +}; + +module_iio_sw_trigger_driver(iio_trig_hrtimer); + +MODULE_AUTHOR("Marten Svanfeldt "); +MODULE_AUTHOR("Daniel Baluta "); +MODULE_DESCRIPTION("Periodic hrtimer trigger for the IIO subsystem"); +MODULE_LICENSE("GPL v2"); From 4c3e2a4036054deca4819758f59ff65f27938388 Mon Sep 17 00:00:00 2001 From: Daniel Baluta Date: Mon, 9 Nov 2015 09:14:02 +0200 Subject: [PATCH 484/843] iio: Documentation: Add IIO configfs documentation Signed-off-by: Daniel Baluta Acked-by: Crt Mori Signed-off-by: Jonathan Cameron --- Documentation/ABI/testing/configfs-iio | 21 ++++++ Documentation/iio/iio_configfs.txt | 93 ++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 Documentation/ABI/testing/configfs-iio create mode 100644 Documentation/iio/iio_configfs.txt diff --git a/Documentation/ABI/testing/configfs-iio b/Documentation/ABI/testing/configfs-iio new file mode 100644 index 000000000000..2483756fccf5 --- /dev/null +++ b/Documentation/ABI/testing/configfs-iio @@ -0,0 +1,21 @@ +What: /config/iio +Date: October 2015 +KernelVersion: 4.4 +Contact: linux-iio@vger.kernel.org +Description: + This represents Industrial IO configuration entry point + directory. It contains sub-groups corresponding to IIO + objects. + +What: /config/iio/triggers +Date: October 2015 +KernelVersion: 4.4 +Description: + Industrial IO software triggers directory. + +What: /config/iio/triggers/hrtimers +Date: October 2015 +KernelVersion: 4.4 +Description: + High resolution timers directory. Creating a directory here + will result in creating a hrtimer trigger in the IIO subsystem. diff --git a/Documentation/iio/iio_configfs.txt b/Documentation/iio/iio_configfs.txt new file mode 100644 index 000000000000..f0add35cd52e --- /dev/null +++ b/Documentation/iio/iio_configfs.txt @@ -0,0 +1,93 @@ +Industrial IIO configfs support + +1. Overview + +Configfs is a filesystem-based manager of kernel objects. IIO uses some +objects that could be easily configured using configfs (e.g.: devices, +triggers). + +See Documentation/filesystems/configfs/configfs.txt for more information +about how configfs works. + +2. Usage + +In order to use configfs support in IIO we need to select it at compile +time via CONFIG_IIO_CONFIGFS config option. + +Then, mount the configfs filesystem (usually under /config directory): + +$ mkdir /config +$ mount -t configfs none /config + +At this point, all default IIO groups will be created and can be accessed +under /config/iio. Next chapters will describe available IIO configuration +objects. + +3. Software triggers + +One of the IIO default configfs groups is the "triggers" group. It is +automagically accessible when the configfs is mounted and can be found +under /config/iio/triggers. + +IIO software triggers implementation offers support for creating multiple +trigger types. A new trigger type is usually implemented as a separate +kernel module following the interface in include/linux/iio/sw_trigger.h: + +/* + * drivers/iio/trigger/iio-trig-sample.c + * sample kernel module implementing a new trigger type + */ +#include + + +static struct iio_sw_trigger *iio_trig_sample_probe(const char *name) +{ + /* + * This allocates and registers an IIO trigger plus other + * trigger type specific initialization. + */ +} + +static int iio_trig_hrtimer_remove(struct iio_sw_trigger *swt) +{ + /* + * This undoes the actions in iio_trig_sample_probe + */ +} + +static const struct iio_sw_trigger_ops iio_trig_sample_ops = { + .probe = iio_trig_sample_probe, + .remove = iio_trig_sample_remove, +}; + +static struct iio_sw_trigger_type iio_trig_sample = { + .name = "trig-sample", + .owner = THIS_MODULE, + .ops = &iio_trig_sample_ops, +}; + +module_iio_sw_trigger_driver(iio_trig_sample); + +Each trigger type has its own directory under /config/iio/triggers. Loading +iio-trig-sample module will create 'trig-sample' trigger type directory +/config/iio/triggers/trig-sample. + +We support the following interrupt sources (trigger types): + * hrtimer, uses high resolution timers as interrupt source + +3.1 Hrtimer triggers creation and destruction + +Loading iio-trig-hrtimer module will register hrtimer trigger types allowing +users to create hrtimer triggers under /config/iio/triggers/hrtimer. + +e.g: + +$ mkdir /config/triggers/hrtimer/instance1 +$ rmdir /config/triggers/hrtimer/instance1 + +Each trigger can have one or more attributes specific to the trigger type. + +3.2 "hrtimer" trigger types attributes + +"hrtimer" trigger type doesn't have any configurable attribute from /config dir. +It does introduce the sampling_frequency attribute to trigger directory. From 93e87d73cc46685902bffb0928c2514eaf209b44 Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Tue, 1 Dec 2015 21:47:20 -0800 Subject: [PATCH 485/843] iio: chemical: vz89x: rework i2c transfer reading Add an optimized i2c transfer reading function, and fallback to racey smbus transfers if client->adapter doesn't support this. Signed-off-by: Matt Ranostay Signed-off-by: Jonathan Cameron --- drivers/iio/chemical/vz89x.c | 70 +++++++++++++++++++++++++++--------- 1 file changed, 54 insertions(+), 16 deletions(-) diff --git a/drivers/iio/chemical/vz89x.c b/drivers/iio/chemical/vz89x.c index 11e59a5a5112..b8b804923230 100644 --- a/drivers/iio/chemical/vz89x.c +++ b/drivers/iio/chemical/vz89x.c @@ -34,8 +34,9 @@ struct vz89x_data { struct i2c_client *client; struct mutex lock; - unsigned long last_update; + int (*xfer)(struct vz89x_data *data, u8 cmd); + unsigned long last_update; u8 buffer[VZ89X_REG_MEASUREMENT_SIZE]; }; @@ -100,27 +101,60 @@ static int vz89x_measurement_is_valid(struct vz89x_data *data) return !!(data->buffer[VZ89X_REG_MEASUREMENT_SIZE - 1] > 0); } +static int vz89x_i2c_xfer(struct vz89x_data *data, u8 cmd) +{ + struct i2c_client *client = data->client; + struct i2c_msg msg[2]; + int ret; + u8 buf[3] = { cmd, 0, 0}; + + msg[0].addr = client->addr; + msg[0].flags = client->flags; + msg[0].len = 3; + msg[0].buf = (char *) &buf; + + msg[1].addr = client->addr; + msg[1].flags = client->flags | I2C_M_RD; + msg[1].len = VZ89X_REG_MEASUREMENT_SIZE; + msg[1].buf = (char *) &data->buffer; + + ret = i2c_transfer(client->adapter, msg, 2); + + return (ret == 2) ? 0 : ret; +} + +static int vz89x_smbus_xfer(struct vz89x_data *data, u8 cmd) +{ + struct i2c_client *client = data->client; + int ret; + int i; + + ret = i2c_smbus_write_word_data(client, cmd, 0); + if (ret < 0) + return ret; + + for (i = 0; i < VZ89X_REG_MEASUREMENT_SIZE; i++) { + ret = i2c_smbus_read_byte(client); + if (ret < 0) + return ret; + data->buffer[i] = ret; + } + + return 0; +} + static int vz89x_get_measurement(struct vz89x_data *data) { int ret; - int i; /* sensor can only be polled once a second max per datasheet */ if (!time_after(jiffies, data->last_update + HZ)) return 0; - ret = i2c_smbus_write_word_data(data->client, - VZ89X_REG_MEASUREMENT, 0); + ret = data->xfer(data, VZ89X_REG_MEASUREMENT); if (ret < 0) return ret; - for (i = 0; i < VZ89X_REG_MEASUREMENT_SIZE; i++) { - ret = i2c_smbus_read_byte(data->client); - if (ret < 0) - return ret; - data->buffer[i] = ret; - } - ret = vz89x_measurement_is_valid(data); if (ret) return -EAGAIN; @@ -204,15 +238,19 @@ static int vz89x_probe(struct i2c_client *client, struct iio_dev *indio_dev; struct vz89x_data *data; - if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA | - I2C_FUNC_SMBUS_BYTE)) - return -ENODEV; - indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); if (!indio_dev) return -ENOMEM; - data = iio_priv(indio_dev); + + if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) + data->xfer = vz89x_i2c_xfer; + else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BYTE)) + data->xfer = vz89x_smbus_xfer; + else + return -ENOTSUPP; + i2c_set_clientdata(client, indio_dev); data->client = client; data->last_update = jiffies - HZ; From 8d6c16dd7213fa43702416e3dd1059e9e36bc758 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Sat, 5 Dec 2015 16:23:26 +0000 Subject: [PATCH 486/843] iio:configfs: Introduce iio/configfs.h to provide a location for the configfs_subsystem This exported element needs to be accesible to all drivers using configfs within IIO. Previously it was in the sw_trig.h file which only convered one such usecase. This also fixes a sparse warning as it is now in a header that makes sense to include from industrialio-configfs.c Signed-off-by: Jonathan Cameron < jic23@kernel.org> --- drivers/iio/industrialio-configfs.c | 1 + drivers/iio/industrialio-sw-trigger.c | 1 + include/linux/iio/configfs.h | 15 +++++++++++++++ include/linux/iio/sw_trigger.h | 1 - 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 include/linux/iio/configfs.h diff --git a/drivers/iio/industrialio-configfs.c b/drivers/iio/industrialio-configfs.c index 83563dd7fcf4..45ce2bc47180 100644 --- a/drivers/iio/industrialio-configfs.c +++ b/drivers/iio/industrialio-configfs.c @@ -15,6 +15,7 @@ #include #include +#include static struct config_item_type iio_root_group_type = { .ct_owner = THIS_MODULE, diff --git a/drivers/iio/industrialio-sw-trigger.c b/drivers/iio/industrialio-sw-trigger.c index 4825cfd9c4ea..311f9fe5aa34 100644 --- a/drivers/iio/industrialio-sw-trigger.c +++ b/drivers/iio/industrialio-sw-trigger.c @@ -15,6 +15,7 @@ #include #include +#include #include static struct config_group *iio_triggers_group; diff --git a/include/linux/iio/configfs.h b/include/linux/iio/configfs.h new file mode 100644 index 000000000000..93befd67c15c --- /dev/null +++ b/include/linux/iio/configfs.h @@ -0,0 +1,15 @@ +/* + * Industrial I/O configfs support + * + * Copyright (c) 2015 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ +#ifndef __IIO_CONFIGFS +#define __IIO_CONFIGFS + +extern struct configfs_subsystem iio_configfs_subsys; + +#endif /* __IIO_CONFIGFS */ diff --git a/include/linux/iio/sw_trigger.h b/include/linux/iio/sw_trigger.h index c2f33b2b35a5..5198f8ed08a4 100644 --- a/include/linux/iio/sw_trigger.h +++ b/include/linux/iio/sw_trigger.h @@ -20,7 +20,6 @@ module_driver(__iio_sw_trigger_type, iio_register_sw_trigger_type, \ iio_unregister_sw_trigger_type) -extern struct configfs_subsystem iio_configfs_subsys; struct iio_sw_trigger_ops; struct iio_sw_trigger_type { From 366e65633cf4f117609965cd6e189f2cd11533d2 Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Tue, 1 Dec 2015 21:05:22 -0800 Subject: [PATCH 487/843] iio: proximity: lidar: optimize i2c transactions Optimize device tranactions using i2c transfers versus multiple possibly racey i2c_smbus_* function calls, and only one transaction for distance measurement. Falls back to smbus method if i2c functionality isn't available. Signed-off-by: Matt Ranostay Signed-off-by: Jonathan Cameron --- .../iio/proximity/pulsedlight-lidar-lite-v2.c | 97 ++++++++++++++----- 1 file changed, 71 insertions(+), 26 deletions(-) diff --git a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c index be8ccef735f8..e7ea44d61942 100644 --- a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +++ b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c @@ -36,8 +36,10 @@ #define LIDAR_REG_STATUS_INVALID BIT(3) #define LIDAR_REG_STATUS_READY BIT(0) -#define LIDAR_REG_DATA_HBYTE 0x0f -#define LIDAR_REG_DATA_LBYTE 0x10 +#define LIDAR_REG_DATA_HBYTE 0x0f +#define LIDAR_REG_DATA_LBYTE 0x10 +#define LIDAR_REG_DATA_WORD_READ BIT(7) + #define LIDAR_REG_PWR_CONTROL 0x65 #define LIDAR_DRV_NAME "lidar" @@ -46,6 +48,9 @@ struct lidar_data { struct iio_dev *indio_dev; struct i2c_client *client; + int (*xfer)(struct lidar_data *data, u8 reg, u8 *val, int len); + int i2c_enabled; + u16 buffer[8]; /* 2 byte distance + 8 byte timestamp */ }; @@ -64,7 +69,28 @@ static const struct iio_chan_spec lidar_channels[] = { IIO_CHAN_SOFT_TIMESTAMP(1), }; -static int lidar_read_byte(struct lidar_data *data, int reg) +static int lidar_i2c_xfer(struct lidar_data *data, u8 reg, u8 *val, int len) +{ + struct i2c_client *client = data->client; + struct i2c_msg msg[2]; + int ret; + + msg[0].addr = client->addr; + msg[0].flags = client->flags | I2C_M_STOP; + msg[0].len = 1; + msg[0].buf = (char *) ® + + msg[1].addr = client->addr; + msg[1].flags = client->flags | I2C_M_RD; + msg[1].len = len; + msg[1].buf = (char *) val; + + ret = i2c_transfer(client->adapter, msg, 2); + + return (ret == 2) ? 0 : ret; +} + +static int lidar_smbus_xfer(struct lidar_data *data, u8 reg, u8 *val, int len) { struct i2c_client *client = data->client; int ret; @@ -74,17 +100,35 @@ static int lidar_read_byte(struct lidar_data *data, int reg) * so in turn i2c_smbus_read_byte_data cannot be used */ - ret = i2c_smbus_write_byte(client, reg); - if (ret < 0) { - dev_err(&client->dev, "cannot write addr value"); - return ret; + while (len--) { + ret = i2c_smbus_write_byte(client, reg++); + if (ret < 0) { + dev_err(&client->dev, "cannot write addr value"); + return ret; + } + + ret = i2c_smbus_read_byte(client); + if (ret < 0) { + dev_err(&client->dev, "cannot read data value"); + return ret; + } + + *(val++) = ret; } - ret = i2c_smbus_read_byte(client); - if (ret < 0) - dev_err(&client->dev, "cannot read data value"); + return 0; +} - return ret; +static int lidar_read_byte(struct lidar_data *data, u8 reg) +{ + int ret; + u8 val; + + ret = data->xfer(data, reg, &val, 1); + if (ret < 0) + return ret; + + return val; } static inline int lidar_write_control(struct lidar_data *data, int val) @@ -100,22 +144,14 @@ static inline int lidar_write_power(struct lidar_data *data, int val) static int lidar_read_measurement(struct lidar_data *data, u16 *reg) { - int ret; - int val; + int ret = data->xfer(data, LIDAR_REG_DATA_HBYTE | + (data->i2c_enabled ? LIDAR_REG_DATA_WORD_READ : 0), + (u8 *) reg, 2); - ret = lidar_read_byte(data, LIDAR_REG_DATA_HBYTE); - if (ret < 0) - return ret; - val = ret << 8; + if (!ret) + *reg = be16_to_cpu(*reg); - ret = lidar_read_byte(data, LIDAR_REG_DATA_LBYTE); - if (ret < 0) - return ret; - - val |= ret; - *reg = val; - - return 0; + return ret; } static int lidar_get_measurement(struct lidar_data *data, u16 *reg) @@ -233,6 +269,16 @@ static int lidar_probe(struct i2c_client *client, indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); if (!indio_dev) return -ENOMEM; + data = iio_priv(indio_dev); + + if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { + data->xfer = lidar_i2c_xfer; + data->i2c_enabled = 1; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BYTE)) + data->xfer = lidar_smbus_xfer; + else + return -ENOTSUPP; indio_dev->info = &lidar_info; indio_dev->name = LIDAR_DRV_NAME; @@ -240,7 +286,6 @@ static int lidar_probe(struct i2c_client *client, indio_dev->num_channels = ARRAY_SIZE(lidar_channels); indio_dev->modes = INDIO_DIRECT_MODE; - data = iio_priv(indio_dev); i2c_set_clientdata(client, indio_dev); data->client = client; From ec0096f853fef46000c80bb3fd035d8376d957ac Mon Sep 17 00:00:00 2001 From: Robert Kmiec Date: Fri, 4 Dec 2015 00:54:48 +0100 Subject: [PATCH 488/843] iio: st_accel_core: Remove unneeded define Definition of ST_SENSORS_WAI_ADDRESS was introduced within a very first commit of this driver, but it was never used. This address is already defined as ST_SENSORS_DEFAULT_WAI_ADDRESS in include/linux/iio/common/st_sensors.h To avoid duplication of the same constant in two different places called almost exactly the same, the one which was never used should be removed. Signed-off-by: Robert Kmiec Signed-off-by: Jonathan Cameron --- drivers/iio/common/st_sensors/st_sensors_core.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index 25258e2c1a82..8447c31e27f2 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c @@ -18,9 +18,6 @@ #include #include - -#define ST_SENSORS_WAI_ADDRESS 0x0f - static inline u32 st_sensors_get_unaligned_le24(const u8 *p) { return (s32)((p[0] | p[1] << 8 | p[2] << 16) << 8) >> 8; From 9ab655a32e008bfe906b0bf8fb907b412f7c2e87 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Fri, 4 Dec 2015 00:28:17 +0100 Subject: [PATCH 489/843] staging: iio: select IRQ_WORK for IIO_DUMMY_EVGEN The iio dummy code was recently changed to use irq_work_queue, but that code is compiled into the kernel only if IRQ_WORK is set, so we can get a link error here: drivers/built-in.o: In function `iio_evgen_poke': (.text+0x208a04): undefined reference to `irq_work_queue' This changes the Kconfig file to match what other drivers do. Signed-off-by: Arnd Bergmann Fixes: fd2bb310ca3d ("Staging: iio: Move evgen interrupt generation to irq_work") Acked-by: Daniel Baluta Signed-off-by: Jonathan Cameron --- drivers/iio/dummy/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iio/dummy/Kconfig b/drivers/iio/dummy/Kconfig index e8676aa97d62..71805ced1aae 100644 --- a/drivers/iio/dummy/Kconfig +++ b/drivers/iio/dummy/Kconfig @@ -5,7 +5,8 @@ menu "IIO dummy driver" depends on IIO config IIO_DUMMY_EVGEN - tristate + select IRQ_WORK + tristate config IIO_SIMPLE_DUMMY tristate "An example driver with no hardware requirements" From b41fa86b67bd338d4ffa0b69f0fb1c3013a489e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=A4bler?= Date: Wed, 9 Dec 2015 10:24:04 +0100 Subject: [PATCH 490/843] iio:adc128s052: add support for adc124s021 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Oliver Stäbler Reviewed-by: Martin Kepplinger Signed-off-by: Jonathan Cameron --- .../devicetree/bindings/iio/adc/ti-adc128s052.txt | 4 ++-- drivers/iio/adc/Kconfig | 6 +++--- drivers/iio/adc/ti-adc128s052.c | 13 ++++++++++++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt b/Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt index 15ca6b47958e..daa2b2c29428 100644 --- a/Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt +++ b/Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt @@ -1,7 +1,7 @@ -* Texas Instruments' ADC128S052 and ADC122S021 ADC chip +* Texas Instruments' ADC128S052, ADC122S021 and ADC124S021 ADC chip Required properties: - - compatible: Should be "ti,adc128s052" or "ti,adc122s021" + - compatible: Should be "ti,adc128s052", "ti,adc122s021" or "ti,adc124s021" - reg: spi chip select number for the device - vref-supply: The regulator supply for ADC reference voltage diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 9162dfefff30..57e3ca0b7ff4 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -332,11 +332,11 @@ config TI_ADC081C called ti-adc081c. config TI_ADC128S052 - tristate "Texas Instruments ADC128S052/ADC122S021" + tristate "Texas Instruments ADC128S052/ADC122S021/ADC124S021" depends on SPI help - If you say yes here you get support for Texas Instruments ADC128S052 - and ADC122S021 chips. + If you say yes here you get support for Texas Instruments ADC128S052, + ADC122S021 and ADC124S021 chips. This driver can also be built as a module. If so, the module will be called ti-adc128s052. diff --git a/drivers/iio/adc/ti-adc128s052.c b/drivers/iio/adc/ti-adc128s052.c index ff6f7f63c8d9..bc58867d6e8d 100644 --- a/drivers/iio/adc/ti-adc128s052.c +++ b/drivers/iio/adc/ti-adc128s052.c @@ -1,10 +1,11 @@ /* * Copyright (C) 2014 Angelo Compagnucci * - * Driver for Texas Instruments' ADC128S052 and ADC122S021 ADC chip. + * Driver for Texas Instruments' ADC128S052, ADC122S021 and ADC124S021 ADC chip. * Datasheets can be found here: * http://www.ti.com/lit/ds/symlink/adc128s052.pdf * http://www.ti.com/lit/ds/symlink/adc122s021.pdf + * http://www.ti.com/lit/ds/symlink/adc124s021.pdf * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -114,9 +115,17 @@ static const struct iio_chan_spec adc122s021_channels[] = { ADC128_VOLTAGE_CHANNEL(1), }; +static const struct iio_chan_spec adc124s021_channels[] = { + ADC128_VOLTAGE_CHANNEL(0), + ADC128_VOLTAGE_CHANNEL(1), + ADC128_VOLTAGE_CHANNEL(2), + ADC128_VOLTAGE_CHANNEL(3), +}; + static const struct adc128_configuration adc128_config[] = { { adc128s052_channels, ARRAY_SIZE(adc128s052_channels) }, { adc122s021_channels, ARRAY_SIZE(adc122s021_channels) }, + { adc124s021_channels, ARRAY_SIZE(adc124s021_channels) }, }; static const struct iio_info adc128_info = { @@ -177,6 +186,7 @@ static int adc128_remove(struct spi_device *spi) static const struct of_device_id adc128_of_match[] = { { .compatible = "ti,adc128s052", }, { .compatible = "ti,adc122s021", }, + { .compatible = "ti,adc124s021", }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, adc128_of_match); @@ -184,6 +194,7 @@ MODULE_DEVICE_TABLE(of, adc128_of_match); static const struct spi_device_id adc128_id[] = { { "adc128s052", 0}, /* index into adc128_config */ { "adc122s021", 1}, + { "adc124s021", 2}, { } }; MODULE_DEVICE_TABLE(spi, adc128_id); From 4d33615df58bf308626489cbfb8acbc8bbd45658 Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Wed, 9 Dec 2015 22:04:49 -0800 Subject: [PATCH 491/843] iio: light: add MAX30100 oximeter driver support MAX30100 is an heart rate and pulse oximeter sensor that works using two LEDS of different wavelengths, and detecting the light reflected back. This patchset adds support for both IR and RED LED channels which can be processed in userspace to determine heart rate and blood oxygen levels. Signed-off-by: Matt Ranostay Signed-off-by: Jonathan Cameron --- .../bindings/iio/health/max30100.txt | 21 + drivers/iio/Kconfig | 1 + drivers/iio/Makefile | 1 + drivers/iio/health/Kconfig | 21 + drivers/iio/health/Makefile | 7 + drivers/iio/health/max30100.c | 453 ++++++++++++++++++ 6 files changed, 504 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/health/max30100.txt create mode 100644 drivers/iio/health/Kconfig create mode 100644 drivers/iio/health/Makefile create mode 100644 drivers/iio/health/max30100.c diff --git a/Documentation/devicetree/bindings/iio/health/max30100.txt b/Documentation/devicetree/bindings/iio/health/max30100.txt new file mode 100644 index 000000000000..f6fbac66ad06 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/health/max30100.txt @@ -0,0 +1,21 @@ +Maxim MAX30100 heart rate and pulse oximeter sensor + +* https://datasheets.maximintegrated.com/en/ds/MAX30100.pdf + +Required properties: + - compatible: must be "maxim,max30100" + - reg: the I2C address of the sensor + - interrupt-parent: should be the phandle for the interrupt controller + - interrupts: the sole interrupt generated by the device + + Refer to interrupt-controller/interrupts.txt for generic + interrupt client node bindings. + +Example: + +max30100@057 { + compatible = "maxim,max30100"; + reg = <57>; + interrupt-parent = <&gpio1>; + interrupts = <16 2>; +}; diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig index ac8715e56ba1..505e921f0b19 100644 --- a/drivers/iio/Kconfig +++ b/drivers/iio/Kconfig @@ -69,6 +69,7 @@ source "drivers/iio/dac/Kconfig" source "drivers/iio/dummy/Kconfig" source "drivers/iio/frequency/Kconfig" source "drivers/iio/gyro/Kconfig" +source "drivers/iio/health/Kconfig" source "drivers/iio/humidity/Kconfig" source "drivers/iio/imu/Kconfig" source "drivers/iio/light/Kconfig" diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile index f670b82298aa..20f649073462 100644 --- a/drivers/iio/Makefile +++ b/drivers/iio/Makefile @@ -21,6 +21,7 @@ obj-y += dac/ obj-y += dummy/ obj-y += gyro/ obj-y += frequency/ +obj-y += health/ obj-y += humidity/ obj-y += imu/ obj-y += light/ diff --git a/drivers/iio/health/Kconfig b/drivers/iio/health/Kconfig new file mode 100644 index 000000000000..a647679da805 --- /dev/null +++ b/drivers/iio/health/Kconfig @@ -0,0 +1,21 @@ +# +# Health sensors +# +# When adding new entries keep the list in alphabetical order + +menu "Health sensors" + +config MAX30100 + tristate "MAX30100 heart rate and pulse oximeter sensor" + depends on I2C + select REGMAP_I2C + select IIO_BUFFER + select IIO_KFIFO_BUF + help + Say Y here to build I2C interface support for the Maxim + MAX30100 heart rate, and pulse oximeter sensor. + + To compile this driver as a module, choose M here: the + module will be called max30100. + +endmenu diff --git a/drivers/iio/health/Makefile b/drivers/iio/health/Makefile new file mode 100644 index 000000000000..7c475d7faad8 --- /dev/null +++ b/drivers/iio/health/Makefile @@ -0,0 +1,7 @@ +# +# Makefile for IIO Health sensors +# + +# When adding new entries keep the list in alphabetical order + +obj-$(CONFIG_MAX30100) += max30100.o diff --git a/drivers/iio/health/max30100.c b/drivers/iio/health/max30100.c new file mode 100644 index 000000000000..9d1c81f91dd7 --- /dev/null +++ b/drivers/iio/health/max30100.c @@ -0,0 +1,453 @@ +/* + * max30100.c - Support for MAX30100 heart rate and pulse oximeter sensor + * + * Copyright (C) 2015 Matt Ranostay + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * TODO: allow LED current and pulse length controls via device tree properties + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX30100_REGMAP_NAME "max30100_regmap" +#define MAX30100_DRV_NAME "max30100" + +#define MAX30100_REG_INT_STATUS 0x00 +#define MAX30100_REG_INT_STATUS_PWR_RDY BIT(0) +#define MAX30100_REG_INT_STATUS_SPO2_RDY BIT(4) +#define MAX30100_REG_INT_STATUS_HR_RDY BIT(5) +#define MAX30100_REG_INT_STATUS_FIFO_RDY BIT(7) + +#define MAX30100_REG_INT_ENABLE 0x01 +#define MAX30100_REG_INT_ENABLE_SPO2_EN BIT(0) +#define MAX30100_REG_INT_ENABLE_HR_EN BIT(1) +#define MAX30100_REG_INT_ENABLE_FIFO_EN BIT(3) +#define MAX30100_REG_INT_ENABLE_MASK 0xf0 +#define MAX30100_REG_INT_ENABLE_MASK_SHIFT 4 + +#define MAX30100_REG_FIFO_WR_PTR 0x02 +#define MAX30100_REG_FIFO_OVR_CTR 0x03 +#define MAX30100_REG_FIFO_RD_PTR 0x04 +#define MAX30100_REG_FIFO_DATA 0x05 +#define MAX30100_REG_FIFO_DATA_ENTRY_COUNT 16 +#define MAX30100_REG_FIFO_DATA_ENTRY_LEN 4 + +#define MAX30100_REG_MODE_CONFIG 0x06 +#define MAX30100_REG_MODE_CONFIG_MODE_SPO2_EN BIT(0) +#define MAX30100_REG_MODE_CONFIG_MODE_HR_EN BIT(1) +#define MAX30100_REG_MODE_CONFIG_MODE_MASK 0x03 +#define MAX30100_REG_MODE_CONFIG_TEMP_EN BIT(3) +#define MAX30100_REG_MODE_CONFIG_PWR BIT(7) + +#define MAX30100_REG_SPO2_CONFIG 0x07 +#define MAX30100_REG_SPO2_CONFIG_100HZ BIT(2) +#define MAX30100_REG_SPO2_CONFIG_HI_RES_EN BIT(6) +#define MAX30100_REG_SPO2_CONFIG_1600US 0x3 + +#define MAX30100_REG_LED_CONFIG 0x09 +#define MAX30100_REG_LED_CONFIG_RED_LED_SHIFT 4 + +#define MAX30100_REG_LED_CONFIG_24MA 0x07 +#define MAX30100_REG_LED_CONFIG_50MA 0x0f + +#define MAX30100_REG_TEMP_INTEGER 0x16 +#define MAX30100_REG_TEMP_FRACTION 0x17 + +struct max30100_data { + struct i2c_client *client; + struct iio_dev *indio_dev; + struct mutex lock; + struct regmap *regmap; + + __be16 buffer[2]; /* 2 16-bit channels */ +}; + +static bool max30100_is_volatile_reg(struct device *dev, unsigned int reg) +{ + switch (reg) { + case MAX30100_REG_INT_STATUS: + case MAX30100_REG_MODE_CONFIG: + case MAX30100_REG_FIFO_WR_PTR: + case MAX30100_REG_FIFO_OVR_CTR: + case MAX30100_REG_FIFO_RD_PTR: + case MAX30100_REG_FIFO_DATA: + case MAX30100_REG_TEMP_INTEGER: + case MAX30100_REG_TEMP_FRACTION: + return true; + default: + return false; + } +} + +static const struct regmap_config max30100_regmap_config = { + .name = MAX30100_REGMAP_NAME, + + .reg_bits = 8, + .val_bits = 8, + + .max_register = MAX30100_REG_TEMP_FRACTION, + .cache_type = REGCACHE_FLAT, + + .volatile_reg = max30100_is_volatile_reg, +}; + +static const unsigned long max30100_scan_masks[] = {0x3, 0}; + +static const struct iio_chan_spec max30100_channels[] = { + { + .type = IIO_INTENSITY, + .channel2 = IIO_MOD_LIGHT_IR, + .modified = 1, + + .scan_index = 0, + .scan_type = { + .sign = 'u', + .realbits = 16, + .storagebits = 16, + .endianness = IIO_BE, + }, + }, + { + .type = IIO_INTENSITY, + .channel2 = IIO_MOD_LIGHT_RED, + .modified = 1, + + .scan_index = 1, + .scan_type = { + .sign = 'u', + .realbits = 16, + .storagebits = 16, + .endianness = IIO_BE, + }, + }, + { + .type = IIO_TEMP, + .info_mask_separate = + BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), + .scan_index = -1, + }, +}; + +static int max30100_set_powermode(struct max30100_data *data, bool state) +{ + return regmap_update_bits(data->regmap, MAX30100_REG_MODE_CONFIG, + MAX30100_REG_MODE_CONFIG_PWR, + state ? 0 : MAX30100_REG_MODE_CONFIG_PWR); +} + +static int max30100_clear_fifo(struct max30100_data *data) +{ + int ret; + + ret = regmap_write(data->regmap, MAX30100_REG_FIFO_WR_PTR, 0); + if (ret) + return ret; + + ret = regmap_write(data->regmap, MAX30100_REG_FIFO_OVR_CTR, 0); + if (ret) + return ret; + + return regmap_write(data->regmap, MAX30100_REG_FIFO_RD_PTR, 0); +} + +static int max30100_buffer_postenable(struct iio_dev *indio_dev) +{ + struct max30100_data *data = iio_priv(indio_dev); + int ret; + + ret = max30100_set_powermode(data, true); + if (ret) + return ret; + + return max30100_clear_fifo(data); +} + +static int max30100_buffer_predisable(struct iio_dev *indio_dev) +{ + struct max30100_data *data = iio_priv(indio_dev); + + return max30100_set_powermode(data, false); +} + +static const struct iio_buffer_setup_ops max30100_buffer_setup_ops = { + .postenable = max30100_buffer_postenable, + .predisable = max30100_buffer_predisable, +}; + +static inline int max30100_fifo_count(struct max30100_data *data) +{ + unsigned int val; + int ret; + + ret = regmap_read(data->regmap, MAX30100_REG_INT_STATUS, &val); + if (ret) + return ret; + + /* FIFO is almost full */ + if (val & MAX30100_REG_INT_STATUS_FIFO_RDY) + return MAX30100_REG_FIFO_DATA_ENTRY_COUNT - 1; + + return 0; +} + +static int max30100_read_measurement(struct max30100_data *data) +{ + int ret; + + ret = i2c_smbus_read_i2c_block_data(data->client, + MAX30100_REG_FIFO_DATA, + MAX30100_REG_FIFO_DATA_ENTRY_LEN, + (u8 *) &data->buffer); + + return (ret == MAX30100_REG_FIFO_DATA_ENTRY_LEN) ? 0 : ret; +} + +static irqreturn_t max30100_interrupt_handler(int irq, void *private) +{ + struct iio_dev *indio_dev = private; + struct max30100_data *data = iio_priv(indio_dev); + int ret, cnt = 0; + + mutex_lock(&data->lock); + + while (cnt-- || (cnt = max30100_fifo_count(data) > 0)) { + ret = max30100_read_measurement(data); + if (ret) + break; + + iio_push_to_buffers(data->indio_dev, data->buffer); + } + + mutex_unlock(&data->lock); + + return IRQ_HANDLED; +} + +static int max30100_chip_init(struct max30100_data *data) +{ + int ret; + + /* RED IR LED = 24mA, IR LED = 50mA */ + ret = regmap_write(data->regmap, MAX30100_REG_LED_CONFIG, + (MAX30100_REG_LED_CONFIG_24MA << + MAX30100_REG_LED_CONFIG_RED_LED_SHIFT) | + MAX30100_REG_LED_CONFIG_50MA); + if (ret) + return ret; + + /* enable hi-res SPO2 readings at 100Hz */ + ret = regmap_write(data->regmap, MAX30100_REG_SPO2_CONFIG, + MAX30100_REG_SPO2_CONFIG_HI_RES_EN | + MAX30100_REG_SPO2_CONFIG_100HZ); + if (ret) + return ret; + + /* enable SPO2 mode */ + ret = regmap_update_bits(data->regmap, MAX30100_REG_MODE_CONFIG, + MAX30100_REG_MODE_CONFIG_MODE_MASK, + MAX30100_REG_MODE_CONFIG_MODE_HR_EN | + MAX30100_REG_MODE_CONFIG_MODE_SPO2_EN); + if (ret) + return ret; + + /* enable FIFO interrupt */ + return regmap_update_bits(data->regmap, MAX30100_REG_INT_ENABLE, + MAX30100_REG_INT_ENABLE_MASK, + MAX30100_REG_INT_ENABLE_FIFO_EN + << MAX30100_REG_INT_ENABLE_MASK_SHIFT); +} + +static int max30100_read_temp(struct max30100_data *data, int *val) +{ + int ret; + unsigned int reg; + + ret = regmap_read(data->regmap, MAX30100_REG_TEMP_INTEGER, ®); + if (ret < 0) + return ret; + *val = reg << 4; + + ret = regmap_read(data->regmap, MAX30100_REG_TEMP_FRACTION, ®); + if (ret < 0) + return ret; + + *val |= reg & 0xf; + *val = sign_extend32(*val, 11); + + return 0; +} + +static int max30100_get_temp(struct max30100_data *data, int *val) +{ + int ret; + + /* start acquisition */ + ret = regmap_update_bits(data->regmap, MAX30100_REG_MODE_CONFIG, + MAX30100_REG_MODE_CONFIG_TEMP_EN, + MAX30100_REG_MODE_CONFIG_TEMP_EN); + if (ret) + return ret; + + usleep_range(35000, 50000); + + return max30100_read_temp(data, val); +} + +static int max30100_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, int *val2, long mask) +{ + struct max30100_data *data = iio_priv(indio_dev); + int ret = -EINVAL; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + /* + * Temperature reading can only be acquired while engine + * is running + */ + mutex_lock(&indio_dev->mlock); + + if (!iio_buffer_enabled(indio_dev)) + ret = -EAGAIN; + else { + ret = max30100_get_temp(data, val); + if (!ret) + ret = IIO_VAL_INT; + + } + + mutex_unlock(&indio_dev->mlock); + break; + case IIO_CHAN_INFO_SCALE: + *val = 1; /* 0.0625 */ + *val2 = 16; + ret = IIO_VAL_FRACTIONAL; + break; + } + + return ret; +} + +static const struct iio_info max30100_info = { + .driver_module = THIS_MODULE, + .read_raw = max30100_read_raw, +}; + +static int max30100_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct max30100_data *data; + struct iio_buffer *buffer; + struct iio_dev *indio_dev; + int ret; + + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); + if (!indio_dev) + return -ENOMEM; + + buffer = devm_iio_kfifo_allocate(&client->dev); + if (!buffer) + return -ENOMEM; + + iio_device_attach_buffer(indio_dev, buffer); + + indio_dev->name = MAX30100_DRV_NAME; + indio_dev->channels = max30100_channels; + indio_dev->info = &max30100_info; + indio_dev->num_channels = ARRAY_SIZE(max30100_channels); + indio_dev->available_scan_masks = max30100_scan_masks; + indio_dev->modes = (INDIO_BUFFER_SOFTWARE | INDIO_DIRECT_MODE); + indio_dev->setup_ops = &max30100_buffer_setup_ops; + + data = iio_priv(indio_dev); + data->indio_dev = indio_dev; + data->client = client; + + mutex_init(&data->lock); + i2c_set_clientdata(client, indio_dev); + + data->regmap = devm_regmap_init_i2c(client, &max30100_regmap_config); + if (IS_ERR(data->regmap)) { + dev_err(&client->dev, "regmap initialization failed.\n"); + return PTR_ERR(data->regmap); + } + max30100_set_powermode(data, false); + + ret = max30100_chip_init(data); + if (ret) + return ret; + + if (client->irq <= 0) { + dev_err(&client->dev, "no valid irq defined\n"); + return -EINVAL; + } + ret = devm_request_threaded_irq(&client->dev, client->irq, + NULL, max30100_interrupt_handler, + IRQF_TRIGGER_FALLING | IRQF_ONESHOT, + "max30100_irq", indio_dev); + if (ret) { + dev_err(&client->dev, "request irq (%d) failed\n", client->irq); + return ret; + } + + return iio_device_register(indio_dev); +} + +static int max30100_remove(struct i2c_client *client) +{ + struct iio_dev *indio_dev = i2c_get_clientdata(client); + struct max30100_data *data = iio_priv(indio_dev); + + iio_device_unregister(indio_dev); + max30100_set_powermode(data, false); + + return 0; +} + +static const struct i2c_device_id max30100_id[] = { + { "max30100", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, max30100_id); + +static const struct of_device_id max30100_dt_ids[] = { + { .compatible = "maxim,max30100" }, + { } +}; +MODULE_DEVICE_TABLE(of, max30100_dt_ids); + +static struct i2c_driver max30100_driver = { + .driver = { + .name = MAX30100_DRV_NAME, + .of_match_table = of_match_ptr(max30100_dt_ids), + }, + .probe = max30100_probe, + .remove = max30100_remove, + .id_table = max30100_id, +}; +module_i2c_driver(max30100_driver); + +MODULE_AUTHOR("Matt Ranostay "); +MODULE_DESCRIPTION("MAX30100 heart rate and pulse oximeter sensor"); +MODULE_LICENSE("GPL"); From 466df4d0c1a5edee243698bdcad1ec4f3a1799b1 Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Sat, 5 Dec 2015 22:58:22 -0800 Subject: [PATCH 492/843] iio: chemical: add AMS iAQ-core support Add support for AMS iAQ-core continuous and pulsed VOC sensors. Signed-off-by: Matt Ranostay Signed-off-by: Jonathan Cameron --- .../bindings/i2c/trivial-devices.txt | 1 + drivers/iio/chemical/Kconfig | 8 + drivers/iio/chemical/Makefile | 1 + drivers/iio/chemical/ams-iaq-core.c | 200 ++++++++++++++++++ 4 files changed, 210 insertions(+) create mode 100644 drivers/iio/chemical/ams-iaq-core.c diff --git a/Documentation/devicetree/bindings/i2c/trivial-devices.txt b/Documentation/devicetree/bindings/i2c/trivial-devices.txt index c50cf13c852e..f6fec952d683 100644 --- a/Documentation/devicetree/bindings/i2c/trivial-devices.txt +++ b/Documentation/devicetree/bindings/i2c/trivial-devices.txt @@ -20,6 +20,7 @@ adi,adt7476 +/-1C TDM Extended Temp Range I.C adi,adt7490 +/-1C TDM Extended Temp Range I.C adi,adxl345 Three-Axis Digital Accelerometer adi,adxl346 Three-Axis Digital Accelerometer (backward-compatibility value "adi,adxl345" must be listed too) +ams,iaq-core AMS iAQ-Core VOC Sensor at,24c08 i2c serial eeprom (24cxx) atmel,24c00 i2c serial eeprom (24cxx) atmel,24c01 i2c serial eeprom (24cxx) diff --git a/drivers/iio/chemical/Kconfig b/drivers/iio/chemical/Kconfig index 3061b7299f0f..f16de61be46d 100644 --- a/drivers/iio/chemical/Kconfig +++ b/drivers/iio/chemical/Kconfig @@ -4,6 +4,14 @@ menu "Chemical Sensors" +config IAQCORE + tristate "AMS iAQ-Core VOC sensors" + depends on I2C + help + Say Y here to build I2C interface support for the AMS + iAQ-Core Continuous/Pulsed VOC (Volatile Organic Compounds) + sensors + config VZ89X tristate "SGX Sensortech MiCS VZ89X VOC sensor" depends on I2C diff --git a/drivers/iio/chemical/Makefile b/drivers/iio/chemical/Makefile index 7292f2ded587..167861fadfab 100644 --- a/drivers/iio/chemical/Makefile +++ b/drivers/iio/chemical/Makefile @@ -3,4 +3,5 @@ # # When adding new entries keep the list in alphabetical order +obj-$(CONFIG_IAQCORE) += ams-iaq-core.o obj-$(CONFIG_VZ89X) += vz89x.o diff --git a/drivers/iio/chemical/ams-iaq-core.c b/drivers/iio/chemical/ams-iaq-core.c new file mode 100644 index 000000000000..41a8e6f2e31d --- /dev/null +++ b/drivers/iio/chemical/ams-iaq-core.c @@ -0,0 +1,200 @@ +/* + * ams-iaq-core.c - Support for AMS iAQ-Core VOC sensors + * + * Copyright (C) 2015 Matt Ranostay + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include + +#define AMS_IAQCORE_DATA_SIZE 9 + +#define AMS_IAQCORE_VOC_CO2_IDX 0 +#define AMS_IAQCORE_VOC_RESISTANCE_IDX 1 +#define AMS_IAQCORE_VOC_TVOC_IDX 2 + +struct ams_iaqcore_reading { + __be16 co2_ppm; + u8 status; + __be32 resistance; + __be16 voc_ppb; +} __attribute__((__packed__)); + +struct ams_iaqcore_data { + struct i2c_client *client; + struct mutex lock; + unsigned long last_update; + + struct ams_iaqcore_reading buffer; +}; + +static const struct iio_chan_spec ams_iaqcore_channels[] = { + { + .type = IIO_CONCENTRATION, + .channel2 = IIO_MOD_CO2, + .modified = 1, + .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), + .address = AMS_IAQCORE_VOC_CO2_IDX, + }, + { + .type = IIO_RESISTANCE, + .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), + .address = AMS_IAQCORE_VOC_RESISTANCE_IDX, + }, + { + .type = IIO_CONCENTRATION, + .channel2 = IIO_MOD_VOC, + .modified = 1, + .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), + .address = AMS_IAQCORE_VOC_TVOC_IDX, + }, +}; + +static int ams_iaqcore_read_measurement(struct ams_iaqcore_data *data) +{ + struct i2c_client *client = data->client; + int ret; + + struct i2c_msg msg = { + .addr = client->addr, + .flags = client->flags | I2C_M_RD, + .len = AMS_IAQCORE_DATA_SIZE, + .buf = (char *) &data->buffer, + }; + + ret = i2c_transfer(client->adapter, &msg, 1); + + return (ret == AMS_IAQCORE_DATA_SIZE) ? 0 : ret; +} + +static int ams_iaqcore_get_measurement(struct ams_iaqcore_data *data) +{ + int ret; + + /* sensor can only be polled once a second max per datasheet */ + if (!time_after(jiffies, data->last_update + HZ)) + return 0; + + ret = ams_iaqcore_read_measurement(data); + if (ret < 0) + return ret; + + data->last_update = jiffies; + + return 0; +} + +static int ams_iaqcore_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int *val, + int *val2, long mask) +{ + struct ams_iaqcore_data *data = iio_priv(indio_dev); + int ret; + + if (mask != IIO_CHAN_INFO_PROCESSED) + return -EINVAL; + + mutex_lock(&data->lock); + ret = ams_iaqcore_get_measurement(data); + + if (ret) + goto err_out; + + switch (chan->address) { + case AMS_IAQCORE_VOC_CO2_IDX: + *val = 0; + *val2 = be16_to_cpu(data->buffer.co2_ppm); + ret = IIO_VAL_INT_PLUS_MICRO; + break; + case AMS_IAQCORE_VOC_RESISTANCE_IDX: + *val = be32_to_cpu(data->buffer.resistance); + ret = IIO_VAL_INT; + break; + case AMS_IAQCORE_VOC_TVOC_IDX: + *val = 0; + *val2 = be16_to_cpu(data->buffer.voc_ppb); + ret = IIO_VAL_INT_PLUS_NANO; + break; + default: + ret = -EINVAL; + } + +err_out: + mutex_unlock(&data->lock); + + return ret; +} + +static const struct iio_info ams_iaqcore_info = { + .read_raw = ams_iaqcore_read_raw, + .driver_module = THIS_MODULE, +}; + +static int ams_iaqcore_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct iio_dev *indio_dev; + struct ams_iaqcore_data *data; + + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); + if (!indio_dev) + return -ENOMEM; + + data = iio_priv(indio_dev); + i2c_set_clientdata(client, indio_dev); + data->client = client; + + /* so initial reading will complete */ + data->last_update = jiffies - HZ; + mutex_init(&data->lock); + + indio_dev->dev.parent = &client->dev; + indio_dev->info = &ams_iaqcore_info, + indio_dev->name = dev_name(&client->dev); + indio_dev->modes = INDIO_DIRECT_MODE; + + indio_dev->channels = ams_iaqcore_channels; + indio_dev->num_channels = ARRAY_SIZE(ams_iaqcore_channels); + + return devm_iio_device_register(&client->dev, indio_dev); +} + +static const struct i2c_device_id ams_iaqcore_id[] = { + { "ams-iaq-core", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, ams_iaqcore_id); + +static const struct of_device_id ams_iaqcore_dt_ids[] = { + { .compatible = "ams,iaq-core" }, + { } +}; +MODULE_DEVICE_TABLE(of, ams_iaqcore_dt_ids); + +static struct i2c_driver ams_iaqcore_driver = { + .driver = { + .name = "ams-iaq-core", + .of_match_table = of_match_ptr(ams_iaqcore_dt_ids), + }, + .probe = ams_iaqcore_probe, + .id_table = ams_iaqcore_id, +}; +module_i2c_driver(ams_iaqcore_driver); + +MODULE_AUTHOR("Matt Ranostay "); +MODULE_DESCRIPTION("AMS iAQ-Core VOC sensors"); +MODULE_LICENSE("GPL v2"); From c43a102e67db99c8bfe6e8a9280cec13ff53b789 Mon Sep 17 00:00:00 2001 From: Marc Titinger Date: Mon, 7 Dec 2015 10:09:34 +0100 Subject: [PATCH 493/843] iio: ina2xx: add support for TI INA2xx Power Monitors in SOFTWARE buffer mode, a kthread will capture the active scan_elements into a kfifo, then compute the remaining time until the next capture tick and do an active wait (udelay). This will produce a stream of up to fours channels plus a 64bits timestamps (ns). Tested with ina226, on BeagleBoneBlack. Datasheet: http://www.ti.com/lit/gpn/ina226 Signed-off-by: Marc Titinger Signed-off-by: Jonathan Cameron --- drivers/iio/adc/Kconfig | 10 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/ina2xx-adc.c | 668 +++++++++++++++++++++++++++++++++++ 3 files changed, 679 insertions(+) create mode 100644 drivers/iio/adc/ina2xx-adc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 57e3ca0b7ff4..cb68bd9d2052 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -194,6 +194,16 @@ config HI8435 This driver can also be built as a module. If so, the module will be called hi8435. +config INA2XX_ADC + tristate "Texas Instruments INA2xx Power Monitors IIO driver" + depends on I2C && !SENSORS_INA2XX + select REGMAP_I2C + select IIO_BUFFER + select IIO_KFIFO_BUF + help + Say yes here to build support for TI INA2xx family of Power Monitors. + This driver is mutually exclusive with the HWMON version. + config LP8788_ADC tristate "LP8788 ADC driver" depends on MFD_LP8788 diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 91a65bf11c58..c62c5fa91c82 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -20,6 +20,7 @@ obj-$(CONFIG_CC10001_ADC) += cc10001_adc.o obj-$(CONFIG_DA9150_GPADC) += da9150-gpadc.o obj-$(CONFIG_EXYNOS_ADC) += exynos_adc.o obj-$(CONFIG_HI8435) += hi8435.o +obj-$(CONFIG_INA2XX_ADC) += ina2xx-adc.o obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o obj-$(CONFIG_MAX1027) += max1027.o obj-$(CONFIG_MAX1363) += max1363.o diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c new file mode 100644 index 000000000000..707bd69a7353 --- /dev/null +++ b/drivers/iio/adc/ina2xx-adc.c @@ -0,0 +1,668 @@ +/* + * INA2XX Current and Power Monitors + * + * Copyright 2015 Baylibre SAS. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Based on linux/drivers/iio/adc/ad7291.c + * Copyright 2010-2011 Analog Devices Inc. + * + * Based on linux/drivers/hwmon/ina2xx.c + * Copyright 2012 Lothar Felten + * + * Licensed under the GPL-2 or later. + * + * IIO driver for INA219-220-226-230-231 + * + * Configurable 7-bit I2C slave address from 0x40 to 0x4F + */ +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +/* INA2XX registers definition */ +#define INA2XX_CONFIG 0x00 +#define INA2XX_SHUNT_VOLTAGE 0x01 /* readonly */ +#define INA2XX_BUS_VOLTAGE 0x02 /* readonly */ +#define INA2XX_POWER 0x03 /* readonly */ +#define INA2XX_CURRENT 0x04 /* readonly */ +#define INA2XX_CALIBRATION 0x05 + +#define INA226_ALERT_MASK 0x06 +#define INA266_CVRF BIT(3) + +#define INA2XX_MAX_REGISTERS 8 + +/* settings - depend on use case */ +#define INA219_CONFIG_DEFAULT 0x399F /* PGA=8 */ +#define INA226_CONFIG_DEFAULT 0x4327 +#define INA226_DEFAULT_AVG 4 +#define INA226_DEFAULT_IT 1110 + +#define INA2XX_RSHUNT_DEFAULT 10000 + +/* + * bit mask for reading the averaging setting in the configuration register + * FIXME: use regmap_fields. + */ +#define INA2XX_MODE_MASK GENMASK(3, 0) + +#define INA226_AVG_MASK GENMASK(11, 9) +#define INA226_SHIFT_AVG(val) ((val) << 9) + +/* Integration time for VBus */ +#define INA226_ITB_MASK GENMASK(8, 6) +#define INA226_SHIFT_ITB(val) ((val) << 6) + +/* Integration time for VShunt */ +#define INA226_ITS_MASK GENMASK(5, 3) +#define INA226_SHIFT_ITS(val) ((val) << 3) + +/* Cosmetic macro giving the sampling period for a full P=UxI cycle */ +#define SAMPLING_PERIOD(c) ((c->int_time_vbus + c->int_time_vshunt) \ + * c->avg) + +static bool ina2xx_is_writeable_reg(struct device *dev, unsigned int reg) +{ + return (reg == INA2XX_CONFIG) || (reg > INA2XX_CURRENT); +} + +static bool ina2xx_is_volatile_reg(struct device *dev, unsigned int reg) +{ + return (reg != INA2XX_CONFIG); +} + +static inline bool is_signed_reg(unsigned int reg) +{ + return (reg == INA2XX_SHUNT_VOLTAGE) || (reg == INA2XX_CURRENT); +} + +static const struct regmap_config ina2xx_regmap_config = { + .reg_bits = 8, + .val_bits = 16, + .max_register = INA2XX_MAX_REGISTERS, + .writeable_reg = ina2xx_is_writeable_reg, + .volatile_reg = ina2xx_is_volatile_reg, +}; + +enum ina2xx_ids { ina219, ina226 }; + +struct ina2xx_config { + u16 config_default; + int calibration_factor; + int shunt_div; + int bus_voltage_shift; + int bus_voltage_lsb; /* uV */ + int power_lsb; /* uW */ +}; + +struct ina2xx_chip_info { + struct regmap *regmap; + struct task_struct *task; + const struct ina2xx_config *config; + struct mutex state_lock; + long rshunt; + int avg; + s64 prev_ns; /* track buffer capture time, check for underruns*/ + int int_time_vbus; /* Bus voltage integration time uS */ + int int_time_vshunt; /* Shunt voltage integration time uS */ +}; + +static const struct ina2xx_config ina2xx_config[] = { + [ina219] = { + .config_default = INA219_CONFIG_DEFAULT, + .calibration_factor = 40960000, + .shunt_div = 100, + .bus_voltage_shift = 3, + .bus_voltage_lsb = 4000, + .power_lsb = 20000, + }, + [ina226] = { + .config_default = INA226_CONFIG_DEFAULT, + .calibration_factor = 5120000, + .shunt_div = 400, + .bus_voltage_shift = 0, + .bus_voltage_lsb = 1250, + .power_lsb = 25000, + }, +}; + +static int ina2xx_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, int *val2, long mask) +{ + int ret; + struct ina2xx_chip_info *chip = iio_priv(indio_dev); + unsigned int regval; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + ret = regmap_read(chip->regmap, chan->address, ®val); + if (ret < 0) + return ret; + + if (is_signed_reg(chan->address)) + *val = (s16) regval; + else + *val = regval; + + return IIO_VAL_INT; + + case IIO_CHAN_INFO_OVERSAMPLING_RATIO: + *val = chip->avg; + return IIO_VAL_INT; + + case IIO_CHAN_INFO_INT_TIME: + *val = 0; + if (chan->address == INA2XX_SHUNT_VOLTAGE) + *val2 = chip->int_time_vshunt; + else + *val2 = chip->int_time_vbus; + + return IIO_VAL_INT_PLUS_MICRO; + + case IIO_CHAN_INFO_SAMP_FREQ: + /* + * Sample freq is read only, it is a consequence of + * 1/AVG*(CT_bus+CT_shunt). + */ + *val = DIV_ROUND_CLOSEST(1000000, SAMPLING_PERIOD(chip)); + + return IIO_VAL_INT; + + case IIO_CHAN_INFO_SCALE: + switch (chan->address) { + case INA2XX_SHUNT_VOLTAGE: + /* processed (mV) = raw*1000/shunt_div */ + *val2 = chip->config->shunt_div; + *val = 1000; + return IIO_VAL_FRACTIONAL; + + case INA2XX_BUS_VOLTAGE: + /* processed (mV) = raw*lsb (uV) / (1000 << shift) */ + *val = chip->config->bus_voltage_lsb; + *val2 = 1000 << chip->config->bus_voltage_shift; + return IIO_VAL_FRACTIONAL; + + case INA2XX_POWER: + /* processed (mW) = raw*lsb (uW) / 1000 */ + *val = chip->config->power_lsb; + *val2 = 1000; + return IIO_VAL_FRACTIONAL; + + case INA2XX_CURRENT: + /* processed (mA) = raw (mA) */ + *val = 1; + return IIO_VAL_INT; + } + } + + return -EINVAL; +} + +/* + * Available averaging rates for ina226. The indices correspond with + * the bit values expected by the chip (according to the ina226 datasheet, + * table 3 AVG bit settings, found at + * http://www.ti.com/lit/ds/symlink/ina226.pdf. + */ +static const int ina226_avg_tab[] = { 1, 4, 16, 64, 128, 256, 512, 1024 }; + +static int ina226_set_average(struct ina2xx_chip_info *chip, unsigned int val, + unsigned int *config) +{ + int bits; + + if (val > 1024 || val < 1) + return -EINVAL; + + bits = find_closest(val, ina226_avg_tab, + ARRAY_SIZE(ina226_avg_tab)); + + chip->avg = ina226_avg_tab[bits]; + + *config &= ~INA226_AVG_MASK; + *config |= INA226_SHIFT_AVG(bits) & INA226_AVG_MASK; + + return 0; +} + +/* Conversion times in uS */ +static const int ina226_conv_time_tab[] = { 140, 204, 332, 588, 1100, + 2116, 4156, 8244 }; + +static int ina226_set_int_time_vbus(struct ina2xx_chip_info *chip, + unsigned int val_us, unsigned int *config) +{ + int bits; + + if (val_us > 8244 || val_us < 140) + return -EINVAL; + + bits = find_closest(val_us, ina226_conv_time_tab, + ARRAY_SIZE(ina226_conv_time_tab)); + + chip->int_time_vbus = ina226_conv_time_tab[bits]; + + *config &= ~INA226_ITB_MASK; + *config |= INA226_SHIFT_ITB(bits) & INA226_ITB_MASK; + + return 0; +} + +static int ina226_set_int_time_vshunt(struct ina2xx_chip_info *chip, + unsigned int val_us, unsigned int *config) +{ + int bits; + + if (val_us > 8244 || val_us < 140) + return -EINVAL; + + bits = find_closest(val_us, ina226_conv_time_tab, + ARRAY_SIZE(ina226_conv_time_tab)); + + chip->int_time_vshunt = ina226_conv_time_tab[bits]; + + *config &= ~INA226_ITS_MASK; + *config |= INA226_SHIFT_ITS(bits) & INA226_ITS_MASK; + + return 0; +} + +static int ina2xx_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int val, int val2, long mask) +{ + struct ina2xx_chip_info *chip = iio_priv(indio_dev); + int ret; + unsigned int config, tmp; + + if (iio_buffer_enabled(indio_dev)) + return -EBUSY; + + mutex_lock(&chip->state_lock); + + ret = regmap_read(chip->regmap, INA2XX_CONFIG, &config); + if (ret < 0) + goto _err; + + tmp = config; + + switch (mask) { + case IIO_CHAN_INFO_OVERSAMPLING_RATIO: + ret = ina226_set_average(chip, val, &tmp); + break; + + case IIO_CHAN_INFO_INT_TIME: + if (chan->address == INA2XX_SHUNT_VOLTAGE) + ret = ina226_set_int_time_vshunt(chip, val2, &tmp); + else + ret = ina226_set_int_time_vbus(chip, val2, &tmp); + break; + default: + ret = -EINVAL; + } + + if (!ret && (tmp != config)) + ret = regmap_write(chip->regmap, INA2XX_CONFIG, tmp); +_err: + mutex_unlock(&chip->state_lock); + + return ret; +} + + +#define INA2XX_CHAN(_type, _index, _address) { \ + .type = (_type), \ + .address = (_address), \ + .indexed = 1, \ + .channel = (_index), \ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) \ + | BIT(IIO_CHAN_INFO_SCALE), \ + .info_mask_shared_by_dir = BIT(IIO_CHAN_INFO_SAMP_FREQ) | \ + BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO), \ + .scan_index = (_index), \ + .scan_type = { \ + .sign = 'u', \ + .realbits = 16, \ + .storagebits = 16, \ + .endianness = IIO_LE, \ + } \ +} + +/* + * Sampling Freq is a consequence of the integration times of + * the Voltage channels. + */ +#define INA2XX_CHAN_VOLTAGE(_index, _address) { \ + .type = IIO_VOLTAGE, \ + .address = (_address), \ + .indexed = 1, \ + .channel = (_index), \ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ + BIT(IIO_CHAN_INFO_SCALE) | \ + BIT(IIO_CHAN_INFO_INT_TIME), \ + .scan_index = (_index), \ + .scan_type = { \ + .sign = 'u', \ + .realbits = 16, \ + .storagebits = 16, \ + .endianness = IIO_LE, \ + } \ +} + +static const struct iio_chan_spec ina2xx_channels[] = { + INA2XX_CHAN_VOLTAGE(0, INA2XX_SHUNT_VOLTAGE), + INA2XX_CHAN_VOLTAGE(1, INA2XX_BUS_VOLTAGE), + INA2XX_CHAN(IIO_CURRENT, 2, INA2XX_CURRENT), + INA2XX_CHAN(IIO_POWER, 3, INA2XX_POWER), + IIO_CHAN_SOFT_TIMESTAMP(4), +}; + +static int ina2xx_work_buffer(struct iio_dev *indio_dev) +{ + struct ina2xx_chip_info *chip = iio_priv(indio_dev); + unsigned short data[8]; + int bit, ret, i = 0; + unsigned long buffer_us, elapsed_us; + s64 time_a, time_b; + unsigned int alert; + + time_a = iio_get_time_ns(); + + /* + * Because the timer thread and the chip conversion clock + * are asynchronous, the period difference will eventually + * result in reading V[k-1] again, or skip V[k] at time Tk. + * In order to resync the timer with the conversion process + * we check the ConVersionReadyFlag. + * On hardware that supports using the ALERT pin to toggle a + * GPIO a triggered buffer could be used instead. + * For now, we pay for that extra read of the ALERT register + */ + do { + ret = regmap_read(chip->regmap, INA226_ALERT_MASK, + &alert); + if (ret < 0) + return ret; + + alert &= INA266_CVRF; + trace_printk("Conversion ready: %d\n", !!alert); + + } while (!alert); + + /* + * Single register reads: bulk_read will not work with ina226 + * as there is no auto-increment of the address register for + * data length longer than 16bits. + */ + for_each_set_bit(bit, indio_dev->active_scan_mask, + indio_dev->masklength) { + unsigned int val; + + ret = regmap_read(chip->regmap, + INA2XX_SHUNT_VOLTAGE + bit, &val); + if (ret < 0) + return ret; + + data[i++] = val; + } + + time_b = iio_get_time_ns(); + + iio_push_to_buffers_with_timestamp(indio_dev, + (unsigned int *)data, time_a); + + buffer_us = (unsigned long)(time_b - time_a) / 1000; + elapsed_us = (unsigned long)(time_a - chip->prev_ns) / 1000; + + trace_printk("uS: elapsed: %lu, buf: %lu\n", elapsed_us, buffer_us); + + chip->prev_ns = time_a; + + return buffer_us; +}; + +static int ina2xx_capture_thread(void *data) +{ + struct iio_dev *indio_dev = (struct iio_dev *)data; + struct ina2xx_chip_info *chip = iio_priv(indio_dev); + unsigned int sampling_us = SAMPLING_PERIOD(chip); + int buffer_us; + + /* + * Poll a bit faster than the chip internal Fs, in case + * we wish to sync with the conversion ready flag. + */ + sampling_us -= 200; + + do { + buffer_us = ina2xx_work_buffer(indio_dev); + if (buffer_us < 0) + return buffer_us; + + if (sampling_us > buffer_us) + udelay(sampling_us - buffer_us); + + } while (!kthread_should_stop()); + + return 0; +} + +static int ina2xx_buffer_enable(struct iio_dev *indio_dev) +{ + struct ina2xx_chip_info *chip = iio_priv(indio_dev); + unsigned int sampling_us = SAMPLING_PERIOD(chip); + + trace_printk("Enabling buffer w/ scan_mask %02x, freq = %d, avg =%u\n", + (unsigned int)(*indio_dev->active_scan_mask), + 1000000/sampling_us, chip->avg); + + trace_printk("Expected work period: %u us\n", sampling_us); + + chip->prev_ns = iio_get_time_ns(); + + chip->task = kthread_run(ina2xx_capture_thread, (void *)indio_dev, + "ina2xx-%uus", sampling_us); + + return PTR_ERR_OR_ZERO(chip->task); +} + +static int ina2xx_buffer_disable(struct iio_dev *indio_dev) +{ + struct ina2xx_chip_info *chip = iio_priv(indio_dev); + + if (chip->task) { + kthread_stop(chip->task); + chip->task = NULL; + } + + return 0; +} + +static const struct iio_buffer_setup_ops ina2xx_setup_ops = { + .postenable = &ina2xx_buffer_enable, + .predisable = &ina2xx_buffer_disable, +}; + +static int ina2xx_debug_reg(struct iio_dev *indio_dev, + unsigned reg, unsigned writeval, unsigned *readval) +{ + struct ina2xx_chip_info *chip = iio_priv(indio_dev); + + if (!readval) + return regmap_write(chip->regmap, reg, writeval); + + return regmap_read(chip->regmap, reg, readval); +} + +/* Possible integration times for vshunt and vbus */ +static IIO_CONST_ATTR_INT_TIME_AVAIL \ + ("0.000140 0.000204 0.000332 0.000588 0.001100 0.002116 0.004156 0.008244"); + +static struct attribute *ina2xx_attributes[] = { + &iio_const_attr_integration_time_available.dev_attr.attr, + NULL, +}; + +static const struct attribute_group ina2xx_attribute_group = { + .attrs = ina2xx_attributes, +}; + +static const struct iio_info ina2xx_info = { + .debugfs_reg_access = &ina2xx_debug_reg, + .read_raw = &ina2xx_read_raw, + .write_raw = &ina2xx_write_raw, + .attrs = &ina2xx_attribute_group, + .driver_module = THIS_MODULE, +}; + +/* Initialize the configuration and calibration registers. */ +static int ina2xx_init(struct ina2xx_chip_info *chip, unsigned int config) +{ + u16 regval; + int ret = regmap_write(chip->regmap, INA2XX_CONFIG, config); + + if (ret < 0) + return ret; + /* + * Set current LSB to 1mA, shunt is in uOhms + * (equation 13 in datasheet). We hardcode a Current_LSB + * of 1.0 x10-6. The only remaining parameter is RShunt. + * There is no need to expose the CALIBRATION register + * to the user for now. + */ + regval = DIV_ROUND_CLOSEST(chip->config->calibration_factor, + chip->rshunt); + + return regmap_write(chip->regmap, INA2XX_CALIBRATION, regval); +} + +static int ina2xx_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct ina2xx_chip_info *chip; + struct iio_dev *indio_dev; + struct iio_buffer *buffer; + int ret; + unsigned int val; + + indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); + if (!indio_dev) + return -ENOMEM; + + chip = iio_priv(indio_dev); + + chip->config = &ina2xx_config[id->driver_data]; + + if (of_property_read_u32(client->dev.of_node, + "shunt-resistor", &val) < 0) { + struct ina2xx_platform_data *pdata = + dev_get_platdata(&client->dev); + + if (pdata) + val = pdata->shunt_uohms; + else + val = INA2XX_RSHUNT_DEFAULT; + } + + if (val <= 0 || val > chip->config->calibration_factor) + return -ENODEV; + + chip->rshunt = val; + + mutex_init(&chip->state_lock); + + /* This is only used for device removal purposes. */ + i2c_set_clientdata(client, indio_dev); + + indio_dev->name = id->name; + indio_dev->channels = ina2xx_channels; + indio_dev->num_channels = ARRAY_SIZE(ina2xx_channels); + + indio_dev->dev.parent = &client->dev; + indio_dev->info = &ina2xx_info; + indio_dev->modes = INDIO_DIRECT_MODE | INDIO_BUFFER_SOFTWARE; + + chip->regmap = devm_regmap_init_i2c(client, &ina2xx_regmap_config); + if (IS_ERR(chip->regmap)) { + dev_err(&client->dev, "failed to allocate register map\n"); + return PTR_ERR(chip->regmap); + } + + /* Patch the current config register with default. */ + val = chip->config->config_default; + + if (id->driver_data == ina226) { + ina226_set_average(chip, INA226_DEFAULT_AVG, &val); + ina226_set_int_time_vbus(chip, INA226_DEFAULT_IT, &val); + ina226_set_int_time_vshunt(chip, INA226_DEFAULT_IT, &val); + } + + ret = ina2xx_init(chip, val); + if (ret < 0) { + dev_err(&client->dev, "error configuring the device: %d\n", + ret); + return -ENODEV; + } + + buffer = devm_iio_kfifo_allocate(&indio_dev->dev); + if (!buffer) + return -ENOMEM; + + indio_dev->setup_ops = &ina2xx_setup_ops; + + iio_device_attach_buffer(indio_dev, buffer); + + return iio_device_register(indio_dev); +} + + +static int ina2xx_remove(struct i2c_client *client) +{ + struct iio_dev *indio_dev = i2c_get_clientdata(client); + struct ina2xx_chip_info *chip = iio_priv(indio_dev); + + iio_device_unregister(indio_dev); + + /* Powerdown */ + return regmap_update_bits(chip->regmap, INA2XX_CONFIG, + INA2XX_MODE_MASK, 0); +} + + +static const struct i2c_device_id ina2xx_id[] = { + {"ina219", ina219}, + {"ina220", ina219}, + {"ina226", ina226}, + {"ina230", ina226}, + {"ina231", ina226}, + {} +}; + +MODULE_DEVICE_TABLE(i2c, ina2xx_id); + +static struct i2c_driver ina2xx_driver = { + .driver = { + .name = KBUILD_MODNAME, + }, + .probe = ina2xx_probe, + .remove = ina2xx_remove, + .id_table = ina2xx_id, +}; + +module_i2c_driver(ina2xx_driver); + +MODULE_AUTHOR("Marc Titinger "); +MODULE_DESCRIPTION("Texas Instruments INA2XX ADC driver"); +MODULE_LICENSE("GPL v2"); From f9993c0771ce24063fe62bf73ac57bcfc9ad81de Mon Sep 17 00:00:00 2001 From: Marc Titinger Date: Mon, 7 Dec 2015 10:09:35 +0100 Subject: [PATCH 494/843] iio: ina2xx: provide a sysfs parameter to allow async readout of the ADCs This can lead to repeated or skipped samples depending on the clock beat between the capture thread and the chip sampling clock, but will also spare reading/waiting for the Capture Ready Flag and improve the available i2c bandwidth for reading measurements. Output of iio_info: ...snip... 4 device-specific attributes found: attr 0: in_oversampling_ratio value: 4 attr 1: in_allow_async_readout value: 0 attr 2: integration_time_available value: 140 204 332 588 1100 2116... attr 3: in_sampling_frequency value: 114 Signed-off-by: Marc Titinger Signed-off-by: Jonathan Cameron --- drivers/iio/adc/ina2xx-adc.c | 54 ++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c index 707bd69a7353..ff31f5b49a41 100644 --- a/drivers/iio/adc/ina2xx-adc.c +++ b/drivers/iio/adc/ina2xx-adc.c @@ -116,6 +116,7 @@ struct ina2xx_chip_info { s64 prev_ns; /* track buffer capture time, check for underruns*/ int int_time_vbus; /* Bus voltage integration time uS */ int int_time_vshunt; /* Shunt voltage integration time uS */ + bool allow_async_readout; }; static const struct ina2xx_config ina2xx_config[] = { @@ -322,6 +323,33 @@ _err: } +static ssize_t ina2xx_allow_async_readout_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct ina2xx_chip_info *chip = iio_priv(dev_to_iio_dev(dev)); + + return sprintf(buf, "%d\n", chip->allow_async_readout); +} + +static ssize_t ina2xx_allow_async_readout_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct ina2xx_chip_info *chip = iio_priv(dev_to_iio_dev(dev)); + bool val; + int ret; + + ret = strtobool((const char *) buf, &val); + if (ret) + return ret; + + chip->allow_async_readout = val; + + return len; +} + + #define INA2XX_CHAN(_type, _index, _address) { \ .type = (_type), \ .address = (_address), \ @@ -390,16 +418,17 @@ static int ina2xx_work_buffer(struct iio_dev *indio_dev) * GPIO a triggered buffer could be used instead. * For now, we pay for that extra read of the ALERT register */ - do { - ret = regmap_read(chip->regmap, INA226_ALERT_MASK, - &alert); - if (ret < 0) - return ret; + if (!chip->allow_async_readout) + do { + ret = regmap_read(chip->regmap, INA226_ALERT_MASK, + &alert); + if (ret < 0) + return ret; - alert &= INA266_CVRF; - trace_printk("Conversion ready: %d\n", !!alert); + alert &= INA266_CVRF; + trace_printk("Conversion ready: %d\n", !!alert); - } while (!alert); + } while (!alert); /* * Single register reads: bulk_read will not work with ina226 @@ -444,7 +473,8 @@ static int ina2xx_capture_thread(void *data) * Poll a bit faster than the chip internal Fs, in case * we wish to sync with the conversion ready flag. */ - sampling_us -= 200; + if (!chip->allow_async_readout) + sampling_us -= 200; do { buffer_us = ina2xx_work_buffer(indio_dev); @@ -469,6 +499,7 @@ static int ina2xx_buffer_enable(struct iio_dev *indio_dev) 1000000/sampling_us, chip->avg); trace_printk("Expected work period: %u us\n", sampling_us); + trace_printk("Async readout mode: %d\n", chip->allow_async_readout); chip->prev_ns = iio_get_time_ns(); @@ -510,7 +541,12 @@ static int ina2xx_debug_reg(struct iio_dev *indio_dev, static IIO_CONST_ATTR_INT_TIME_AVAIL \ ("0.000140 0.000204 0.000332 0.000588 0.001100 0.002116 0.004156 0.008244"); +static IIO_DEVICE_ATTR(in_allow_async_readout, S_IRUGO | S_IWUSR, + ina2xx_allow_async_readout_show, + ina2xx_allow_async_readout_store, 0); + static struct attribute *ina2xx_attributes[] = { + &iio_dev_attr_in_allow_async_readout.dev_attr.attr, &iio_const_attr_integration_time_available.dev_attr.attr, NULL, }; From b17dc40155a973d0da68b54184dd9c237426c426 Mon Sep 17 00:00:00 2001 From: Marc Titinger Date: Fri, 11 Dec 2015 17:49:15 +0100 Subject: [PATCH 495/843] iio: ina2xx: re-instate a sysfs show/store for the shunt resistor value Different probe modules use different resistor values. The front-end application may read a probe ID (from eeprom) and set the shunt value accordingly. Signed-off-by: Marc Titinger Signed-off-by: Jonathan Cameron --- drivers/iio/adc/ina2xx-adc.c | 52 +++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 6 deletions(-) diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c index ff31f5b49a41..dd4ff08d7b62 100644 --- a/drivers/iio/adc/ina2xx-adc.c +++ b/drivers/iio/adc/ina2xx-adc.c @@ -111,7 +111,7 @@ struct ina2xx_chip_info { struct task_struct *task; const struct ina2xx_config *config; struct mutex state_lock; - long rshunt; + unsigned int shunt_resistor; int avg; s64 prev_ns; /* track buffer capture time, check for underruns*/ int int_time_vbus; /* Bus voltage integration time uS */ @@ -349,6 +349,42 @@ static ssize_t ina2xx_allow_async_readout_store(struct device *dev, return len; } +static int set_shunt_resistor(struct ina2xx_chip_info *chip, unsigned int val) +{ + if (val <= 0 || val > chip->config->calibration_factor) + return -EINVAL; + + chip->shunt_resistor = val; + return 0; +} + +static ssize_t ina2xx_shunt_resistor_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct ina2xx_chip_info *chip = iio_priv(dev_to_iio_dev(dev)); + + return sprintf(buf, "%d\n", chip->shunt_resistor); +} + +static ssize_t ina2xx_shunt_resistor_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct ina2xx_chip_info *chip = iio_priv(dev_to_iio_dev(dev)); + unsigned long val; + int ret; + + ret = kstrtoul((const char *) buf, 10, &val); + if (ret) + return ret; + + ret = set_shunt_resistor(chip, val); + if (ret) + return ret; + + return len; +} #define INA2XX_CHAN(_type, _index, _address) { \ .type = (_type), \ @@ -545,9 +581,14 @@ static IIO_DEVICE_ATTR(in_allow_async_readout, S_IRUGO | S_IWUSR, ina2xx_allow_async_readout_show, ina2xx_allow_async_readout_store, 0); +static IIO_DEVICE_ATTR(in_shunt_resistor, S_IRUGO | S_IWUSR, + ina2xx_shunt_resistor_show, + ina2xx_shunt_resistor_store, 0); + static struct attribute *ina2xx_attributes[] = { &iio_dev_attr_in_allow_async_readout.dev_attr.attr, &iio_const_attr_integration_time_available.dev_attr.attr, + &iio_dev_attr_in_shunt_resistor.dev_attr.attr, NULL, }; @@ -579,7 +620,7 @@ static int ina2xx_init(struct ina2xx_chip_info *chip, unsigned int config) * to the user for now. */ regval = DIV_ROUND_CLOSEST(chip->config->calibration_factor, - chip->rshunt); + chip->shunt_resistor); return regmap_write(chip->regmap, INA2XX_CALIBRATION, regval); } @@ -612,10 +653,9 @@ static int ina2xx_probe(struct i2c_client *client, val = INA2XX_RSHUNT_DEFAULT; } - if (val <= 0 || val > chip->config->calibration_factor) - return -ENODEV; - - chip->rshunt = val; + ret = set_shunt_resistor(chip, val); + if (ret) + return ret; mutex_init(&chip->state_lock); From 46294cd948d530d4feccfd3afd6635e16a55dcb1 Mon Sep 17 00:00:00 2001 From: Marc Titinger Date: Fri, 11 Dec 2015 17:49:16 +0100 Subject: [PATCH 496/843] iio: ina2xx: give the capture kthread a more useful name string. PID PPID USER STAT VSZ %VSZ %CPU COMMAND 144 2 root DW 0 0% 33% [ina226:1-8800us] 141 2 root DW 0 0% 25% [ina226:0-8800us] 40 2 root SW 0 0% 15% [irq/156-4802a00] 147 2 root DW 0 0% 7% [ina226:2-8800us] 145 1 root S 1236 0% 6% dd if /dev/iio:device1 of /dev/null 148 1 root S 1236 0% 4% dd if /dev/iio:device2 of /dev/null 149 137 root R 1244 0% 3% top -d 1 142 1 root S 1236 0% 2% dd if /dev/iio:device0 of /dev/null Signed-off-by: Marc Titinger Signed-off-by: Jonathan Cameron --- drivers/iio/adc/ina2xx-adc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c index dd4ff08d7b62..4c18c4cc8939 100644 --- a/drivers/iio/adc/ina2xx-adc.c +++ b/drivers/iio/adc/ina2xx-adc.c @@ -540,7 +540,8 @@ static int ina2xx_buffer_enable(struct iio_dev *indio_dev) chip->prev_ns = iio_get_time_ns(); chip->task = kthread_run(ina2xx_capture_thread, (void *)indio_dev, - "ina2xx-%uus", sampling_us); + "%s:%d-%uus", indio_dev->name, indio_dev->id, + sampling_us); return PTR_ERR_OR_ZERO(chip->task); } From 16846ebeffe4e74a16f25237003eab6d0535d8dd Mon Sep 17 00:00:00 2001 From: Haibo Chen Date: Tue, 8 Dec 2015 18:26:20 +0800 Subject: [PATCH 497/843] iio: adc: add IMX7D ADC driver support Freescale i.MX7D soc contains a new ADC IP. This patch add this ADC driver support, and the driver only support ADC software trigger. Signed-off-by: Haibo Chen Signed-off-by: Jonathan Cameron --- drivers/iio/adc/Kconfig | 9 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/imx7d_adc.c | 609 ++++++++++++++++++++++++++++++++++++ 3 files changed, 619 insertions(+) create mode 100644 drivers/iio/adc/imx7d_adc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index cb68bd9d2052..605ff42c4631 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -204,6 +204,15 @@ config INA2XX_ADC Say yes here to build support for TI INA2xx family of Power Monitors. This driver is mutually exclusive with the HWMON version. +config IMX7D_ADC + tristate "IMX7D ADC driver" + depends on ARCH_MXC || COMPILE_TEST + help + Say yes here to build support for IMX7D ADC. + + This driver can also be built as a module. If so, the module will be + called imx7d_adc. + config LP8788_ADC tristate "LP8788 ADC driver" depends on MFD_LP8788 diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index c62c5fa91c82..6435780e9b71 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -20,6 +20,7 @@ obj-$(CONFIG_CC10001_ADC) += cc10001_adc.o obj-$(CONFIG_DA9150_GPADC) += da9150-gpadc.o obj-$(CONFIG_EXYNOS_ADC) += exynos_adc.o obj-$(CONFIG_HI8435) += hi8435.o +obj-$(CONFIG_IMX7D_ADC) += imx7d_adc.o obj-$(CONFIG_INA2XX_ADC) += ina2xx-adc.o obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o obj-$(CONFIG_MAX1027) += max1027.o diff --git a/drivers/iio/adc/imx7d_adc.c b/drivers/iio/adc/imx7d_adc.c new file mode 100644 index 000000000000..e2241ee94783 --- /dev/null +++ b/drivers/iio/adc/imx7d_adc.c @@ -0,0 +1,609 @@ +/* + * Freescale i.MX7D ADC driver + * + * Copyright (C) 2015 Freescale Semiconductor, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +/* ADC register */ +#define IMX7D_REG_ADC_CH_A_CFG1 0x00 +#define IMX7D_REG_ADC_CH_A_CFG2 0x10 +#define IMX7D_REG_ADC_CH_B_CFG1 0x20 +#define IMX7D_REG_ADC_CH_B_CFG2 0x30 +#define IMX7D_REG_ADC_CH_C_CFG1 0x40 +#define IMX7D_REG_ADC_CH_C_CFG2 0x50 +#define IMX7D_REG_ADC_CH_D_CFG1 0x60 +#define IMX7D_REG_ADC_CH_D_CFG2 0x70 +#define IMX7D_REG_ADC_CH_SW_CFG 0x80 +#define IMX7D_REG_ADC_TIMER_UNIT 0x90 +#define IMX7D_REG_ADC_DMA_FIFO 0xa0 +#define IMX7D_REG_ADC_FIFO_STATUS 0xb0 +#define IMX7D_REG_ADC_INT_SIG_EN 0xc0 +#define IMX7D_REG_ADC_INT_EN 0xd0 +#define IMX7D_REG_ADC_INT_STATUS 0xe0 +#define IMX7D_REG_ADC_CHA_B_CNV_RSLT 0xf0 +#define IMX7D_REG_ADC_CHC_D_CNV_RSLT 0x100 +#define IMX7D_REG_ADC_CH_SW_CNV_RSLT 0x110 +#define IMX7D_REG_ADC_DMA_FIFO_DAT 0x120 +#define IMX7D_REG_ADC_ADC_CFG 0x130 + +#define IMX7D_REG_ADC_CHANNEL_CFG2_BASE 0x10 +#define IMX7D_EACH_CHANNEL_REG_OFFSET 0x20 + +#define IMX7D_REG_ADC_CH_CFG1_CHANNEL_EN (0x1 << 31) +#define IMX7D_REG_ADC_CH_CFG1_CHANNEL_SINGLE BIT(30) +#define IMX7D_REG_ADC_CH_CFG1_CHANNEL_AVG_EN BIT(29) +#define IMX7D_REG_ADC_CH_CFG1_CHANNEL_SEL(x) ((x) << 24) + +#define IMX7D_REG_ADC_CH_CFG2_AVG_NUM_4 (0x0 << 12) +#define IMX7D_REG_ADC_CH_CFG2_AVG_NUM_8 (0x1 << 12) +#define IMX7D_REG_ADC_CH_CFG2_AVG_NUM_16 (0x2 << 12) +#define IMX7D_REG_ADC_CH_CFG2_AVG_NUM_32 (0x3 << 12) + +#define IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_4 (0x0 << 29) +#define IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_8 (0x1 << 29) +#define IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_16 (0x2 << 29) +#define IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_32 (0x3 << 29) +#define IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_64 (0x4 << 29) +#define IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_128 (0x5 << 29) + +#define IMX7D_REG_ADC_ADC_CFG_ADC_CLK_DOWN BIT(31) +#define IMX7D_REG_ADC_ADC_CFG_ADC_POWER_DOWN BIT(1) +#define IMX7D_REG_ADC_ADC_CFG_ADC_EN BIT(0) + +#define IMX7D_REG_ADC_INT_CHA_COV_INT_EN BIT(8) +#define IMX7D_REG_ADC_INT_CHB_COV_INT_EN BIT(9) +#define IMX7D_REG_ADC_INT_CHC_COV_INT_EN BIT(10) +#define IMX7D_REG_ADC_INT_CHD_COV_INT_EN BIT(11) +#define IMX7D_REG_ADC_INT_CHANNEL_INT_EN \ + (IMX7D_REG_ADC_INT_CHA_COV_INT_EN | \ + IMX7D_REG_ADC_INT_CHB_COV_INT_EN | \ + IMX7D_REG_ADC_INT_CHC_COV_INT_EN | \ + IMX7D_REG_ADC_INT_CHD_COV_INT_EN) +#define IMX7D_REG_ADC_INT_STATUS_CHANNEL_INT_STATUS 0xf00 +#define IMX7D_REG_ADC_INT_STATUS_CHANNEL_CONV_TIME_OUT 0xf0000 + +#define IMX7D_ADC_TIMEOUT msecs_to_jiffies(100) + +enum imx7d_adc_clk_pre_div { + IMX7D_ADC_ANALOG_CLK_PRE_DIV_4, + IMX7D_ADC_ANALOG_CLK_PRE_DIV_8, + IMX7D_ADC_ANALOG_CLK_PRE_DIV_16, + IMX7D_ADC_ANALOG_CLK_PRE_DIV_32, + IMX7D_ADC_ANALOG_CLK_PRE_DIV_64, + IMX7D_ADC_ANALOG_CLK_PRE_DIV_128, +}; + +enum imx7d_adc_average_num { + IMX7D_ADC_AVERAGE_NUM_4, + IMX7D_ADC_AVERAGE_NUM_8, + IMX7D_ADC_AVERAGE_NUM_16, + IMX7D_ADC_AVERAGE_NUM_32, +}; + +struct imx7d_adc_feature { + enum imx7d_adc_clk_pre_div clk_pre_div; + enum imx7d_adc_average_num avg_num; + + u32 core_time_unit; /* impact the sample rate */ + + bool average_en; +}; + +struct imx7d_adc { + struct device *dev; + void __iomem *regs; + struct clk *clk; + + u32 vref_uv; + u32 value; + u32 channel; + u32 pre_div_num; + + struct regulator *vref; + struct imx7d_adc_feature adc_feature; + + struct completion completion; +}; + +struct imx7d_adc_analogue_core_clk { + u32 pre_div; + u32 reg_config; +}; + +#define IMX7D_ADC_ANALOGUE_CLK_CONFIG(_pre_div, _reg_conf) { \ + .pre_div = (_pre_div), \ + .reg_config = (_reg_conf), \ +} + +static const struct imx7d_adc_analogue_core_clk imx7d_adc_analogue_clk[] = { + IMX7D_ADC_ANALOGUE_CLK_CONFIG(4, IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_4), + IMX7D_ADC_ANALOGUE_CLK_CONFIG(8, IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_8), + IMX7D_ADC_ANALOGUE_CLK_CONFIG(16, IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_16), + IMX7D_ADC_ANALOGUE_CLK_CONFIG(32, IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_32), + IMX7D_ADC_ANALOGUE_CLK_CONFIG(64, IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_64), + IMX7D_ADC_ANALOGUE_CLK_CONFIG(128, IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_128), +}; + +#define IMX7D_ADC_CHAN(_idx) { \ + .type = IIO_VOLTAGE, \ + .indexed = 1, \ + .channel = (_idx), \ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) | \ + BIT(IIO_CHAN_INFO_SAMP_FREQ), \ +} + +static const struct iio_chan_spec imx7d_adc_iio_channels[] = { + IMX7D_ADC_CHAN(0), + IMX7D_ADC_CHAN(1), + IMX7D_ADC_CHAN(2), + IMX7D_ADC_CHAN(3), + IMX7D_ADC_CHAN(4), + IMX7D_ADC_CHAN(5), + IMX7D_ADC_CHAN(6), + IMX7D_ADC_CHAN(7), + IMX7D_ADC_CHAN(8), + IMX7D_ADC_CHAN(9), + IMX7D_ADC_CHAN(10), + IMX7D_ADC_CHAN(11), + IMX7D_ADC_CHAN(12), + IMX7D_ADC_CHAN(13), + IMX7D_ADC_CHAN(14), + IMX7D_ADC_CHAN(15), +}; + +static const u32 imx7d_adc_average_num[] = { + IMX7D_REG_ADC_CH_CFG2_AVG_NUM_4, + IMX7D_REG_ADC_CH_CFG2_AVG_NUM_8, + IMX7D_REG_ADC_CH_CFG2_AVG_NUM_16, + IMX7D_REG_ADC_CH_CFG2_AVG_NUM_32, +}; + +static void imx7d_adc_feature_config(struct imx7d_adc *info) +{ + info->adc_feature.clk_pre_div = IMX7D_ADC_ANALOG_CLK_PRE_DIV_4; + info->adc_feature.avg_num = IMX7D_ADC_AVERAGE_NUM_32; + info->adc_feature.core_time_unit = 1; + info->adc_feature.average_en = true; +} + +static void imx7d_adc_sample_rate_set(struct imx7d_adc *info) +{ + struct imx7d_adc_feature *adc_feature = &info->adc_feature; + struct imx7d_adc_analogue_core_clk adc_analogure_clk; + u32 i; + u32 tmp_cfg1; + u32 sample_rate = 0; + + /* + * Before sample set, disable channel A,B,C,D. Here we + * clear the bit 31 of register REG_ADC_CH_A\B\C\D_CFG1. + */ + for (i = 0; i < 4; i++) { + tmp_cfg1 = + readl(info->regs + i * IMX7D_EACH_CHANNEL_REG_OFFSET); + tmp_cfg1 &= ~IMX7D_REG_ADC_CH_CFG1_CHANNEL_EN; + writel(tmp_cfg1, + info->regs + i * IMX7D_EACH_CHANNEL_REG_OFFSET); + } + + adc_analogure_clk = imx7d_adc_analogue_clk[adc_feature->clk_pre_div]; + sample_rate |= adc_analogure_clk.reg_config; + info->pre_div_num = adc_analogure_clk.pre_div; + + sample_rate |= adc_feature->core_time_unit; + writel(sample_rate, info->regs + IMX7D_REG_ADC_TIMER_UNIT); +} + +static void imx7d_adc_hw_init(struct imx7d_adc *info) +{ + u32 cfg; + + /* power up and enable adc analogue core */ + cfg = readl(info->regs + IMX7D_REG_ADC_ADC_CFG); + cfg &= ~(IMX7D_REG_ADC_ADC_CFG_ADC_CLK_DOWN | + IMX7D_REG_ADC_ADC_CFG_ADC_POWER_DOWN); + cfg |= IMX7D_REG_ADC_ADC_CFG_ADC_EN; + writel(cfg, info->regs + IMX7D_REG_ADC_ADC_CFG); + + /* enable channel A,B,C,D interrupt */ + writel(IMX7D_REG_ADC_INT_CHANNEL_INT_EN, + info->regs + IMX7D_REG_ADC_INT_SIG_EN); + writel(IMX7D_REG_ADC_INT_CHANNEL_INT_EN, + info->regs + IMX7D_REG_ADC_INT_EN); + + imx7d_adc_sample_rate_set(info); +} + +static void imx7d_adc_channel_set(struct imx7d_adc *info) +{ + u32 cfg1 = 0; + u32 cfg2; + u32 channel; + + channel = info->channel; + + /* the channel choose single conversion, and enable average mode */ + cfg1 |= (IMX7D_REG_ADC_CH_CFG1_CHANNEL_EN | + IMX7D_REG_ADC_CH_CFG1_CHANNEL_SINGLE); + if (info->adc_feature.average_en) + cfg1 |= IMX7D_REG_ADC_CH_CFG1_CHANNEL_AVG_EN; + + /* + * physical channel 0 chose logical channel A + * physical channel 1 chose logical channel B + * physical channel 2 chose logical channel C + * physical channel 3 chose logical channel D + */ + cfg1 |= IMX7D_REG_ADC_CH_CFG1_CHANNEL_SEL(channel); + + /* + * read register REG_ADC_CH_A\B\C\D_CFG2, according to the + * channel chosen + */ + cfg2 = readl(info->regs + IMX7D_EACH_CHANNEL_REG_OFFSET * channel + + IMX7D_REG_ADC_CHANNEL_CFG2_BASE); + + cfg2 |= imx7d_adc_average_num[info->adc_feature.avg_num]; + + /* + * write the register REG_ADC_CH_A\B\C\D_CFG2, according to + * the channel chosen + */ + writel(cfg2, info->regs + IMX7D_EACH_CHANNEL_REG_OFFSET * channel + + IMX7D_REG_ADC_CHANNEL_CFG2_BASE); + writel(cfg1, info->regs + IMX7D_EACH_CHANNEL_REG_OFFSET * channel); +} + +static u32 imx7d_adc_get_sample_rate(struct imx7d_adc *info) +{ + /* input clock is always 24MHz */ + u32 input_clk = 24000000; + u32 analogue_core_clk; + u32 core_time_unit = info->adc_feature.core_time_unit; + u32 tmp; + + analogue_core_clk = input_clk / info->pre_div_num; + tmp = (core_time_unit + 1) * 6; + + return analogue_core_clk / tmp; +} + +static int imx7d_adc_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, + int *val2, + long mask) +{ + struct imx7d_adc *info = iio_priv(indio_dev); + + u32 channel; + long ret; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + mutex_lock(&indio_dev->mlock); + reinit_completion(&info->completion); + + channel = chan->channel & 0x03; + info->channel = channel; + imx7d_adc_channel_set(info); + + ret = wait_for_completion_interruptible_timeout + (&info->completion, IMX7D_ADC_TIMEOUT); + if (ret == 0) { + mutex_unlock(&indio_dev->mlock); + return -ETIMEDOUT; + } + if (ret < 0) { + mutex_unlock(&indio_dev->mlock); + return ret; + } + + *val = info->value; + mutex_unlock(&indio_dev->mlock); + return IIO_VAL_INT; + + case IIO_CHAN_INFO_SCALE: + info->vref_uv = regulator_get_voltage(info->vref); + *val = info->vref_uv / 1000; + *val2 = 12; + return IIO_VAL_FRACTIONAL_LOG2; + + case IIO_CHAN_INFO_SAMP_FREQ: + *val = imx7d_adc_get_sample_rate(info); + return IIO_VAL_INT; + + default: + return -EINVAL; + } +} + +static int imx7d_adc_read_data(struct imx7d_adc *info) +{ + u32 channel; + u32 value; + + channel = info->channel & 0x03; + + /* + * channel A and B conversion result share one register, + * bit[27~16] is the channel B conversion result, + * bit[11~0] is the channel A conversion result. + * channel C and D is the same. + */ + if (channel < 2) + value = readl(info->regs + IMX7D_REG_ADC_CHA_B_CNV_RSLT); + else + value = readl(info->regs + IMX7D_REG_ADC_CHC_D_CNV_RSLT); + if (channel & 0x1) /* channel B or D */ + value = (value >> 16) & 0xFFF; + else /* channel A or C */ + value &= 0xFFF; + + return value; +} + +static irqreturn_t imx7d_adc_isr(int irq, void *dev_id) +{ + struct imx7d_adc *info = (struct imx7d_adc *)dev_id; + int status; + + status = readl(info->regs + IMX7D_REG_ADC_INT_STATUS); + if (status & IMX7D_REG_ADC_INT_STATUS_CHANNEL_INT_STATUS) { + info->value = imx7d_adc_read_data(info); + complete(&info->completion); + + /* + * The register IMX7D_REG_ADC_INT_STATUS can't clear + * itself after read operation, need software to write + * 0 to the related bit. Here we clear the channel A/B/C/D + * conversion finished flag. + */ + status &= ~IMX7D_REG_ADC_INT_STATUS_CHANNEL_INT_STATUS; + writel(status, info->regs + IMX7D_REG_ADC_INT_STATUS); + } + + /* + * If the channel A/B/C/D conversion timeout, report it and clear these + * timeout flags. + */ + if (status & IMX7D_REG_ADC_INT_STATUS_CHANNEL_CONV_TIME_OUT) { + pr_err("%s: ADC got conversion time out interrupt: 0x%08x\n", + dev_name(info->dev), status); + status &= ~IMX7D_REG_ADC_INT_STATUS_CHANNEL_CONV_TIME_OUT; + writel(status, info->regs + IMX7D_REG_ADC_INT_STATUS); + } + + return IRQ_HANDLED; +} + +static int imx7d_adc_reg_access(struct iio_dev *indio_dev, + unsigned reg, unsigned writeval, + unsigned *readval) +{ + struct imx7d_adc *info = iio_priv(indio_dev); + + if (!readval || reg % 4 || reg > IMX7D_REG_ADC_ADC_CFG) + return -EINVAL; + + *readval = readl(info->regs + reg); + + return 0; +} + +static const struct iio_info imx7d_adc_iio_info = { + .driver_module = THIS_MODULE, + .read_raw = &imx7d_adc_read_raw, + .debugfs_reg_access = &imx7d_adc_reg_access, +}; + +static const struct of_device_id imx7d_adc_match[] = { + { .compatible = "fsl,imx7d-adc", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, imx7d_adc_match); + +static void imx7d_adc_power_down(struct imx7d_adc *info) +{ + u32 adc_cfg; + + adc_cfg = readl(info->regs + IMX7D_REG_ADC_ADC_CFG); + adc_cfg |= IMX7D_REG_ADC_ADC_CFG_ADC_CLK_DOWN | + IMX7D_REG_ADC_ADC_CFG_ADC_POWER_DOWN; + adc_cfg &= ~IMX7D_REG_ADC_ADC_CFG_ADC_EN; + writel(adc_cfg, info->regs + IMX7D_REG_ADC_ADC_CFG); +} + +static int imx7d_adc_probe(struct platform_device *pdev) +{ + struct imx7d_adc *info; + struct iio_dev *indio_dev; + struct resource *mem; + int irq; + int ret; + + indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*info)); + if (!indio_dev) { + dev_err(&pdev->dev, "Failed allocating iio device\n"); + return -ENOMEM; + } + + info = iio_priv(indio_dev); + info->dev = &pdev->dev; + + mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + info->regs = devm_ioremap_resource(&pdev->dev, mem); + if (IS_ERR(info->regs)) { + ret = PTR_ERR(info->regs); + dev_err(&pdev->dev, + "Failed to remap adc memory, err = %d\n", ret); + return ret; + } + + irq = platform_get_irq(pdev, 0); + if (irq < 0) { + dev_err(&pdev->dev, "No irq resource?\n"); + return irq; + } + + info->clk = devm_clk_get(&pdev->dev, "adc"); + if (IS_ERR(info->clk)) { + ret = PTR_ERR(info->clk); + dev_err(&pdev->dev, "Failed getting clock, err = %d\n", ret); + return ret; + } + + info->vref = devm_regulator_get(&pdev->dev, "vref"); + if (IS_ERR(info->vref)) { + ret = PTR_ERR(info->vref); + dev_err(&pdev->dev, + "Failed getting reference voltage, err = %d\n", ret); + return ret; + } + + ret = regulator_enable(info->vref); + if (ret) { + dev_err(&pdev->dev, + "Can't enable adc reference top voltage, err = %d\n", + ret); + return ret; + } + + platform_set_drvdata(pdev, indio_dev); + + init_completion(&info->completion); + + indio_dev->name = dev_name(&pdev->dev); + indio_dev->dev.parent = &pdev->dev; + indio_dev->info = &imx7d_adc_iio_info; + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->channels = imx7d_adc_iio_channels; + indio_dev->num_channels = ARRAY_SIZE(imx7d_adc_iio_channels); + + ret = clk_prepare_enable(info->clk); + if (ret) { + dev_err(&pdev->dev, + "Could not prepare or enable the clock.\n"); + goto error_adc_clk_enable; + } + + ret = devm_request_irq(info->dev, irq, + imx7d_adc_isr, 0, + dev_name(&pdev->dev), info); + if (ret < 0) { + dev_err(&pdev->dev, "Failed requesting irq, irq = %d\n", irq); + goto error_iio_device_register; + } + + imx7d_adc_feature_config(info); + imx7d_adc_hw_init(info); + + ret = iio_device_register(indio_dev); + if (ret) { + imx7d_adc_power_down(info); + dev_err(&pdev->dev, "Couldn't register the device.\n"); + goto error_iio_device_register; + } + + return 0; + +error_iio_device_register: + clk_disable_unprepare(info->clk); +error_adc_clk_enable: + regulator_disable(info->vref); + + return ret; +} + +static int imx7d_adc_remove(struct platform_device *pdev) +{ + struct iio_dev *indio_dev = platform_get_drvdata(pdev); + struct imx7d_adc *info = iio_priv(indio_dev); + + iio_device_unregister(indio_dev); + + imx7d_adc_power_down(info); + + clk_disable_unprepare(info->clk); + regulator_disable(info->vref); + + return 0; +} + +static int __maybe_unused imx7d_adc_suspend(struct device *dev) +{ + struct iio_dev *indio_dev = dev_get_drvdata(dev); + struct imx7d_adc *info = iio_priv(indio_dev); + + imx7d_adc_power_down(info); + + clk_disable_unprepare(info->clk); + regulator_disable(info->vref); + + return 0; +} + +static int __maybe_unused imx7d_adc_resume(struct device *dev) +{ + struct iio_dev *indio_dev = dev_get_drvdata(dev); + struct imx7d_adc *info = iio_priv(indio_dev); + int ret; + + ret = regulator_enable(info->vref); + if (ret) { + dev_err(info->dev, + "Can't enable adc reference top voltage, err = %d\n", + ret); + return ret; + } + + ret = clk_prepare_enable(info->clk); + if (ret) { + dev_err(info->dev, + "Could not prepare or enable clock.\n"); + regulator_disable(info->vref); + return ret; + } + + imx7d_adc_hw_init(info); + + return 0; +} + +static SIMPLE_DEV_PM_OPS(imx7d_adc_pm_ops, imx7d_adc_suspend, imx7d_adc_resume); + +static struct platform_driver imx7d_adc_driver = { + .probe = imx7d_adc_probe, + .remove = imx7d_adc_remove, + .driver = { + .name = "imx7d_adc", + .of_match_table = imx7d_adc_match, + .pm = &imx7d_adc_pm_ops, + }, +}; + +module_platform_driver(imx7d_adc_driver); + +MODULE_AUTHOR("Haibo Chen "); +MODULE_DESCRIPTION("Freeacale IMX7D ADC driver"); +MODULE_LICENSE("GPL v2"); From 50672011d676aea5e521bc77dfce0c9eea040782 Mon Sep 17 00:00:00 2001 From: Haibo Chen Date: Tue, 8 Dec 2015 18:26:21 +0800 Subject: [PATCH 498/843] Documentation: add the binding file for Freescale imx7d ADC driver The patch adds the binding file for Freescale imx7d ADC driver. Signed-off-by: Haibo Chen Acked-by: Rob Herring Signed-off-by: Jonathan Cameron --- .../devicetree/bindings/iio/adc/imx7d-adc.txt | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/imx7d-adc.txt diff --git a/Documentation/devicetree/bindings/iio/adc/imx7d-adc.txt b/Documentation/devicetree/bindings/iio/adc/imx7d-adc.txt new file mode 100644 index 000000000000..5c184b940669 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/imx7d-adc.txt @@ -0,0 +1,22 @@ +Freescale imx7d ADC bindings + +The devicetree bindings are for the ADC driver written for +imx7d SoC. + +Required properties: +- compatible: Should be "fsl,imx7d-adc" +- reg: Offset and length of the register set for the ADC device +- interrupts: The interrupt number for the ADC device +- clocks: The root clock of the ADC controller +- clock-names: Must contain "adc", matching entry in the clocks property +- vref-supply: The regulator supply ADC reference voltage + +Example: +adc1: adc@30610000 { + compatible = "fsl,imx7d-adc"; + reg = <0x30610000 0x10000>; + interrupts = ; + clocks = <&clks IMX7D_ADC_ROOT_CLK>; + clock-names = "adc"; + vref-supply = <®_vcc_3v3_mcu>; +}; From c34c18195d30aa3b95f5ae1b4349875c45fdb8e4 Mon Sep 17 00:00:00 2001 From: Anshul Garg Date: Tue, 8 Dec 2015 09:45:56 -0800 Subject: [PATCH 499/843] iio/inkern.c Use list_for_each_entry_safe Use list_for_each_entry_safe instead of list_for_each_safe and list_entry call. Signed-off-by: Anshul Garg Signed-off-by: Jonathan Cameron --- drivers/iio/inkern.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index c8bad3cf891d..80fbbfd76faf 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c @@ -61,12 +61,10 @@ EXPORT_SYMBOL_GPL(iio_map_array_register); int iio_map_array_unregister(struct iio_dev *indio_dev) { int ret = -ENODEV; - struct iio_map_internal *mapi; - struct list_head *pos, *tmp; + struct iio_map_internal *mapi, *next; mutex_lock(&iio_map_list_lock); - list_for_each_safe(pos, tmp, &iio_map_list) { - mapi = list_entry(pos, struct iio_map_internal, l); + list_for_each_entry_safe(mapi, next, &iio_map_list, l) { if (indio_dev == mapi->indio_dev) { list_del(&mapi->l); kfree(mapi); From d3ae4fa40088045b500f4d1ce85eb926b6cd2d3e Mon Sep 17 00:00:00 2001 From: Gustavo Padovan Date: Thu, 26 Nov 2015 11:03:56 -0200 Subject: [PATCH 500/843] staging/android: add TODO to de-stage android sync framework MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - remove CONFIG_SW_SYNC_USER, it is used only for testing/debugging and should not be upstreamed. - port CONFIG_SW_SYNC_USER tests interfaces to use debugfs somehow - port libsync tests to kselftest - clean up and ABI check for security issues - move the sync framework to drivers/base/dma-buf Cc: Arve Hjønnevåg Cc: Riley Andrews Cc: Daniel Vetter Cc: Rob Clark Cc: Greg Hackmann Cc: John Harrison Signed-off-by: Gustavo Padovan Acked-by: Daniel Vetter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/TODO | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/staging/android/TODO b/drivers/staging/android/TODO index 8f3ac37bfe12..64d8c8720960 100644 --- a/drivers/staging/android/TODO +++ b/drivers/staging/android/TODO @@ -25,5 +25,13 @@ ion/ exposes existing cma regions and doesn't reserve unecessarily memory when booting a system which doesn't use ion. +sync framework: + - remove CONFIG_SW_SYNC_USER, it is used only for testing/debugging and + should not be upstreamed. + - port CONFIG_SW_SYNC_USER tests interfaces to use debugfs somehow + - port libsync tests to kselftest + - clean up and ABI check for security issues + - move it to drivers/base/dma-buf + Please send patches to Greg Kroah-Hartman and Cc: Arve Hjønnevåg and Riley Andrews From 706ab42eae8a7a320d0364c7040c9419bfdea235 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:48:54 +0900 Subject: [PATCH 501/843] staging: wilc1000: fix return type of host_int_add_ptk This patch changes return type of host_int_add_ptk from s32 to int. The result variable gets return value from wilc_mq_send that has return type of int. It should be changed return type of this function as well as data type of result variable. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index d5b7725ec2bf..082450f4459c 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3207,12 +3207,12 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, return result; } -s32 host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *pu8Ptk, +int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *pu8Ptk, u8 u8PtkKeylen, const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx) { - s32 result = 0; + int result = 0; struct host_if_msg msg; u8 u8KeyLen = u8PtkKeylen; u32 i; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 57e1d424afdc..ee9c8fed0134 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -311,7 +311,7 @@ int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv, int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, const u8 *key, u8 len, u8 index, u8 mode, enum AUTHTYPE auth_type); -s32 host_int_add_ptk(struct host_if_drv *hWFIDrv, const u8 *pu8Ptk, +int host_int_add_ptk(struct host_if_drv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen, const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx); From d17b7dd24212b7bb823c4c568268b29577943f96 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:48:55 +0900 Subject: [PATCH 502/843] staging: wilc1000: fix argument name of host_int_add_ptk This patch changes struct host_if_drv of host_int_add_ptk function declaration from hWFIDrv to hif_drv. With this change, first parameter of this function declaration and definition has same name as hif_drv. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index ee9c8fed0134..12deff432d58 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -311,7 +311,7 @@ int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv, int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, const u8 *key, u8 len, u8 index, u8 mode, enum AUTHTYPE auth_type); -int host_int_add_ptk(struct host_if_drv *hWFIDrv, const u8 *pu8Ptk, +int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *pu8Ptk, u8 u8PtkKeylen, const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx); From d170536f3add3ef96fe0015ac38c886f17f5aeb6 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:48:56 +0900 Subject: [PATCH 503/843] staging: wilc1000: rename pu8Ptk in host_int_add_ptk This patch changes pu8Ptk to ptk to avoid camelcase. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 082450f4459c..d225dbf3c1b0 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3207,7 +3207,7 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, return result; } -int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *pu8Ptk, +int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, u8 u8PtkKeylen, const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx) @@ -3240,7 +3240,7 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *pu8Ptk, msg.body.key_info.action = ADDKEY; msg.body.key_info.attr.wpa.key = kmalloc(u8PtkKeylen, GFP_KERNEL); - memcpy(msg.body.key_info.attr.wpa.key, pu8Ptk, u8PtkKeylen); + memcpy(msg.body.key_info.attr.wpa.key, ptk, u8PtkKeylen); if (pu8RxMic) { memcpy(msg.body.key_info.attr.wpa.key + 16, pu8RxMic, RX_MIC_KEY_LEN); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 12deff432d58..ae70dc578e63 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -311,7 +311,7 @@ int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv, int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, const u8 *key, u8 len, u8 index, u8 mode, enum AUTHTYPE auth_type); -int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *pu8Ptk, +int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, u8 u8PtkKeylen, const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx); From 0743b7eaffa7380842e59372094ba236b3763322 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:48:57 +0900 Subject: [PATCH 504/843] staging: wilc1000: rename u8PtkKeylen in host_int_add_ptk This patch changes u8PtkKeylen to ptk_key_len to avoid camelcase. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 8 ++++---- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index d225dbf3c1b0..96a0a5890002 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3208,13 +3208,13 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, } int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, - u8 u8PtkKeylen, const u8 *mac_addr, + u8 ptk_key_len, const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx) { int result = 0; struct host_if_msg msg; - u8 u8KeyLen = u8PtkKeylen; + u8 u8KeyLen = ptk_key_len; u32 i; if (!hif_drv) { @@ -3239,8 +3239,8 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, if (mode == STATION_MODE) msg.body.key_info.action = ADDKEY; - msg.body.key_info.attr.wpa.key = kmalloc(u8PtkKeylen, GFP_KERNEL); - memcpy(msg.body.key_info.attr.wpa.key, ptk, u8PtkKeylen); + msg.body.key_info.attr.wpa.key = kmalloc(ptk_key_len, GFP_KERNEL); + memcpy(msg.body.key_info.attr.wpa.key, ptk, ptk_key_len); if (pu8RxMic) { memcpy(msg.body.key_info.attr.wpa.key + 16, pu8RxMic, RX_MIC_KEY_LEN); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index ae70dc578e63..ae0e260d3ca6 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -312,7 +312,7 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, const u8 *key, u8 len, u8 index, u8 mode, enum AUTHTYPE auth_type); int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, - u8 u8PtkKeylen, const u8 *mac_addr, + u8 ptk_key_len, const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx); s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, From 38f6629054b974af4ccee3bef055b97b5b048089 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:48:58 +0900 Subject: [PATCH 505/843] staging: wilc1000: rename pu8RxMic in host_int_add_ptk This patch changes pu8RxMic to rx_mic to avoid camelcase. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 10 +++++----- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 96a0a5890002..9616a6136619 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3209,7 +3209,7 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, u8 ptk_key_len, const u8 *mac_addr, - const u8 *pu8RxMic, const u8 *pu8TxMic, + const u8 *rx_mic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx) { int result = 0; @@ -3222,7 +3222,7 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, return -EFAULT; } - if (pu8RxMic) + if (rx_mic) u8KeyLen += RX_MIC_KEY_LEN; if (pu8TxMic) @@ -3242,11 +3242,11 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, msg.body.key_info.attr.wpa.key = kmalloc(ptk_key_len, GFP_KERNEL); memcpy(msg.body.key_info.attr.wpa.key, ptk, ptk_key_len); - if (pu8RxMic) { - memcpy(msg.body.key_info.attr.wpa.key + 16, pu8RxMic, RX_MIC_KEY_LEN); + if (rx_mic) { + memcpy(msg.body.key_info.attr.wpa.key + 16, rx_mic, RX_MIC_KEY_LEN); if (INFO) { for (i = 0; i < RX_MIC_KEY_LEN; i++) - PRINT_INFO(CFG80211_DBG, "PairwiseRx[%d] = %x\n", i, pu8RxMic[i]); + PRINT_INFO(CFG80211_DBG, "PairwiseRx[%d] = %x\n", i, rx_mic[i]); } } if (pu8TxMic) { diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index ae0e260d3ca6..2ee93045aaf5 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -313,7 +313,7 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, enum AUTHTYPE auth_type); int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, u8 ptk_key_len, const u8 *mac_addr, - const u8 *pu8RxMic, const u8 *pu8TxMic, + const u8 *rx_mic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx); s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime); From d7c0242be1a380110502396e79ec782e02f14d60 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:48:59 +0900 Subject: [PATCH 506/843] staging: wilc1000: rename pu8TxMic in host_int_add_ptk This patch changes pu8TxMic to tx_mic to avoid camelcase. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 10 +++++----- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 9616a6136619..a8566eebda8a 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3209,7 +3209,7 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, u8 ptk_key_len, const u8 *mac_addr, - const u8 *rx_mic, const u8 *pu8TxMic, + const u8 *rx_mic, const u8 *tx_mic, u8 mode, u8 u8Ciphermode, u8 u8Idx) { int result = 0; @@ -3225,7 +3225,7 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, if (rx_mic) u8KeyLen += RX_MIC_KEY_LEN; - if (pu8TxMic) + if (tx_mic) u8KeyLen += TX_MIC_KEY_LEN; memset(&msg, 0, sizeof(struct host_if_msg)); @@ -3249,11 +3249,11 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, PRINT_INFO(CFG80211_DBG, "PairwiseRx[%d] = %x\n", i, rx_mic[i]); } } - if (pu8TxMic) { - memcpy(msg.body.key_info.attr.wpa.key + 24, pu8TxMic, TX_MIC_KEY_LEN); + if (tx_mic) { + memcpy(msg.body.key_info.attr.wpa.key + 24, tx_mic, TX_MIC_KEY_LEN); if (INFO) { for (i = 0; i < TX_MIC_KEY_LEN; i++) - PRINT_INFO(CFG80211_DBG, "PairwiseTx[%d] = %x\n", i, pu8TxMic[i]); + PRINT_INFO(CFG80211_DBG, "PairwiseTx[%d] = %x\n", i, tx_mic[i]); } } diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 2ee93045aaf5..5da584b9d8cc 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -313,7 +313,7 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, enum AUTHTYPE auth_type); int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, u8 ptk_key_len, const u8 *mac_addr, - const u8 *rx_mic, const u8 *pu8TxMic, + const u8 *rx_mic, const u8 *tx_mic, u8 mode, u8 u8Ciphermode, u8 u8Idx); s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime); From f0c82579d853825d5728d189dba8dbbad61cbaca Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:00 +0900 Subject: [PATCH 507/843] staging: wilc1000: rename u8Ciphermode in host_int_add_ptk This patch changes u8Ciphermode to cipher_mode to avoid camelcase. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index a8566eebda8a..80a1442ab6d2 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3210,7 +3210,7 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, u8 ptk_key_len, const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic, - u8 mode, u8 u8Ciphermode, u8 u8Idx) + u8 mode, u8 cipher_mode, u8 u8Idx) { int result = 0; struct host_if_msg msg; @@ -3259,7 +3259,7 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, msg.body.key_info.attr.wpa.key_len = u8KeyLen; msg.body.key_info.attr.wpa.mac_addr = mac_addr; - msg.body.key_info.attr.wpa.mode = u8Ciphermode; + msg.body.key_info.attr.wpa.mode = cipher_mode; msg.drv = hif_drv; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 5da584b9d8cc..04ecf502a3a3 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -314,7 +314,7 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, u8 ptk_key_len, const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic, - u8 mode, u8 u8Ciphermode, u8 u8Idx); + u8 mode, u8 cipher_mode, u8 u8Idx); s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime); s32 host_int_add_rx_gtk(struct host_if_drv *hWFIDrv, const u8 *pu8RxGtk, From 3e5c4ab6cf313ec9feec075fdcc0d28ba2316849 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:01 +0900 Subject: [PATCH 508/843] staging: wilc1000: rename u8Idx in host_int_add_ptk This patch changes u8Idx to index to avoid camelcase. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 80a1442ab6d2..fedd099b5298 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3210,7 +3210,7 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, u8 ptk_key_len, const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic, - u8 mode, u8 cipher_mode, u8 u8Idx) + u8 mode, u8 cipher_mode, u8 index) { int result = 0; struct host_if_msg msg; @@ -3234,7 +3234,7 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, msg.body.key_info.type = WPA_PTK; if (mode == AP_MODE) { msg.body.key_info.action = ADDKEY_AP; - msg.body.key_info.attr.wpa.index = u8Idx; + msg.body.key_info.attr.wpa.index = index; } if (mode == STATION_MODE) msg.body.key_info.action = ADDKEY; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 04ecf502a3a3..92383158b843 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -314,7 +314,7 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, u8 ptk_key_len, const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic, - u8 mode, u8 cipher_mode, u8 u8Idx); + u8 mode, u8 cipher_mode, u8 index); s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime); s32 host_int_add_rx_gtk(struct host_if_drv *hWFIDrv, const u8 *pu8RxGtk, From fa2690747580c9f6f6ce5da7ca2dc7d311c35051 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:02 +0900 Subject: [PATCH 509/843] staging: wilc1000: replace u32 with int The data type of variable i changes u32 to int. It is used as array index to print debug message so that it is better to use data type of int. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index fedd099b5298..a959f48d03f6 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3215,7 +3215,7 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, int result = 0; struct host_if_msg msg; u8 u8KeyLen = ptk_key_len; - u32 i; + int i; if (!hif_drv) { PRINT_ER("driver is null\n"); From 53bbbb575cb8d557fcf96998da42d0a2ab57d036 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:03 +0900 Subject: [PATCH 510/843] staging: wilc1000: rename u8KeyLen in host_int_add_ptk This patch changes u8KeyLen to key_len to avoid camelcase. It is used as local variable in order to save pkt_key_len that is argument of this function. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index a959f48d03f6..dd7e8edb850d 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3214,7 +3214,7 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, { int result = 0; struct host_if_msg msg; - u8 u8KeyLen = ptk_key_len; + u8 key_len = ptk_key_len; int i; if (!hif_drv) { @@ -3223,10 +3223,10 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, } if (rx_mic) - u8KeyLen += RX_MIC_KEY_LEN; + key_len += RX_MIC_KEY_LEN; if (tx_mic) - u8KeyLen += TX_MIC_KEY_LEN; + key_len += TX_MIC_KEY_LEN; memset(&msg, 0, sizeof(struct host_if_msg)); @@ -3257,7 +3257,7 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, } } - msg.body.key_info.attr.wpa.key_len = u8KeyLen; + msg.body.key_info.attr.wpa.key_len = key_len; msg.body.key_info.attr.wpa.mac_addr = mac_addr; msg.body.key_info.attr.wpa.mode = cipher_mode; msg.drv = hif_drv; From 8ab8c59218d79effc763d6f20cb0d0bad783fd56 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:04 +0900 Subject: [PATCH 511/843] staging: wilc1000: use kmemdup in host_int_add_ptk This patch changes kmalloc followed by memcpy to kmemdup The error checking is also added when kmemdup is failed. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index dd7e8edb850d..18623c7b99da 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3239,8 +3239,9 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, if (mode == STATION_MODE) msg.body.key_info.action = ADDKEY; - msg.body.key_info.attr.wpa.key = kmalloc(ptk_key_len, GFP_KERNEL); - memcpy(msg.body.key_info.attr.wpa.key, ptk, ptk_key_len); + msg.body.key_info.attr.wpa.key = kmemdup(ptk, ptk_key_len, GFP_KERNEL); + if (!msg.body.key_info.attr.wpa.key) + return -ENOMEM; if (rx_mic) { memcpy(msg.body.key_info.attr.wpa.key + 16, rx_mic, RX_MIC_KEY_LEN); From 1503457f7f08c2a9907060f8beca3a35c6c0c047 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:05 +0900 Subject: [PATCH 512/843] staging: wilc1000: fix return type of host_int_add_rx_gtk This patch changes return type of host_int_add_rx_gtk from s32 to int. The result variable gets return value from wilc_mq_send that has return type of int. It should be changed return type of this function as well as data type of result variable. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 18623c7b99da..12b3f1dc5cf1 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3273,13 +3273,13 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, return result; } -s32 host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *pu8RxGtk, +int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *pu8RxGtk, u8 u8GtkKeylen, u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode) { - s32 result = 0; + int result = 0; struct host_if_msg msg; u8 u8KeyLen = u8GtkKeylen; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 92383158b843..2f1059884b33 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -317,7 +317,7 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, u8 mode, u8 cipher_mode, u8 index); s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime); -s32 host_int_add_rx_gtk(struct host_if_drv *hWFIDrv, const u8 *pu8RxGtk, +int host_int_add_rx_gtk(struct host_if_drv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKeylen, u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC, const u8 *pu8RxMic, const u8 *pu8TxMic, From 84f82ed814196acbdc892cd2b98d3e696e6dd607 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:06 +0900 Subject: [PATCH 513/843] staging: wilc1000: fix argument name of host_int_add_rx_gtk This patch changes struct host_if_drv of host_int_add_rx_gtk function declaration from hWFIDrv to hif_drv. With this change, first argument of this function declaration and definition has same name as hif_drv. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 2f1059884b33..5f1b20cef2b3 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -317,7 +317,7 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, u8 mode, u8 cipher_mode, u8 index); s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime); -int host_int_add_rx_gtk(struct host_if_drv *hWFIDrv, const u8 *pu8RxGtk, +int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *pu8RxGtk, u8 u8GtkKeylen, u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC, const u8 *pu8RxMic, const u8 *pu8TxMic, From 3c0bf6b577bbd6900141e75e028e0dcb43be3903 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:07 +0900 Subject: [PATCH 514/843] staging: wilc1000: rename pu8RxGtk in host_int_add_rx_gtk This patch changes pu8RxGtk to rx_gtk to avoid camelcase. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 12b3f1dc5cf1..b79383ef9e95 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3273,7 +3273,7 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, return result; } -int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *pu8RxGtk, +int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, u8 u8GtkKeylen, u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC, const u8 *pu8RxMic, const u8 *pu8TxMic, @@ -3312,7 +3312,7 @@ int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *pu8RxGtk, msg.body.key_info.action = ADDKEY; msg.body.key_info.attr.wpa.key = kmalloc(u8KeyLen, GFP_KERNEL); - memcpy(msg.body.key_info.attr.wpa.key, pu8RxGtk, u8GtkKeylen); + memcpy(msg.body.key_info.attr.wpa.key, rx_gtk, u8GtkKeylen); if (pu8RxMic) memcpy(msg.body.key_info.attr.wpa.key + 16, pu8RxMic, diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 5f1b20cef2b3..51f51be9a554 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -317,7 +317,7 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, u8 mode, u8 cipher_mode, u8 index); s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime); -int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *pu8RxGtk, +int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, u8 u8GtkKeylen, u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC, const u8 *pu8RxMic, const u8 *pu8TxMic, From 5285e910fb57418e78b1675a279ad63e0ba0491c Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:08 +0900 Subject: [PATCH 515/843] staging: wilc1000: rename u8GtkKeylen in host_int_add_rx_gtk This patch changes u8GtkKeylen to gtk_key_len to avoid camelcase. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 6 +++--- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index b79383ef9e95..5c40d40ff7fb 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3274,14 +3274,14 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, } int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, - u8 u8GtkKeylen, u8 u8KeyIdx, + u8 gtk_key_len, u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode) { int result = 0; struct host_if_msg msg; - u8 u8KeyLen = u8GtkKeylen; + u8 u8KeyLen = gtk_key_len; if (!hif_drv) { PRINT_ER("driver is null\n"); @@ -3312,7 +3312,7 @@ int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, msg.body.key_info.action = ADDKEY; msg.body.key_info.attr.wpa.key = kmalloc(u8KeyLen, GFP_KERNEL); - memcpy(msg.body.key_info.attr.wpa.key, rx_gtk, u8GtkKeylen); + memcpy(msg.body.key_info.attr.wpa.key, rx_gtk, gtk_key_len); if (pu8RxMic) memcpy(msg.body.key_info.attr.wpa.key + 16, pu8RxMic, diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 51f51be9a554..6b7b05e41bc4 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -318,7 +318,7 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime); int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, - u8 u8GtkKeylen, u8 u8KeyIdx, + u8 gtk_key_len, u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode); From 9a5e57362474e1c508c20c4757b1f43855ae377e Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:09 +0900 Subject: [PATCH 516/843] staging: wilc1000: rename u8KeyIdx in host_int_add_rx_gtk This patch changes u8KeyIdx to index to avoid camelcase. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 5c40d40ff7fb..22fdca597e4a 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3274,7 +3274,7 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, } int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, - u8 gtk_key_len, u8 u8KeyIdx, + u8 gtk_key_len, u8 index, u32 u32KeyRSClen, const u8 *KeyRSC, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode) @@ -3322,7 +3322,7 @@ int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, memcpy(msg.body.key_info.attr.wpa.key + 24, pu8TxMic, TX_MIC_KEY_LEN); - msg.body.key_info.attr.wpa.index = u8KeyIdx; + msg.body.key_info.attr.wpa.index = index; msg.body.key_info.attr.wpa.key_len = u8KeyLen; msg.body.key_info.attr.wpa.seq_len = u32KeyRSClen; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 6b7b05e41bc4..41ca349c47ca 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -318,7 +318,7 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime); int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, - u8 gtk_key_len, u8 u8KeyIdx, + u8 gtk_key_len, u8 index, u32 u32KeyRSClen, const u8 *KeyRSC, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode); From 18bef999b1c01c79c11a310649a1a590a6523959 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:10 +0900 Subject: [PATCH 517/843] staging: wilc1000: rename u32KeyRSClen in host_int_add_rx_gtk This patch changes u32KeyRSClen to key_rsc_len to avoid camelcase. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 8 ++++---- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 22fdca597e4a..32d46064faf5 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3275,7 +3275,7 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, u8 gtk_key_len, u8 index, - u32 u32KeyRSClen, const u8 *KeyRSC, + u32 key_rsc_len, const u8 *KeyRSC, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode) { @@ -3296,8 +3296,8 @@ int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, u8KeyLen += TX_MIC_KEY_LEN; if (KeyRSC) { - msg.body.key_info.attr.wpa.seq = kmalloc(u32KeyRSClen, GFP_KERNEL); - memcpy(msg.body.key_info.attr.wpa.seq, KeyRSC, u32KeyRSClen); + msg.body.key_info.attr.wpa.seq = kmalloc(key_rsc_len, GFP_KERNEL); + memcpy(msg.body.key_info.attr.wpa.seq, KeyRSC, key_rsc_len); } msg.id = HOST_IF_MSG_KEY; @@ -3324,7 +3324,7 @@ int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, msg.body.key_info.attr.wpa.index = index; msg.body.key_info.attr.wpa.key_len = u8KeyLen; - msg.body.key_info.attr.wpa.seq_len = u32KeyRSClen; + msg.body.key_info.attr.wpa.seq_len = key_rsc_len; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 41ca349c47ca..f75bfa1b0437 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -319,7 +319,7 @@ s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime); int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, u8 gtk_key_len, u8 index, - u32 u32KeyRSClen, const u8 *KeyRSC, + u32 key_rsc_len, const u8 *KeyRSC, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode); s32 host_int_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen, From 982859ccf4a7bb2d49b24afa3007c048c2a986c2 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:11 +0900 Subject: [PATCH 518/843] staging: wilc1000: rename KeyRSC in host_int_add_rx_gtk This patch changes KeyRSC to key_rsc to avoid camelcase. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 6 +++--- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 32d46064faf5..b50e78dddb89 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3275,7 +3275,7 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, u8 gtk_key_len, u8 index, - u32 key_rsc_len, const u8 *KeyRSC, + u32 key_rsc_len, const u8 *key_rsc, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode) { @@ -3295,9 +3295,9 @@ int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, if (pu8TxMic) u8KeyLen += TX_MIC_KEY_LEN; - if (KeyRSC) { + if (key_rsc) { msg.body.key_info.attr.wpa.seq = kmalloc(key_rsc_len, GFP_KERNEL); - memcpy(msg.body.key_info.attr.wpa.seq, KeyRSC, key_rsc_len); + memcpy(msg.body.key_info.attr.wpa.seq, key_rsc, key_rsc_len); } msg.id = HOST_IF_MSG_KEY; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index f75bfa1b0437..66bb7d7f3eb2 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -319,7 +319,7 @@ s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime); int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, u8 gtk_key_len, u8 index, - u32 key_rsc_len, const u8 *KeyRSC, + u32 key_rsc_len, const u8 *key_rsc, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode); s32 host_int_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen, From 6d36c2737b9d642fdf9675de105bfb803c43fd2e Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:12 +0900 Subject: [PATCH 519/843] staging: wilc1000: rename pu8RxMic in host_int_add_rx_gtk This patch changes pu8RxMic to rx_mic to avoid camelcase. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 8 ++++---- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index b50e78dddb89..df364dc69682 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3276,7 +3276,7 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, u8 gtk_key_len, u8 index, u32 key_rsc_len, const u8 *key_rsc, - const u8 *pu8RxMic, const u8 *pu8TxMic, + const u8 *rx_mic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode) { int result = 0; @@ -3289,7 +3289,7 @@ int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, } memset(&msg, 0, sizeof(struct host_if_msg)); - if (pu8RxMic) + if (rx_mic) u8KeyLen += RX_MIC_KEY_LEN; if (pu8TxMic) @@ -3314,8 +3314,8 @@ int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, msg.body.key_info.attr.wpa.key = kmalloc(u8KeyLen, GFP_KERNEL); memcpy(msg.body.key_info.attr.wpa.key, rx_gtk, gtk_key_len); - if (pu8RxMic) - memcpy(msg.body.key_info.attr.wpa.key + 16, pu8RxMic, + if (rx_mic) + memcpy(msg.body.key_info.attr.wpa.key + 16, rx_mic, RX_MIC_KEY_LEN); if (pu8TxMic) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 66bb7d7f3eb2..42c8749117c2 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -320,7 +320,7 @@ s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, u8 gtk_key_len, u8 index, u32 key_rsc_len, const u8 *key_rsc, - const u8 *pu8RxMic, const u8 *pu8TxMic, + const u8 *rx_mic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode); s32 host_int_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk, u8 u8KeyIdx); From 2f79758de5c0bcefd897c78a9b5994f5fe74ab23 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:13 +0900 Subject: [PATCH 520/843] staging: wilc1000: rename pu8TxMic in host_int_add_rx_gtk This patch changes pu8TxMic to tx_mic to avoid camelcase. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 8 ++++---- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index df364dc69682..7ca924a279e2 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3276,7 +3276,7 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, u8 gtk_key_len, u8 index, u32 key_rsc_len, const u8 *key_rsc, - const u8 *rx_mic, const u8 *pu8TxMic, + const u8 *rx_mic, const u8 *tx_mic, u8 mode, u8 u8Ciphermode) { int result = 0; @@ -3292,7 +3292,7 @@ int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, if (rx_mic) u8KeyLen += RX_MIC_KEY_LEN; - if (pu8TxMic) + if (tx_mic) u8KeyLen += TX_MIC_KEY_LEN; if (key_rsc) { @@ -3318,8 +3318,8 @@ int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, memcpy(msg.body.key_info.attr.wpa.key + 16, rx_mic, RX_MIC_KEY_LEN); - if (pu8TxMic) - memcpy(msg.body.key_info.attr.wpa.key + 24, pu8TxMic, + if (tx_mic) + memcpy(msg.body.key_info.attr.wpa.key + 24, tx_mic, TX_MIC_KEY_LEN); msg.body.key_info.attr.wpa.index = index; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 42c8749117c2..e25f838a188e 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -320,7 +320,7 @@ s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, u8 gtk_key_len, u8 index, u32 key_rsc_len, const u8 *key_rsc, - const u8 *rx_mic, const u8 *pu8TxMic, + const u8 *rx_mic, const u8 *tx_mic, u8 mode, u8 u8Ciphermode); s32 host_int_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk, u8 u8KeyIdx); From 57bfcbc4d33491648500c739ee45594117a7cb0d Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:14 +0900 Subject: [PATCH 521/843] staging: wilc1000: rename u8Ciphermode in host_int_add_rx_gtk This patch changes u8Ciphermode to cipher_mode to avoid camelcase. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 ++-- drivers/staging/wilc1000/host_interface.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 7ca924a279e2..7b647ce65fae 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3277,7 +3277,7 @@ int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, u8 gtk_key_len, u8 index, u32 key_rsc_len, const u8 *key_rsc, const u8 *rx_mic, const u8 *tx_mic, - u8 mode, u8 u8Ciphermode) + u8 mode, u8 cipher_mode) { int result = 0; struct host_if_msg msg; @@ -3306,7 +3306,7 @@ int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, if (mode == AP_MODE) { msg.body.key_info.action = ADDKEY_AP; - msg.body.key_info.attr.wpa.mode = u8Ciphermode; + msg.body.key_info.attr.wpa.mode = cipher_mode; } if (mode == STATION_MODE) msg.body.key_info.action = ADDKEY; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index e25f838a188e..da81b9271979 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -321,7 +321,7 @@ int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, u8 gtk_key_len, u8 index, u32 key_rsc_len, const u8 *key_rsc, const u8 *rx_mic, const u8 *tx_mic, - u8 mode, u8 u8Ciphermode); + u8 mode, u8 cipher_mode); s32 host_int_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk, u8 u8KeyIdx); s32 host_int_set_pmkid_info(struct host_if_drv *hWFIDrv, From d002fcc0f2de5e05af3c9e753899985985a4d390 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:15 +0900 Subject: [PATCH 522/843] staging: wilc1000: rename u8KeyLen in host_int_add_rx_gtk This patch changes u8KeyLen to key_len to avoid camelcase. It is used as local variable in order to save gtk_key_len that is argument of this function. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 7b647ce65fae..0028bed54eae 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3281,7 +3281,7 @@ int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, { int result = 0; struct host_if_msg msg; - u8 u8KeyLen = gtk_key_len; + u8 key_len = gtk_key_len; if (!hif_drv) { PRINT_ER("driver is null\n"); @@ -3290,10 +3290,10 @@ int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, memset(&msg, 0, sizeof(struct host_if_msg)); if (rx_mic) - u8KeyLen += RX_MIC_KEY_LEN; + key_len += RX_MIC_KEY_LEN; if (tx_mic) - u8KeyLen += TX_MIC_KEY_LEN; + key_len += TX_MIC_KEY_LEN; if (key_rsc) { msg.body.key_info.attr.wpa.seq = kmalloc(key_rsc_len, GFP_KERNEL); @@ -3311,7 +3311,7 @@ int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, if (mode == STATION_MODE) msg.body.key_info.action = ADDKEY; - msg.body.key_info.attr.wpa.key = kmalloc(u8KeyLen, GFP_KERNEL); + msg.body.key_info.attr.wpa.key = kmalloc(key_len, GFP_KERNEL); memcpy(msg.body.key_info.attr.wpa.key, rx_gtk, gtk_key_len); if (rx_mic) @@ -3323,7 +3323,7 @@ int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, TX_MIC_KEY_LEN); msg.body.key_info.attr.wpa.index = index; - msg.body.key_info.attr.wpa.key_len = u8KeyLen; + msg.body.key_info.attr.wpa.key_len = key_len; msg.body.key_info.attr.wpa.seq_len = key_rsc_len; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); From 9bfda3820fe4e7e509aebe3b32b1514b5a615851 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:16 +0900 Subject: [PATCH 523/843] staging: wilc1000: use kmemdup in host_int_add_rx_gtk This patch changes kmalloc followed by memcpy to kmemdup. The error checking is also added when kmemdup is failed. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 0028bed54eae..51b6ddb821f7 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3296,8 +3296,11 @@ int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, key_len += TX_MIC_KEY_LEN; if (key_rsc) { - msg.body.key_info.attr.wpa.seq = kmalloc(key_rsc_len, GFP_KERNEL); - memcpy(msg.body.key_info.attr.wpa.seq, key_rsc, key_rsc_len); + msg.body.key_info.attr.wpa.seq = kmemdup(key_rsc, + key_rsc_len, + GFP_KERNEL); + if (!msg.body.key_info.attr.wpa.seq) + return -ENOMEM; } msg.id = HOST_IF_MSG_KEY; @@ -3311,8 +3314,11 @@ int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, if (mode == STATION_MODE) msg.body.key_info.action = ADDKEY; - msg.body.key_info.attr.wpa.key = kmalloc(key_len, GFP_KERNEL); - memcpy(msg.body.key_info.attr.wpa.key, rx_gtk, gtk_key_len); + msg.body.key_info.attr.wpa.key = kmemdup(rx_gtk, + key_len, + GFP_KERNEL); + if (!msg.body.key_info.attr.wpa.key) + return -ENOMEM; if (rx_mic) memcpy(msg.body.key_info.attr.wpa.key + 16, rx_mic, From 36e4cb257a8b49b72287416edb64e166f3fd0315 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:17 +0900 Subject: [PATCH 524/843] staging: wilc1000: remove host_int_add_tx_gtk declaration This patch removes host_int_add_tx_gtk declaration that is defined in host_interface.h file. It can not find any host_int_add_tx_gtk function definition in this driver so just remove it. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index da81b9271979..91fbfa6493cc 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -322,8 +322,6 @@ int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, u32 key_rsc_len, const u8 *key_rsc, const u8 *rx_mic, const u8 *tx_mic, u8 mode, u8 cipher_mode); -s32 host_int_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen, - u8 *pu8TxGtk, u8 u8KeyIdx); s32 host_int_set_pmkid_info(struct host_if_drv *hWFIDrv, struct host_if_pmkid_attr *pu8PmkidInfoArray); s32 host_int_get_pmkid_info(struct host_if_drv *hWFIDrv, u8 *pu8PmkidInfoArray, From 9d8b9156a67c9a0f00d10f93e7cb51c7b80312cb Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:18 +0900 Subject: [PATCH 525/843] staging: wilc1000: remove host_int_get_pmkid_info This patch removes host_int_get_pmkid_info function definition and declaration that is defined at host_interface.c and host_interface.h. This function is defined but not used anywhere in this driver so just remove it. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 14 -------------- drivers/staging/wilc1000/host_interface.h | 2 -- 2 files changed, 16 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 51b6ddb821f7..601558282ac4 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3373,20 +3373,6 @@ s32 host_int_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_at return result; } -s32 host_int_get_pmkid_info(struct host_if_drv *hif_drv, - u8 *pu8PmkidInfoArray, - u32 u32PmkidInfoLen) -{ - struct wid wid; - - wid.id = (u16)WID_PMKID_INFO; - wid.type = WID_STR; - wid.size = u32PmkidInfoLen; - wid.val = pu8PmkidInfoArray; - - return 0; -} - s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv, u8 *pu8PassPhrase, u8 u8Psklength) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 91fbfa6493cc..dd5a14a222d5 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -324,8 +324,6 @@ int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, u8 mode, u8 cipher_mode); s32 host_int_set_pmkid_info(struct host_if_drv *hWFIDrv, struct host_if_pmkid_attr *pu8PmkidInfoArray); -s32 host_int_get_pmkid_info(struct host_if_drv *hWFIDrv, u8 *pu8PmkidInfoArray, - u32 u32PmkidInfoLen); s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hWFIDrv, u8 *pu8PassPhrase, u8 u8Psklength); From bd6ef876c64cac2e3f4a5d49f47200158736d3d7 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:19 +0900 Subject: [PATCH 526/843] staging: wilc1000: remove host_int_set_RSNAConfigPSKPassPhrase This patch removes host_int_set_RSNAConfigPSKPassPhrase function definition and declaration that is defined at host_interface.c and host_interface.h. This function is defined but not used anywhere in this driver so just remove it. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 16 ---------------- drivers/staging/wilc1000/host_interface.h | 3 --- 2 files changed, 19 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 601558282ac4..fb6f353b6df2 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3373,22 +3373,6 @@ s32 host_int_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_at return result; } -s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv, - u8 *pu8PassPhrase, - u8 u8Psklength) -{ - struct wid wid; - - if ((u8Psklength > 7) && (u8Psklength < 65)) { - wid.id = (u16)WID_11I_PSK; - wid.type = WID_STR; - wid.val = pu8PassPhrase; - wid.size = u8Psklength; - } - - return 0; -} - s32 hif_get_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress) { s32 result = 0; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index dd5a14a222d5..8113d7656bc5 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -324,9 +324,6 @@ int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, u8 mode, u8 cipher_mode); s32 host_int_set_pmkid_info(struct host_if_drv *hWFIDrv, struct host_if_pmkid_attr *pu8PmkidInfoArray); -s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hWFIDrv, - u8 *pu8PassPhrase, - u8 u8Psklength); s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hWFIDrv, u8 *pu8PassPhrase, u8 u8Psklength); s32 hif_get_mac_address(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress); From cb12ac574fe0edf7a7812e0ec9af5b94c394580f Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:20 +0900 Subject: [PATCH 527/843] staging: wilc1000: remove host_int_get_RSNAConfigPSKPassPhrase This patch removes host_int_get_RSNAConfigPSKPassPhrase function definition and declaration that is defined at host_interface.c and host_interface.h. This function is defined but not used anywhere in this driver so just remove it. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 13 ------------- drivers/staging/wilc1000/host_interface.h | 2 -- 2 files changed, 15 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index fb6f353b6df2..f7bbad0de708 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3413,19 +3413,6 @@ s32 host_int_set_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress) return result; } -s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv, - u8 *pu8PassPhrase, u8 u8Psklength) -{ - struct wid wid; - - wid.id = (u16)WID_11I_PSK; - wid.type = WID_STR; - wid.size = u8Psklength; - wid.val = pu8PassPhrase; - - return 0; -} - s32 host_int_set_start_scan_req(struct host_if_drv *hif_drv, u8 scanSource) { struct wid wid; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 8113d7656bc5..976067a34db0 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -324,8 +324,6 @@ int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, u8 mode, u8 cipher_mode); s32 host_int_set_pmkid_info(struct host_if_drv *hWFIDrv, struct host_if_pmkid_attr *pu8PmkidInfoArray); -s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hWFIDrv, - u8 *pu8PassPhrase, u8 u8Psklength); s32 hif_get_mac_address(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress); s32 host_int_set_MacAddress(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress); int host_int_wait_msg_queue_idle(void); From a17a1f2bd204a10082e7e88bdbc433a85cc92e1e Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:21 +0900 Subject: [PATCH 528/843] staging: wilc1000: remove host_int_set_start_scan_req This patch removes host_int_set_start_scan_req function definition and declaration that is defined at host_interface.c and host_interface.h. This function is defined but not used anywhere in this driver so that just remove it. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 12 ------------ drivers/staging/wilc1000/host_interface.h | 1 - 2 files changed, 13 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index f7bbad0de708..174cb6adb64c 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3413,18 +3413,6 @@ s32 host_int_set_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress) return result; } -s32 host_int_set_start_scan_req(struct host_if_drv *hif_drv, u8 scanSource) -{ - struct wid wid; - - wid.id = (u16)WID_START_SCAN_REQ; - wid.type = WID_CHAR; - wid.val = (s8 *)&scanSource; - wid.size = sizeof(char); - - return 0; -} - s32 host_int_get_start_scan_req(struct host_if_drv *hif_drv, u8 *pu8ScanSource) { struct wid wid; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 976067a34db0..14ce3972711f 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -327,7 +327,6 @@ s32 host_int_set_pmkid_info(struct host_if_drv *hWFIDrv, s32 hif_get_mac_address(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress); s32 host_int_set_MacAddress(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress); int host_int_wait_msg_queue_idle(void); -s32 host_int_set_start_scan_req(struct host_if_drv *hWFIDrv, u8 scanSource); s32 host_int_get_start_scan_req(struct host_if_drv *hWFIDrv, u8 *pu8ScanSource); s32 host_int_set_join_req(struct host_if_drv *hWFIDrv, u8 *pu8bssid, const u8 *pu8ssid, size_t ssidLen, From 9c2a6f282636214e6cfb7e4c454e84151f31467b Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:22 +0900 Subject: [PATCH 529/843] staging: wilc1000: remove host_int_get_start_scan_req This patch removes host_int_get_start_scan_req function definition and declaration that is defined at host_interface.c and host_interface.h. This function is defined but not used anywhere in this driver so just remove it. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 12 ------------ drivers/staging/wilc1000/host_interface.h | 1 - 2 files changed, 13 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 174cb6adb64c..057534518f49 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3413,18 +3413,6 @@ s32 host_int_set_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress) return result; } -s32 host_int_get_start_scan_req(struct host_if_drv *hif_drv, u8 *pu8ScanSource) -{ - struct wid wid; - - wid.id = (u16)WID_START_SCAN_REQ; - wid.type = WID_CHAR; - wid.val = (s8 *)pu8ScanSource; - wid.size = sizeof(char); - - return 0; -} - s32 host_int_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid, const u8 *pu8ssid, size_t ssidLen, const u8 *pu8IEs, size_t IEsLen, diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 14ce3972711f..52622dfd9735 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -327,7 +327,6 @@ s32 host_int_set_pmkid_info(struct host_if_drv *hWFIDrv, s32 hif_get_mac_address(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress); s32 host_int_set_MacAddress(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress); int host_int_wait_msg_queue_idle(void); -s32 host_int_get_start_scan_req(struct host_if_drv *hWFIDrv, u8 *pu8ScanSource); s32 host_int_set_join_req(struct host_if_drv *hWFIDrv, u8 *pu8bssid, const u8 *pu8ssid, size_t ssidLen, const u8 *pu8IEs, size_t IEsLen, From 3fbb77f2b3aacd054564e7431c17f1f44fdf65c3 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:23 +0900 Subject: [PATCH 530/843] staging: wilc1000: remove host_int_disconnect_station This patch removes host_int_disconnect_station function definition and declaration that is defined at host_interface.c and host_interface.h. This function is defined but not used anywhere so just remove it. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 12 ------------ drivers/staging/wilc1000/host_interface.h | 1 - 2 files changed, 13 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 057534518f49..676b3c7afeb0 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3529,18 +3529,6 @@ s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode) return result; } -s32 host_int_disconnect_station(struct host_if_drv *hif_drv, u8 assoc_id) -{ - struct wid wid; - - wid.id = (u16)WID_DISCONNECT; - wid.type = WID_CHAR; - wid.val = (s8 *)&assoc_id; - wid.size = sizeof(char); - - return 0; -} - s32 host_int_get_assoc_req_info(struct host_if_drv *hif_drv, u8 *pu8AssocReqInfo, u32 u32AssocReqInfoLen) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 52622dfd9735..e51a56351f3d 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -335,7 +335,6 @@ s32 host_int_set_join_req(struct host_if_drv *hWFIDrv, u8 *pu8bssid, u8 u8channel, void *pJoinParams); s32 host_int_flush_join_req(struct host_if_drv *hWFIDrv); s32 host_int_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode); -s32 host_int_disconnect_station(struct host_if_drv *hWFIDrv, u8 assoc_id); s32 host_int_get_assoc_req_info(struct host_if_drv *hWFIDrv, u8 *pu8AssocReqInfo, u32 u32AssocReqInfoLen); From 409bee3de116090091e214aa0396143314295676 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:24 +0900 Subject: [PATCH 531/843] staging: wilc1000: remove host_int_get_assoc_req_info This patch removes host_int_get_assoc_req_info function definition and declaration that is defined at host_interface.c and host_interface.h. This function is defined but not used anywhere in this driver so just remove it. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 14 -------------- drivers/staging/wilc1000/host_interface.h | 3 --- 2 files changed, 17 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 676b3c7afeb0..ff1517914069 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3529,20 +3529,6 @@ s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode) return result; } -s32 host_int_get_assoc_req_info(struct host_if_drv *hif_drv, - u8 *pu8AssocReqInfo, - u32 u32AssocReqInfoLen) -{ - struct wid wid; - - wid.id = (u16)WID_ASSOC_REQ_INFO; - wid.type = WID_STR; - wid.val = pu8AssocReqInfo; - wid.size = u32AssocReqInfoLen; - - return 0; -} - s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, u8 *pu8AssocRespInfo, u32 u32MaxAssocRespInfoLen, diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index e51a56351f3d..887045844085 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -335,9 +335,6 @@ s32 host_int_set_join_req(struct host_if_drv *hWFIDrv, u8 *pu8bssid, u8 u8channel, void *pJoinParams); s32 host_int_flush_join_req(struct host_if_drv *hWFIDrv); s32 host_int_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode); -s32 host_int_get_assoc_req_info(struct host_if_drv *hWFIDrv, - u8 *pu8AssocReqInfo, - u32 u32AssocReqInfoLen); s32 host_int_get_assoc_res_info(struct host_if_drv *hWFIDrv, u8 *pu8AssocRespInfo, u32 u32MaxAssocRespInfoLen, From e3b14ba3779d4e4d5d72801bbe14bb11c052aaa8 Mon Sep 17 00:00:00 2001 From: Chaehyun Lim Date: Sun, 8 Nov 2015 16:49:25 +0900 Subject: [PATCH 532/843] staging: wilc1000: remove host_int_get_rx_power_level This patch removes host_int_get_rx_power_level function definition and declaration that is defined at host_interface.c and host_interface.h. This function is defined but not used anywhere in this driver so just remove it. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 14 -------------- drivers/staging/wilc1000/host_interface.h | 3 --- 2 files changed, 17 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index ff1517914069..5bf9a55ce4ea 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3560,20 +3560,6 @@ s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, return result; } -s32 host_int_get_rx_power_level(struct host_if_drv *hif_drv, - u8 *pu8RxPowerLevel, - u32 u32RxPowerLevelLen) -{ - struct wid wid; - - wid.id = (u16)WID_RX_POWER_LEVEL; - wid.type = WID_STR; - wid.val = pu8RxPowerLevel; - wid.size = u32RxPowerLevelLen; - - return 0; -} - int host_int_set_mac_chnl_num(struct host_if_drv *hif_drv, u8 channel) { int result; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 887045844085..c01f441a780b 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -339,9 +339,6 @@ s32 host_int_get_assoc_res_info(struct host_if_drv *hWFIDrv, u8 *pu8AssocRespInfo, u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen); -s32 host_int_get_rx_power_level(struct host_if_drv *hWFIDrv, - u8 *pu8RxPowerLevel, - u32 u32RxPowerLevelLen); int host_int_set_mac_chnl_num(struct host_if_drv *wfi_drv, u8 channel); s32 host_int_get_host_chnl_num(struct host_if_drv *hWFIDrv, u8 *pu8ChNo); s32 host_int_get_rssi(struct host_if_drv *hWFIDrv, s8 *ps8Rssi); From 5f550d930791b4b78f2c946060ee7cca3c03b113 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 16 Nov 2015 15:04:52 +0100 Subject: [PATCH 533/843] staging/wilc1000: remove unused functions A number of symbols in the wilc1000 driver are completely unused and can be removed. This includes two variables that are only written but not read. Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 295 ------------------ drivers/staging/wilc1000/host_interface.h | 19 -- drivers/staging/wilc1000/linux_wlan_sdio.c | 11 - drivers/staging/wilc1000/linux_wlan_sdio.h | 1 - drivers/staging/wilc1000/linux_wlan_spi.c | 14 - drivers/staging/wilc1000/linux_wlan_spi.h | 1 - drivers/staging/wilc1000/wilc_sdio.c | 56 ---- drivers/staging/wilc1000/wilc_spi.c | 225 ------------- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 36 --- drivers/staging/wilc1000/wilc_wlan.c | 4 - 10 files changed, 662 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index d5b7725ec2bf..6c205b97293d 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3366,36 +3366,6 @@ s32 host_int_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_at return result; } -s32 host_int_get_pmkid_info(struct host_if_drv *hif_drv, - u8 *pu8PmkidInfoArray, - u32 u32PmkidInfoLen) -{ - struct wid wid; - - wid.id = (u16)WID_PMKID_INFO; - wid.type = WID_STR; - wid.size = u32PmkidInfoLen; - wid.val = pu8PmkidInfoArray; - - return 0; -} - -s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv, - u8 *pu8PassPhrase, - u8 u8Psklength) -{ - struct wid wid; - - if ((u8Psklength > 7) && (u8Psklength < 65)) { - wid.id = (u16)WID_11I_PSK; - wid.type = WID_STR; - wid.val = pu8PassPhrase; - wid.size = u8Psklength; - } - - return 0; -} - s32 hif_get_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress) { s32 result = 0; @@ -3436,19 +3406,6 @@ s32 host_int_set_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress) return result; } -s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv, - u8 *pu8PassPhrase, u8 u8Psklength) -{ - struct wid wid; - - wid.id = (u16)WID_11I_PSK; - wid.type = WID_STR; - wid.size = u8Psklength; - wid.val = pu8PassPhrase; - - return 0; -} - s32 host_int_set_start_scan_req(struct host_if_drv *hif_drv, u8 scanSource) { struct wid wid; @@ -3461,18 +3418,6 @@ s32 host_int_set_start_scan_req(struct host_if_drv *hif_drv, u8 scanSource) return 0; } -s32 host_int_get_start_scan_req(struct host_if_drv *hif_drv, u8 *pu8ScanSource) -{ - struct wid wid; - - wid.id = (u16)WID_START_SCAN_REQ; - wid.type = WID_CHAR; - wid.val = (s8 *)pu8ScanSource; - wid.size = sizeof(char); - - return 0; -} - s32 host_int_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid, const u8 *pu8ssid, size_t ssidLen, const u8 *pu8IEs, size_t IEsLen, @@ -3589,31 +3534,6 @@ s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode) return result; } -s32 host_int_disconnect_station(struct host_if_drv *hif_drv, u8 assoc_id) -{ - struct wid wid; - - wid.id = (u16)WID_DISCONNECT; - wid.type = WID_CHAR; - wid.val = (s8 *)&assoc_id; - wid.size = sizeof(char); - - return 0; -} - -s32 host_int_get_assoc_req_info(struct host_if_drv *hif_drv, - u8 *pu8AssocReqInfo, - u32 u32AssocReqInfoLen) -{ - struct wid wid; - - wid.id = (u16)WID_ASSOC_REQ_INFO; - wid.type = WID_STR; - wid.val = pu8AssocReqInfo; - wid.size = u32AssocReqInfoLen; - - return 0; -} s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, u8 *pu8AssocRespInfo, @@ -3646,20 +3566,6 @@ s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, return result; } -s32 host_int_get_rx_power_level(struct host_if_drv *hif_drv, - u8 *pu8RxPowerLevel, - u32 u32RxPowerLevelLen) -{ - struct wid wid; - - wid.id = (u16)WID_RX_POWER_LEVEL; - wid.type = WID_STR; - wid.val = pu8RxPowerLevel; - wid.size = u32RxPowerLevelLen; - - return 0; -} - int host_int_set_mac_chnl_num(struct host_if_drv *hif_drv, u8 channel) { int result; @@ -3740,31 +3646,6 @@ int host_int_set_operation_mode(struct host_if_drv *hif_drv, u32 mode) return result; } -s32 host_int_get_host_chnl_num(struct host_if_drv *hif_drv, u8 *pu8ChNo) -{ - s32 result = 0; - struct host_if_msg msg; - - if (!hif_drv) { - PRINT_ER("driver is null\n"); - return -EFAULT; - } - - memset(&msg, 0, sizeof(struct host_if_msg)); - - msg.id = HOST_IF_MSG_GET_CHNL; - msg.drv = hif_drv; - - result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); - if (result) - PRINT_ER("wilc mq send fail\n"); - down(&hif_drv->sem_get_chnl); - - *pu8ChNo = ch_no; - - return result; -} - s32 host_int_get_inactive_time(struct host_if_drv *hif_drv, const u8 *mac, u32 *pu32InactiveTime) { @@ -3793,34 +3674,6 @@ s32 host_int_get_inactive_time(struct host_if_drv *hif_drv, return result; } -s32 host_int_test_get_int_wid(struct host_if_drv *hif_drv, u32 *pu32TestMemAddr) -{ - s32 result = 0; - struct wid wid; - - if (!hif_drv) { - PRINT_ER("driver is null\n"); - return -EFAULT; - } - - wid.id = (u16)WID_MEMORY_ADDRESS; - wid.type = WID_INT; - wid.val = (s8 *)pu32TestMemAddr; - wid.size = sizeof(u32); - - result = send_config_pkt(GET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); - - if (result) { - PRINT_ER("Failed to get wid value\n"); - return -EINVAL; - } else { - PRINT_D(HOSTINF_DBG, "Successfully got wid value\n"); - } - - return result; -} - s32 host_int_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi) { s32 result = 0; @@ -3848,33 +3701,6 @@ s32 host_int_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi) return result; } -s32 host_int_get_link_speed(struct host_if_drv *hif_drv, s8 *ps8lnkspd) -{ - struct host_if_msg msg; - s32 result = 0; - - memset(&msg, 0, sizeof(struct host_if_msg)); - msg.id = HOST_IF_MSG_GET_LINKSPEED; - msg.drv = hif_drv; - - result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); - if (result) { - PRINT_ER("Failed to send GET_LINKSPEED to message queue "); - return -EFAULT; - } - - down(&hif_drv->sem_get_link_speed); - - if (!ps8lnkspd) { - PRINT_ER("LINKSPEED pointer value is null"); - return -EFAULT; - } - - *ps8lnkspd = link_speed; - - return result; -} - s32 host_int_get_statistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics) { s32 result = 0; @@ -3969,99 +3795,6 @@ s32 hif_set_cfg(struct host_if_drv *hif_drv, return result; } -s32 hif_get_cfg(struct host_if_drv *hif_drv, u16 u16WID, u16 *pu16WID_Value) -{ - s32 result = 0; - - down(&hif_drv->sem_cfg_values); - - if (!hif_drv) { - PRINT_ER("hif_drv NULL\n"); - return -EFAULT; - } - PRINT_D(HOSTINF_DBG, "Getting configuration parameters\n"); - switch (u16WID) { - case WID_BSS_TYPE: - *pu16WID_Value = (u16)hif_drv->cfg_values.bss_type; - break; - - case WID_AUTH_TYPE: - *pu16WID_Value = (u16)hif_drv->cfg_values.auth_type; - break; - - case WID_AUTH_TIMEOUT: - *pu16WID_Value = hif_drv->cfg_values.auth_timeout; - break; - - case WID_POWER_MANAGEMENT: - *pu16WID_Value = (u16)hif_drv->cfg_values.power_mgmt_mode; - break; - - case WID_SHORT_RETRY_LIMIT: - *pu16WID_Value = hif_drv->cfg_values.short_retry_limit; - break; - - case WID_LONG_RETRY_LIMIT: - *pu16WID_Value = hif_drv->cfg_values.long_retry_limit; - break; - - case WID_FRAG_THRESHOLD: - *pu16WID_Value = hif_drv->cfg_values.frag_threshold; - break; - - case WID_RTS_THRESHOLD: - *pu16WID_Value = hif_drv->cfg_values.rts_threshold; - break; - - case WID_PREAMBLE: - *pu16WID_Value = (u16)hif_drv->cfg_values.preamble_type; - break; - - case WID_SHORT_SLOT_ALLOWED: - *pu16WID_Value = (u16)hif_drv->cfg_values.short_slot_allowed; - break; - - case WID_11N_TXOP_PROT_DISABLE: - *pu16WID_Value = (u16)hif_drv->cfg_values.txop_prot_disabled; - break; - - case WID_BEACON_INTERVAL: - *pu16WID_Value = hif_drv->cfg_values.beacon_interval; - break; - - case WID_DTIM_PERIOD: - *pu16WID_Value = (u16)hif_drv->cfg_values.dtim_period; - break; - - case WID_SITE_SURVEY: - *pu16WID_Value = (u16)hif_drv->cfg_values.site_survey_enabled; - break; - - case WID_SITE_SURVEY_SCAN_TIME: - *pu16WID_Value = hif_drv->cfg_values.site_survey_scan_time; - break; - - case WID_ACTIVE_SCAN_TIME: - *pu16WID_Value = hif_drv->cfg_values.active_scan_time; - break; - - case WID_PASSIVE_SCAN_TIME: - *pu16WID_Value = hif_drv->cfg_values.passive_scan_time; - break; - - case WID_CURRENT_TX_RATE: - *pu16WID_Value = hif_drv->cfg_values.curr_tx_rate; - break; - - default: - break; - } - - up(&hif_drv->sem_cfg_values); - - return result; -} - static void GetPeriodicRSSI(unsigned long arg) { struct host_if_drv *hif_drv = (struct host_if_drv *)arg; @@ -4916,34 +4649,6 @@ void host_int_freeJoinParams(void *pJoinParams) PRINT_ER("Unable to FREE null pointer\n"); } -s32 host_int_delBASession(struct host_if_drv *hif_drv, char *pBSSID, char TID) -{ - s32 result = 0; - struct host_if_msg msg; - struct ba_session_info *pBASessionInfo = &msg.body.session_info; - - if (!hif_drv) { - PRINT_ER("driver is null\n"); - return -EFAULT; - } - - memset(&msg, 0, sizeof(struct host_if_msg)); - - msg.id = HOST_IF_MSG_DEL_BA_SESSION; - - memcpy(pBASessionInfo->bssid, pBSSID, ETH_ALEN); - pBASessionInfo->tid = TID; - msg.drv = hif_drv; - - result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); - if (result) - PRINT_ER("wilc_mq_send fail\n"); - - down(&hif_sema_wait_response); - - return result; -} - s32 host_int_del_All_Rx_BASession(struct host_if_drv *hif_drv, char *pBSSID, char TID) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 57e1d424afdc..c1ed2e236ee2 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -326,18 +326,10 @@ s32 host_int_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk, u8 u8KeyIdx); s32 host_int_set_pmkid_info(struct host_if_drv *hWFIDrv, struct host_if_pmkid_attr *pu8PmkidInfoArray); -s32 host_int_get_pmkid_info(struct host_if_drv *hWFIDrv, u8 *pu8PmkidInfoArray, - u32 u32PmkidInfoLen); -s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hWFIDrv, - u8 *pu8PassPhrase, - u8 u8Psklength); -s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hWFIDrv, - u8 *pu8PassPhrase, u8 u8Psklength); s32 hif_get_mac_address(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress); s32 host_int_set_MacAddress(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress); int host_int_wait_msg_queue_idle(void); s32 host_int_set_start_scan_req(struct host_if_drv *hWFIDrv, u8 scanSource); -s32 host_int_get_start_scan_req(struct host_if_drv *hWFIDrv, u8 *pu8ScanSource); s32 host_int_set_join_req(struct host_if_drv *hWFIDrv, u8 *pu8bssid, const u8 *pu8ssid, size_t ssidLen, const u8 *pu8IEs, size_t IEsLen, @@ -346,21 +338,12 @@ s32 host_int_set_join_req(struct host_if_drv *hWFIDrv, u8 *pu8bssid, u8 u8channel, void *pJoinParams); s32 host_int_flush_join_req(struct host_if_drv *hWFIDrv); s32 host_int_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode); -s32 host_int_disconnect_station(struct host_if_drv *hWFIDrv, u8 assoc_id); -s32 host_int_get_assoc_req_info(struct host_if_drv *hWFIDrv, - u8 *pu8AssocReqInfo, - u32 u32AssocReqInfoLen); s32 host_int_get_assoc_res_info(struct host_if_drv *hWFIDrv, u8 *pu8AssocRespInfo, u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen); -s32 host_int_get_rx_power_level(struct host_if_drv *hWFIDrv, - u8 *pu8RxPowerLevel, - u32 u32RxPowerLevelLen); int host_int_set_mac_chnl_num(struct host_if_drv *wfi_drv, u8 channel); -s32 host_int_get_host_chnl_num(struct host_if_drv *hWFIDrv, u8 *pu8ChNo); s32 host_int_get_rssi(struct host_if_drv *hWFIDrv, s8 *ps8Rssi); -s32 host_int_get_link_speed(struct host_if_drv *hWFIDrv, s8 *ps8lnkspd); s32 host_int_scan(struct host_if_drv *hWFIDrv, u8 u8ScanSource, u8 u8ScanType, u8 *pu8ChnlFreqList, u8 u8ChnlListLen, const u8 *pu8IEs, @@ -368,7 +351,6 @@ s32 host_int_scan(struct host_if_drv *hWFIDrv, u8 u8ScanSource, void *pvUserArg, struct hidden_network *pstrHiddenNetwork); s32 hif_set_cfg(struct host_if_drv *hWFIDrv, struct cfg_param_val *pstrCfgParamVal); -s32 hif_get_cfg(struct host_if_drv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value); s32 host_int_init(struct net_device *dev, struct host_if_drv **phWFIDrv); s32 host_int_deinit(struct host_if_drv *hWFIDrv); s32 host_int_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval, @@ -394,7 +376,6 @@ s32 host_int_setup_multicast_filter(struct host_if_drv *hWFIDrv, s32 host_int_setup_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx); -s32 host_int_delBASession(struct host_if_drv *hWFIDrv, char *pBSSID, char TID); s32 host_int_del_All_Rx_BASession(struct host_if_drv *hWFIDrv, char *pBSSID, char TID); diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index e854d376878f..9e8ba04ca9c8 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -226,17 +226,6 @@ int linux_sdio_init(void) return 1; } -void linux_sdio_deinit(void *pv) -{ - - /** - * TODO : - **/ - - - sdio_unregister_driver(&wilc_bus); -} - int linux_sdio_set_max_speed(void) { return linux_sdio_set_speed(MAX_SPEED); diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h b/drivers/staging/wilc1000/linux_wlan_sdio.h index 6f42bc75b507..7c59b2f6543a 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.h +++ b/drivers/staging/wilc1000/linux_wlan_sdio.h @@ -4,7 +4,6 @@ extern struct sdio_driver wilc_bus; #include int linux_sdio_init(void); -void linux_sdio_deinit(void *); int linux_sdio_cmd52(sdio_cmd52_t *cmd); int linux_sdio_cmd53(sdio_cmd53_t *cmd); int enable_sdio_interrupt(void); diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index 73c788f602c0..3655077a936f 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -42,7 +42,6 @@ static u32 SPEED = MIN_SPEED; struct spi_device *wilc_spi_dev; -void linux_spi_deinit(void *vp); static int __init wilc_bus_probe(struct spi_device *spi) { @@ -80,19 +79,6 @@ struct spi_driver wilc_bus __refdata = { .remove = __exit_p(wilc_bus_remove), }; - -void linux_spi_deinit(void *vp) -{ - - spi_unregister_driver(&wilc_bus); - - SPEED = MIN_SPEED; - PRINT_ER("@@@@@@@@@@@@ restore SPI speed to %d @@@@@@@@@\n", SPEED); - -} - - - int linux_spi_init(void) { int ret = 1; diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h b/drivers/staging/wilc1000/linux_wlan_spi.h index b9561003ecf0..2edd97b4c5cc 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.h +++ b/drivers/staging/wilc1000/linux_wlan_spi.h @@ -6,7 +6,6 @@ extern struct spi_device *wilc_spi_dev; extern struct spi_driver wilc_bus; int linux_spi_init(void); -void linux_spi_deinit(void *vp); int linux_spi_write(u8 *b, u32 len); int linux_spi_read(u8 *rb, u32 rlen); int linux_spi_write_read(u8 *wb, u8 *rb, u32 rlen); diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index 8aacf55e5eb8..d26e4cf0f436 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -157,67 +157,11 @@ static int sdio_clear_int(void) } -u32 sdio_xfer_cnt(void) -{ - u32 cnt = 0; - sdio_cmd52_t cmd; - - cmd.read_write = 0; - cmd.function = 1; - cmd.raw = 0; - cmd.address = 0x1C; - cmd.data = 0; - linux_sdio_cmd52(&cmd); - cnt = cmd.data; - - cmd.read_write = 0; - cmd.function = 1; - cmd.raw = 0; - cmd.address = 0x1D; - cmd.data = 0; - linux_sdio_cmd52(&cmd); - cnt |= (cmd.data << 8); - - cmd.read_write = 0; - cmd.function = 1; - cmd.raw = 0; - cmd.address = 0x1E; - cmd.data = 0; - linux_sdio_cmd52(&cmd); - cnt |= (cmd.data << 16); - - return cnt; -} - /******************************************** * * Sdio interfaces * ********************************************/ -int sdio_check_bs(void) -{ - sdio_cmd52_t cmd; - - /** - * poll until BS is 0 - **/ - cmd.read_write = 0; - cmd.function = 0; - cmd.raw = 0; - cmd.address = 0xc; - cmd.data = 0; - if (!linux_sdio_cmd52(&cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, get BS register...\n"); - goto _fail_; - } - - return 1; - -_fail_: - - return 0; -} - static int sdio_write_reg(u32 addr, u32 data) { #ifdef BIG_ENDIAN diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index 3741836dad41..9af35d1ef99e 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -108,163 +108,6 @@ static u8 crc7(u8 crc, const u8 *buffer, u32 len) #define DATA_PKT_SZ_8K (8 * 1024) #define DATA_PKT_SZ DATA_PKT_SZ_8K -static int spi_cmd(u8 cmd, u32 adr, u32 data, u32 sz, u8 clockless) -{ - u8 bc[9]; - int len = 5; - int result = N_OK; - - bc[0] = cmd; - switch (cmd) { - case CMD_SINGLE_READ: /* single word (4 bytes) read */ - bc[1] = (u8)(adr >> 16); - bc[2] = (u8)(adr >> 8); - bc[3] = (u8)adr; - len = 5; - break; - - case CMD_INTERNAL_READ: /* internal register read */ - bc[1] = (u8)(adr >> 8); - if (clockless) - bc[1] |= BIT(7); - bc[2] = (u8)adr; - bc[3] = 0x00; - len = 5; - break; - - case CMD_TERMINATE: /* termination */ - bc[1] = 0x00; - bc[2] = 0x00; - bc[3] = 0x00; - len = 5; - break; - - case CMD_REPEAT: /* repeat */ - bc[1] = 0x00; - bc[2] = 0x00; - bc[3] = 0x00; - len = 5; - break; - - case CMD_RESET: /* reset */ - bc[1] = 0xff; - bc[2] = 0xff; - bc[3] = 0xff; - len = 5; - break; - - case CMD_DMA_WRITE: /* dma write */ - case CMD_DMA_READ: /* dma read */ - bc[1] = (u8)(adr >> 16); - bc[2] = (u8)(adr >> 8); - bc[3] = (u8)adr; - bc[4] = (u8)(sz >> 8); - bc[5] = (u8)(sz); - len = 7; - break; - - case CMD_DMA_EXT_WRITE: /* dma extended write */ - case CMD_DMA_EXT_READ: /* dma extended read */ - bc[1] = (u8)(adr >> 16); - bc[2] = (u8)(adr >> 8); - bc[3] = (u8)adr; - bc[4] = (u8)(sz >> 16); - bc[5] = (u8)(sz >> 8); - bc[6] = (u8)(sz); - len = 8; - break; - - case CMD_INTERNAL_WRITE: /* internal register write */ - bc[1] = (u8)(adr >> 8); - if (clockless) - bc[1] |= BIT(7); - bc[2] = (u8)(adr); - bc[3] = (u8)(data >> 24); - bc[4] = (u8)(data >> 16); - bc[5] = (u8)(data >> 8); - bc[6] = (u8)(data); - len = 8; - break; - - case CMD_SINGLE_WRITE: /* single word write */ - bc[1] = (u8)(adr >> 16); - bc[2] = (u8)(adr >> 8); - bc[3] = (u8)(adr); - bc[4] = (u8)(data >> 24); - bc[5] = (u8)(data >> 16); - bc[6] = (u8)(data >> 8); - bc[7] = (u8)(data); - len = 9; - break; - - default: - result = N_FAIL; - break; - } - - if (result) { - if (!g_spi.crc_off) - bc[len - 1] = (crc7(0x7f, (const u8 *)&bc[0], len - 1)) << 1; - else - len -= 1; - - if (!linux_spi_write(bc, len)) { - PRINT_ER("[wilc spi]: Failed cmd write, bus error...\n"); - result = N_FAIL; - } - } - - return result; -} - -static int spi_cmd_rsp(u8 cmd) -{ - u8 rsp; - int result = N_OK; - - /** - * Command/Control response - **/ - if ((cmd == CMD_RESET) || - (cmd == CMD_TERMINATE) || - (cmd == CMD_REPEAT)) { - if (!linux_spi_read(&rsp, 1)) { - result = N_FAIL; - goto _fail_; - } - } - - if (!linux_spi_read(&rsp, 1)) { - PRINT_ER("[wilc spi]: Failed cmd response read, bus error...\n"); - result = N_FAIL; - goto _fail_; - } - - if (rsp != cmd) { - PRINT_ER("[wilc spi]: Failed cmd response, cmd (%02x), resp (%02x)\n", cmd, rsp); - result = N_FAIL; - goto _fail_; - } - - /** - * State response - **/ - if (!linux_spi_read(&rsp, 1)) { - PRINT_ER("[wilc spi]: Failed cmd state read, bus error...\n"); - result = N_FAIL; - goto _fail_; - } - - if (rsp != 0x00) { - PRINT_ER("[wilc spi]: Failed cmd state response state (%02x)\n", rsp); - result = N_FAIL; - } - -_fail_: - - return result; -} - static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless) { u8 wb[32], rb[32]; @@ -604,74 +447,6 @@ _error_: return result; } -static int spi_data_read(u8 *b, u32 sz) -{ - int retry, ix, nbytes; - int result = N_OK; - u8 crc[2]; - u8 rsp; - - /** - * Data - **/ - ix = 0; - do { - if (sz <= DATA_PKT_SZ) - nbytes = sz; - else - nbytes = DATA_PKT_SZ; - - /** - * Data Respnose header - **/ - retry = 10; - do { - if (!linux_spi_read(&rsp, 1)) { - PRINT_ER("[wilc spi]: Failed data response read, bus error...\n"); - result = N_FAIL; - break; - } - if (((rsp >> 4) & 0xf) == 0xf) - break; - } while (retry--); - - if (result == N_FAIL) - break; - - if (retry <= 0) { - PRINT_ER("[wilc spi]: Failed data response read...(%02x)\n", rsp); - result = N_FAIL; - break; - } - - /** - * Read bytes - **/ - if (!linux_spi_read(&b[ix], nbytes)) { - PRINT_ER("[wilc spi]: Failed data block read, bus error...\n"); - result = N_FAIL; - break; - } - - /** - * Read Crc - **/ - if (!g_spi.crc_off) { - if (!linux_spi_read(crc, 2)) { - PRINT_ER("[wilc spi]: Failed data block crc read, bus error...\n"); - result = N_FAIL; - break; - } - } - - ix += nbytes; - sz -= nbytes; - - } while (sz); - - return result; -} - static int spi_data_write(u8 *b, u32 sz) { int ix, nbytes; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 6f405221030c..849f86b5ff30 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -470,42 +470,6 @@ static void CfgScanResult(enum scan_event enuScanEvent, tstrNetworkInfo *pstrNet } -/** - * @brief WILC_WFI_Set_PMKSA - * @details Check if pmksa is cached and set it. - * @param[in] - * @return int : Return 0 on Success - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -int WILC_WFI_Set_PMKSA(u8 *bssid, struct wilc_priv *priv) -{ - u32 i; - s32 s32Error = 0; - - - for (i = 0; i < priv->pmkid_list.numpmkid; i++) { - - if (!memcmp(bssid, priv->pmkid_list.pmkidlist[i].bssid, - ETH_ALEN)) { - PRINT_D(CFG80211_DBG, "PMKID successful comparison"); - - /*If bssid is found, set the values*/ - s32Error = host_int_set_pmkid_info(priv->hWILCWFIDrv, &priv->pmkid_list); - - if (s32Error != 0) - PRINT_ER("Error in pmkid\n"); - - break; - } - } - - return s32Error; - - -} - /** * @brief CfgConnectResult * @details diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 9d257b06c853..f702cca2095a 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -193,8 +193,6 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe) return 0; } -u32 total_acks = 0, dropped_acks = 0; - #ifdef TCP_ACK_FILTER struct ack_session_info; struct ack_session_info { @@ -249,7 +247,6 @@ static inline int update_tcp_session(u32 index, u32 ack) static inline int add_tcp_pending_ack(u32 ack, u32 session_index, struct txq_entry_t *txqe) { - total_acks++; if (pending_acks < MAX_PENDING_ACKS) { pending_acks_info[pending_base + pending_acks].ack_num = ack; pending_acks_info[pending_base + pending_acks].txqe = txqe; @@ -361,7 +358,6 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) tqe = pending_acks_info[i].txqe; if (tqe) { wilc_wlan_txq_remove(tqe); - dropped_acks++; tqe->status = 1; if (tqe->tx_complete_func) tqe->tx_complete_func(tqe->priv, From 1608c4034eee98e3f24ffa9100f96b893d5e5492 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 16 Nov 2015 15:04:53 +0100 Subject: [PATCH 534/843] staging/wilc1000: make symbols static if possible All symbols that are only referenced in the file that defines them can be declared 'static' to avoid namespace pollution, to produce better object code, and to make the source more readable. Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/Makefile | 3 +- drivers/staging/wilc1000/coreconfigurator.c | 4 +- drivers/staging/wilc1000/host_interface.c | 35 +++++++----- drivers/staging/wilc1000/host_interface.h | 8 --- drivers/staging/wilc1000/linux_mon.c | 6 +- drivers/staging/wilc1000/linux_wlan.c | 19 +++---- drivers/staging/wilc1000/linux_wlan_sdio.c | 4 +- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 56 +++++++++---------- .../staging/wilc1000/wilc_wfi_cfgoperations.h | 1 - drivers/staging/wilc1000/wilc_wlan.c | 23 +++++--- 10 files changed, 81 insertions(+), 78 deletions(-) diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile index 650123df0b4c..9696f69bda48 100644 --- a/drivers/staging/wilc1000/Makefile +++ b/drivers/staging/wilc1000/Makefile @@ -8,8 +8,7 @@ ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \ -DAP_FIRMWARE=\"atmel/wilc1000_ap_fw.bin\" \ -DP2P_CONCURRENCY_FIRMWARE=\"atmel/wilc1000_p2p_fw.bin\" -ccflags-y += -I$(src)/ -D__CHECK_ENDIAN__ -DWILC_ASIC_A0 \ - -Wno-unused-function -DWILC_DEBUGFS +ccflags-y += -I$(src)/ -D__CHECK_ENDIAN__ -DWILC_ASIC_A0 -DWILC_DEBUGFS #ccflags-y += -DTCP_ACK_FILTER ccflags-$(CONFIG_WILC1000_PREALLOCATE_AT_LOADING_DRIVER) += -DMEMORY_STATIC \ diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 56e0cf90fde6..d676d047f141 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -287,7 +287,7 @@ static inline u16 get_asoc_id(u8 *data) return asoc_id; } -u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset) +static u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset) { u16 u16index; @@ -315,7 +315,7 @@ u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset) /* This function gets the current channel information from * the 802.11n beacon/probe response frame */ -u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen) +static u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen) { u16 index; diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 6c205b97293d..93bdb224f973 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -234,7 +234,7 @@ struct join_bss_param { static struct host_if_drv *wfidrv_list[NUM_CONCURRENT_IFC + 1]; struct host_if_drv *terminated_handle; bool g_obtainingIP; -u8 P2P_LISTEN_STATE; +static u8 P2P_LISTEN_STATE; static struct task_struct *hif_thread_handler; static WILC_MsgQueueHandle hif_msg_q; static struct semaphore hif_sema_thread; @@ -259,10 +259,10 @@ static u8 del_beacon; static u32 clients_count; static u8 *join_req; -u8 *info_element; +static u8 *info_element; static u8 mode_11i; -u8 auth_type; -u32 join_req_size; +static u8 auth_type; +static u32 join_req_size; static u32 info_element_size; static struct host_if_drv *join_req_drv; #define REAL_JOIN_REQ 0 @@ -396,7 +396,9 @@ static s32 handle_set_operation_mode(struct host_if_drv *hif_drv, return result; } -s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 *ip_addr, u8 idx) +static s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx); + +static s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 *ip_addr, u8 idx) { s32 result = 0; struct wid wid; @@ -430,7 +432,7 @@ s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 *ip_addr, u8 idx) return result; } -s32 handle_get_ip_address(struct host_if_drv *hif_drv, u8 idx) +static s32 handle_get_ip_address(struct host_if_drv *hif_drv, u8 idx) { s32 result = 0; struct wid wid; @@ -817,6 +819,9 @@ static void Handle_wait_msg_q_empty(void) up(&hif_sema_wait_response); } +static s32 Handle_ScanDone(struct host_if_drv *hif_drv, + enum scan_event enuEvent); + static s32 Handle_Scan(struct host_if_drv *hif_drv, struct scan_attr *pstrHostIFscanAttr) { @@ -1483,6 +1488,11 @@ done: return result; } +static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, + u8 *pu8AssocRespInfo, + u32 u32MaxAssocRespInfoLen, + u32 *pu32RcvdAssocRespInfoLen); + static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, struct rcvd_async_info *pstrRcvdGnrlAsyncInfo) { @@ -2140,7 +2150,7 @@ static void Handle_GetLinkspeed(struct host_if_drv *hif_drv) up(&hif_drv->sem_get_link_speed); } -s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics) +static s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics) { struct wid strWIDList[5]; u32 u32WidsCount = 0, result = 0; @@ -3534,11 +3544,10 @@ s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode) return result; } - -s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, - u8 *pu8AssocRespInfo, - u32 u32MaxAssocRespInfoLen, - u32 *pu32RcvdAssocRespInfoLen) +static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, + u8 *pu8AssocRespInfo, + u32 u32MaxAssocRespInfoLen, + u32 *pu32RcvdAssocRespInfoLen) { s32 result = 0; struct wid wid; @@ -4706,7 +4715,7 @@ s32 host_int_setup_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx) return result; } -s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx) +static s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx) { s32 result = 0; struct host_if_msg msg; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index c1ed2e236ee2..312da75fc02e 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -338,10 +338,6 @@ s32 host_int_set_join_req(struct host_if_drv *hWFIDrv, u8 *pu8bssid, u8 u8channel, void *pJoinParams); s32 host_int_flush_join_req(struct host_if_drv *hWFIDrv); s32 host_int_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode); -s32 host_int_get_assoc_res_info(struct host_if_drv *hWFIDrv, - u8 *pu8AssocRespInfo, - u32 u32MaxAssocRespInfoLen, - u32 *pu32RcvdAssocRespInfoLen); int host_int_set_mac_chnl_num(struct host_if_drv *wfi_drv, u8 channel); s32 host_int_get_rssi(struct host_if_drv *hWFIDrv, s8 *ps8Rssi); s32 host_int_scan(struct host_if_drv *hWFIDrv, u8 u8ScanSource, @@ -379,7 +375,6 @@ s32 host_int_setup_ipaddress(struct host_if_drv *hWFIDrv, s32 host_int_del_All_Rx_BASession(struct host_if_drv *hWFIDrv, char *pBSSID, char TID); -s32 host_int_get_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx); s32 host_int_remain_on_channel(struct host_if_drv *hWFIDrv, u32 u32SessionID, u32 u32duration, @@ -394,9 +389,6 @@ s32 host_int_frame_register(struct host_if_drv *hWFIDrv, int host_int_set_wfi_drv_handler(struct host_if_drv *address); int host_int_set_operation_mode(struct host_if_drv *wfi_drv, u32 mode); -static s32 Handle_ScanDone(struct host_if_drv *drvHandler, - enum scan_event enuEvent); - void host_int_freeJoinParams(void *pJoinParams); s32 host_int_get_statistics(struct host_if_drv *hWFIDrv, diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c index 589a11fd977c..2d518acb4af3 100644 --- a/drivers/staging/wilc1000/linux_mon.c +++ b/drivers/staging/wilc1000/linux_mon.c @@ -29,9 +29,9 @@ static struct net_device *wilc_wfi_mon; /* global monitor netdev */ extern int mac_xmit(struct sk_buff *skb, struct net_device *dev); -u8 srcAdd[6]; -u8 bssid[6]; -u8 broadcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; +static u8 srcAdd[6]; +static u8 bssid[6]; +static u8 broadcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; /** * @brief WILC_WFI_monitor_rx * @details diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 086f1dbfb157..b95dba74a37d 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -225,9 +225,8 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data) } return IRQ_WAKE_THREAD; } -#endif -irqreturn_t isr_bh_routine(int irq, void *userdata) +static irqreturn_t isr_bh_routine(int irq, void *userdata) { perInterface_wlan_t *nic; struct wilc *wilc; @@ -246,7 +245,6 @@ irqreturn_t isr_bh_routine(int irq, void *userdata) return IRQ_HANDLED; } -#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO) static int init_irq(struct net_device *dev) { int ret = 0; @@ -333,7 +331,7 @@ void linux_wlan_mac_indicate(struct wilc *wilc, int flag) } } -struct net_device *get_if_handler(struct wilc *wilc, u8 *mac_header) +static struct net_device *get_if_handler(struct wilc *wilc, u8 *mac_header) { u8 *bssid, *bssid1; int i = 0; @@ -839,7 +837,7 @@ void wilc1000_wlan_deinit(struct net_device *dev) } } -int wlan_init_locks(struct net_device *dev) +static int wlan_init_locks(struct net_device *dev) { perInterface_wlan_t *nic; struct wilc *wl; @@ -884,7 +882,7 @@ static int wlan_deinit_locks(struct net_device *dev) return 0; } -void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic) +static void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic) { PRINT_D(INIT_DBG, "Linux to Wlan services ...\n"); @@ -895,7 +893,7 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic) #endif } -int wlan_initialize_threads(struct net_device *dev) +static int wlan_initialize_threads(struct net_device *dev) { perInterface_wlan_t *nic; struct wilc *wilc; @@ -921,7 +919,6 @@ static void wlan_deinitialize_threads(struct net_device *dev) { perInterface_wlan_t *nic; struct wilc *wl; - nic = netdev_priv(dev); wl = nic->wilc; @@ -1049,7 +1046,7 @@ _fail_locks_: return ret; } -int mac_init_fn(struct net_device *ndev) +static int mac_init_fn(struct net_device *ndev) { netif_start_queue(ndev); netif_stop_queue(ndev); @@ -1131,7 +1128,7 @@ int mac_open(struct net_device *ndev) return 0; } -struct net_device_stats *mac_stats(struct net_device *dev) +static struct net_device_stats *mac_stats(struct net_device *dev) { perInterface_wlan_t *nic = netdev_priv(dev); @@ -1325,7 +1322,7 @@ int mac_close(struct net_device *ndev) return 0; } -int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) +static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) { u8 *buff = NULL; s8 rssi; diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index 9e8ba04ca9c8..a0640ebe904e 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -39,18 +39,18 @@ static const struct sdio_device_id wilc_sdio_ids[] = { }; +#ifndef WILC_SDIO_IRQ_GPIO static void wilc_sdio_interrupt(struct sdio_func *func) { struct wilc_sdio *wl_sdio; wl_sdio = sdio_get_drvdata(func); -#ifndef WILC_SDIO_IRQ_GPIO sdio_release_host(func); wilc_handle_isr(wl_sdio->wilc); sdio_claim_host(func); -#endif } +#endif int linux_sdio_cmd52(sdio_cmd52_t *cmd) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 849f86b5ff30..842f0e4bec97 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -24,10 +24,10 @@ extern int mac_open(struct net_device *ndev); extern int mac_close(struct net_device *ndev); -tstrNetworkInfo astrLastScannedNtwrksShadow[MAX_NUM_SCANNED_NETWORKS_SHADOW]; -u32 u32LastScannedNtwrksCountShadow; +static tstrNetworkInfo astrLastScannedNtwrksShadow[MAX_NUM_SCANNED_NETWORKS_SHADOW]; +static u32 u32LastScannedNtwrksCountShadow; struct timer_list hDuringIpTimer; -struct timer_list hAgingTimer; +static struct timer_list hAgingTimer; static u8 op_ifcs; extern u8 u8ConnectedSSID[6]; @@ -90,15 +90,15 @@ struct p2p_mgmt_data { }; /*Global variable used to state the current connected STA channel*/ -u8 u8WLANChannel = INVALID_CHANNEL; +static u8 u8WLANChannel = INVALID_CHANNEL; -u8 curr_channel; +static u8 curr_channel; -u8 u8P2P_oui[] = {0x50, 0x6f, 0x9A, 0x09}; -u8 u8P2Plocalrandom = 0x01; -u8 u8P2Precvrandom = 0x00; -u8 u8P2P_vendorspec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03}; -bool bWilc_ie; +static u8 u8P2P_oui[] = {0x50, 0x6f, 0x9A, 0x09}; +static u8 u8P2Plocalrandom = 0x01; +static u8 u8P2Precvrandom = 0x00; +static u8 u8P2P_vendorspec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03}; +static bool bWilc_ie; static struct ieee80211_supported_band WILC_WFI_band_2ghz = { .channels = WILC_WFI_2ghz_channels, @@ -113,19 +113,19 @@ struct add_key_params { bool pairwise; u8 *mac_addr; }; -struct add_key_params g_add_gtk_key_params; -struct wilc_wfi_key g_key_gtk_params; -struct add_key_params g_add_ptk_key_params; -struct wilc_wfi_key g_key_ptk_params; -struct wilc_wfi_wep_key g_key_wep_params; -bool g_ptk_keys_saved; -bool g_gtk_keys_saved; -bool g_wep_keys_saved; +static struct add_key_params g_add_gtk_key_params; +static struct wilc_wfi_key g_key_gtk_params; +static struct add_key_params g_add_ptk_key_params; +static struct wilc_wfi_key g_key_ptk_params; +static struct wilc_wfi_wep_key g_key_wep_params; +static bool g_ptk_keys_saved; +static bool g_gtk_keys_saved; +static bool g_wep_keys_saved; #define AGING_TIME (9 * 1000) #define duringIP_TIME 15000 -void clear_shadow_scan(void *pUserVoid) +static void clear_shadow_scan(void *pUserVoid) { int i; @@ -147,7 +147,7 @@ void clear_shadow_scan(void *pUserVoid) } -u32 get_rssi_avg(tstrNetworkInfo *pstrNetworkInfo) +static u32 get_rssi_avg(tstrNetworkInfo *pstrNetworkInfo) { u8 i; int rssi_v = 0; @@ -160,7 +160,7 @@ u32 get_rssi_avg(tstrNetworkInfo *pstrNetworkInfo) return rssi_v; } -void refresh_scan(void *pUserVoid, u8 all, bool bDirectScan) +static void refresh_scan(void *pUserVoid, u8 all, bool bDirectScan) { struct wilc_priv *priv; struct wiphy *wiphy; @@ -200,7 +200,7 @@ void refresh_scan(void *pUserVoid, u8 all, bool bDirectScan) } -void reset_shadow_found(void *pUserVoid) +static void reset_shadow_found(void *pUserVoid) { int i; @@ -210,7 +210,7 @@ void reset_shadow_found(void *pUserVoid) } } -void update_scan_time(void *pUserVoid) +static void update_scan_time(void *pUserVoid) { int i; @@ -256,7 +256,7 @@ static void clear_duringIP(unsigned long arg) g_obtainingIP = false; } -int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid) +static int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid) { int state = -1; int i; @@ -279,7 +279,7 @@ int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid) return state; } -void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, void *pJoinParams) +static void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, void *pJoinParams) { int ap_found = is_network_in_shadow(pstrNetworkInfo, pUserVoid); u32 ap_index = 0; @@ -1766,7 +1766,7 @@ static int flush_pmksa(struct wiphy *wiphy, struct net_device *netdev) * @version */ -void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len) +static void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len) { u32 index = 0; u32 i = 0, j = 0; @@ -1818,7 +1818,7 @@ void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len) * @date 12 DEC 2012 * @version */ -void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftype) +static void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftype) { u32 index = 0; u32 i = 0, j = 0; @@ -3285,7 +3285,7 @@ int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed) * @date 01 MAR 2012 * @version 1.0 */ -struct wireless_dev *WILC_WFI_CfgAlloc(void) +static struct wireless_dev *WILC_WFI_CfgAlloc(void) { struct wireless_dev *wdev; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h index d7bdca1f4c5b..9f9a9aeb3655 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h @@ -90,7 +90,6 @@ static const struct ieee80211_txrx_stypes #define WILC_WFI_DWELL_PASSIVE 100 #define WILC_WFI_DWELL_ACTIVE 40 -struct wireless_dev *WILC_WFI_CfgAlloc(void); struct wireless_dev *wilc_create_wiphy(struct net_device *net); void wilc_free_wiphy(struct net_device *net); int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed); diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index f702cca2095a..5c8c59257f58 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -40,7 +40,9 @@ typedef struct { static wilc_wlan_dev_t g_wlan; +#ifdef WILC_OPTIMIZE_SLEEP_INT static inline void chip_allow_sleep(void); +#endif static inline void chip_wakeup(void); static u32 dbgflag = N_INIT | N_ERR | N_INTR | N_TXQ | N_RXQ; @@ -81,6 +83,7 @@ static inline void release_bus(BUS_RELEASE_T release) mutex_unlock(&g_linux_wlan->hif_cs); } +#ifdef TCP_ACK_FILTER static void wilc_wlan_txq_remove(struct txq_entry_t *tqe) { wilc_wlan_dev_t *p = &g_wlan; @@ -99,6 +102,7 @@ static void wilc_wlan_txq_remove(struct txq_entry_t *tqe) } p->txq_entries -= 1; } +#endif static struct txq_entry_t * wilc_wlan_txq_remove_from_head(struct net_device *dev) @@ -209,16 +213,17 @@ struct pending_acks_info { struct txq_entry_t *txqe; }; + #define NOT_TCP_ACK (-1) #define MAX_TCP_SESSION 25 #define MAX_PENDING_ACKS 256 -struct ack_session_info ack_session_info[2 * MAX_TCP_SESSION]; -struct pending_acks_info pending_acks_info[MAX_PENDING_ACKS]; +static struct ack_session_info ack_session_info[2 * MAX_TCP_SESSION]; +static struct pending_acks_info pending_acks_info[MAX_PENDING_ACKS]; -u32 pending_base; -u32 tcp_session; -u32 pending_acks; +static u32 pending_base; +static u32 tcp_session; +static u32 pending_acks; static inline int init_tcp_tracking(void) { @@ -386,17 +391,19 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) } #endif -bool enabled = false; +static bool enabled = false; void enable_tcp_ack_filter(bool value) { enabled = value; } -bool is_tcp_ack_filter_enabled(void) +#ifdef TCP_ACK_FILTER +static bool is_tcp_ack_filter_enabled(void) { return enabled; } +#endif static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 buffer_size) { @@ -1582,7 +1589,7 @@ void wilc_bus_set_default_speed(void) g_wlan.hif_func.hif_set_default_bus_speed(); } -u32 init_chip(struct net_device *dev) +static u32 init_chip(struct net_device *dev) { u32 chipid; u32 reg, ret = 0; From 0e1af73ddeb9747fd1aa8b0c6040b8b3709ae9bb Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 16 Nov 2015 15:04:54 +0100 Subject: [PATCH 535/843] staging/wilc1000: use proper naming for global symbols There are many global symbols in the wilc1000 driver, some of them with names like "DEBUG_LEVEL" or "probe" that are not acceptable for globals in the linux kernel as they may easily conflict with other (equally broken) drivers. This renames all the globals that do not already start with wilc or a variation of that to start with wilc_ and to follow the usual naming conventions. Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 10 +- drivers/staging/wilc1000/coreconfigurator.h | 16 +- drivers/staging/wilc1000/host_interface.c | 260 +++++++++--------- drivers/staging/wilc1000/host_interface.h | 82 +++--- drivers/staging/wilc1000/linux_mon.c | 4 +- drivers/staging/wilc1000/linux_wlan.c | 115 ++++---- drivers/staging/wilc1000/linux_wlan_common.h | 18 +- drivers/staging/wilc1000/linux_wlan_sdio.c | 50 ++-- drivers/staging/wilc1000/linux_wlan_sdio.h | 16 +- drivers/staging/wilc1000/linux_wlan_spi.c | 14 +- drivers/staging/wilc1000/linux_wlan_spi.h | 10 +- drivers/staging/wilc1000/wilc_debugfs.c | 18 +- drivers/staging/wilc1000/wilc_sdio.c | 62 ++--- drivers/staging/wilc1000/wilc_spi.c | 48 ++-- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 260 +++++++++--------- .../staging/wilc1000/wilc_wfi_cfgoperations.h | 2 +- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 8 +- drivers/staging/wilc1000/wilc_wlan.c | 42 +-- drivers/staging/wilc1000/wilc_wlan.h | 2 +- drivers/staging/wilc1000/wilc_wlan_cfg.c | 6 +- 20 files changed, 521 insertions(+), 522 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index d676d047f141..47fa82f26b53 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -344,7 +344,7 @@ static u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen) * @date 1 Mar 2012 * @version 1.0 */ -s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) +s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) { tstrNetworkInfo *pstrNetworkInfo = NULL; u8 u8MsgType = 0; @@ -466,7 +466,7 @@ s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) * @date 1 Mar 2012 * @version 1.0 */ -s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo) +s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo) { s32 s32Error = 0; @@ -499,7 +499,7 @@ s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo) * @date 2 Apr 2012 * @version 1.0 */ -s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, +s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen, tstrConnectRespInfo **ppstrConnectRespInfo) { s32 s32Error = 0; @@ -551,7 +551,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, * @date 2 Apr 2012 * @version 1.0 */ -s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo) +s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo) { s32 s32Error = 0; @@ -588,7 +588,7 @@ s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo) * @date 1 Mar 2012 * @version 1.0 */ -s32 send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv) +s32 wilc_send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv) { s32 counter = 0, ret = 0; diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h index 3253f6f1393a..912d5c2879e4 100644 --- a/drivers/staging/wilc1000/coreconfigurator.h +++ b/drivers/staging/wilc1000/coreconfigurator.h @@ -127,16 +127,16 @@ typedef struct { size_t ie_len; } tstrDisconnectNotifInfo; -s32 send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv); -s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo); -s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo); +s32 wilc_send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv); +s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo); +s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo); -s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, +s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen, tstrConnectRespInfo **ppstrConnectRespInfo); -s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo); +s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo); -void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length); -void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length); -void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length); +void wilc_network_info_received(u8 *pu8Buffer, u32 u32Length); +void wilc_gnrl_async_info_received(u8 *pu8Buffer, u32 u32Length); +void wilc_scan_complete_received(u8 *pu8Buffer, u32 u32Length); #endif diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 93bdb224f973..228a2fefe714 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -9,11 +9,11 @@ #include #include "wilc_wfi_netdevice.h" -extern u8 connecting; +extern u8 wilc_connecting; -extern struct timer_list hDuringIpTimer; +extern struct timer_list wilc_during_ip_timer; -extern u8 g_wilc_initialized; +extern u8 wilc_initialized; #define HOST_IF_MSG_SCAN 0 #define HOST_IF_MSG_CONNECT 1 @@ -233,7 +233,7 @@ struct join_bss_param { static struct host_if_drv *wfidrv_list[NUM_CONCURRENT_IFC + 1]; struct host_if_drv *terminated_handle; -bool g_obtainingIP; +bool wilc_optaining_ip; static u8 P2P_LISTEN_STATE; static struct task_struct *hif_thread_handler; static WILC_MsgQueueHandle hif_msg_q; @@ -243,7 +243,7 @@ static struct semaphore hif_sema_wait_response; static struct semaphore hif_sema_deinit; static struct timer_list periodic_rssi; -u8 multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; +u8 wilc_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; static u8 rcv_assoc_resp[MAX_ASSOC_RESP_FRAME_SIZE]; @@ -271,7 +271,7 @@ static struct host_if_drv *join_req_drv; static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo); -extern int linux_wlan_get_num_conn_ifcs(void); +extern int wilc_wlan_get_num_conn_ifcs(void); static int add_handler_in_list(struct host_if_drv *handler) { @@ -336,7 +336,7 @@ static s32 handle_set_channel(struct host_if_drv *hif_drv, PRINT_D(HOSTINF_DBG, "Setting channel\n"); - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { @@ -358,7 +358,7 @@ static s32 handle_set_wfi_drv_handler(struct host_if_drv *hif_drv, wid.val = (s8 *)&hif_drv_handler->handler; wid.size = sizeof(u32); - result = send_config_pkt(SET_CFG, &wid, 1, hif_drv_handler->handler); + result = wilc_send_config_pkt(SET_CFG, &wid, 1, hif_drv_handler->handler); if (!hif_drv) up(&hif_sema_driver); @@ -382,7 +382,7 @@ static s32 handle_set_operation_mode(struct host_if_drv *hif_drv, wid.val = (s8 *)&hif_op_mode->mode; wid.size = sizeof(u32); - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if ((hif_op_mode->mode) == IDLE_MODE) @@ -417,7 +417,7 @@ static s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 *ip_addr, u8 id wid.val = (u8 *)ip_addr; wid.size = IP_ALEN; - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); host_int_get_ipaddress(hif_drv, firmware_ip_addr, idx); @@ -442,7 +442,7 @@ static s32 handle_get_ip_address(struct host_if_drv *hif_drv, u8 idx) wid.val = kmalloc(IP_ALEN, GFP_KERNEL); wid.size = IP_ALEN; - result = send_config_pkt(GET_CFG, &wid, 1, + result = wilc_send_config_pkt(GET_CFG, &wid, 1, get_id_from_handler(hif_drv)); PRINT_INFO(HOSTINF_DBG, "%pI4\n", wid.val); @@ -452,7 +452,7 @@ static s32 handle_get_ip_address(struct host_if_drv *hif_drv, u8 idx) kfree(wid.val); if (memcmp(get_ip[idx], set_ip[idx], IP_ALEN) != 0) - host_int_setup_ipaddress(hif_drv, set_ip[idx], idx); + wilc_setup_ipaddress(hif_drv, set_ip[idx], idx); if (result != 0) { PRINT_ER("Failed to get IP address\n"); @@ -485,7 +485,7 @@ static s32 handle_set_mac_address(struct host_if_drv *hif_drv, wid.size = ETH_ALEN; PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", wid.val); - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { PRINT_ER("Failed to set mac address\n"); @@ -507,7 +507,7 @@ static s32 handle_get_mac_address(struct host_if_drv *hif_drv, wid.val = get_mac_addr->mac_addr; wid.size = ETH_ALEN; - result = send_config_pkt(GET_CFG, &wid, 1, + result = wilc_send_config_pkt(GET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { @@ -802,7 +802,7 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, wid_cnt++; } - result = send_config_pkt(SET_CFG, wid_list, wid_cnt, + result = wilc_send_config_pkt(SET_CFG, wid_list, wid_cnt, get_id_from_handler(hif_drv)); if (result) @@ -815,7 +815,7 @@ ERRORHANDLER: static void Handle_wait_msg_q_empty(void) { - g_wilc_initialized = 0; + wilc_initialized = 0; up(&hif_sema_wait_response); } @@ -848,7 +848,7 @@ static s32 Handle_Scan(struct host_if_drv *hif_drv, goto ERRORHANDLER; } - if (g_obtainingIP || connecting) { + if (wilc_optaining_ip || wilc_connecting) { PRINT_D(GENERIC_DBG, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n"); PRINT_ER("Don't do obss scan\n"); result = -EBUSY; @@ -925,7 +925,7 @@ static s32 Handle_Scan(struct host_if_drv *hif_drv, else if (hif_drv->hif_state == HOST_IF_IDLE) scan_while_connected = false; - result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, + result = wilc_send_config_pkt(SET_CFG, strWIDList, u32WidsCount, get_id_from_handler(hif_drv)); if (result) @@ -969,7 +969,7 @@ static s32 Handle_ScanDone(struct host_if_drv *hif_drv, wid.val = (s8 *)&u8abort_running_scan; wid.size = sizeof(char); - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { @@ -992,7 +992,7 @@ static s32 Handle_ScanDone(struct host_if_drv *hif_drv, return result; } -u8 u8ConnectedSSID[6] = {0}; +u8 wilc_connected_SSID[6] = {0}; static s32 Handle_Connect(struct host_if_drv *hif_drv, struct connect_attr *pstrHostIFconnectAttr) { @@ -1004,7 +1004,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv, PRINT_D(GENERIC_DBG, "Handling connect request\n"); - if (memcmp(pstrHostIFconnectAttr->bssid, u8ConnectedSSID, ETH_ALEN) == 0) { + if (memcmp(pstrHostIFconnectAttr->bssid, wilc_connected_SSID, ETH_ALEN) == 0) { result = 0; PRINT_ER("Trying to connect to an already connected AP, Discard connect request\n"); return result; @@ -1217,13 +1217,13 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv, PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n"); if (pstrHostIFconnectAttr->bssid) { - memcpy(u8ConnectedSSID, pstrHostIFconnectAttr->bssid, ETH_ALEN); + memcpy(wilc_connected_SSID, pstrHostIFconnectAttr->bssid, ETH_ALEN); PRINT_D(GENERIC_DBG, "save Bssid = %pM\n", pstrHostIFconnectAttr->bssid); - PRINT_D(GENERIC_DBG, "save bssid = %pM\n", u8ConnectedSSID); + PRINT_D(GENERIC_DBG, "save bssid = %pM\n", wilc_connected_SSID); } - result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, + result = wilc_send_config_pkt(SET_CFG, strWIDList, u32WidsCount, get_id_from_handler(hif_drv)); if (result) { PRINT_ER("failed to send config packet\n"); @@ -1240,7 +1240,7 @@ ERRORHANDLER: del_timer(&hif_drv->connect_timer); - PRINT_D(HOSTINF_DBG, "could not start connecting to the required network\n"); + PRINT_D(HOSTINF_DBG, "could not start wilc_connecting to the required network\n"); memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); @@ -1320,7 +1320,7 @@ static s32 Handle_FlushConnect(struct host_if_drv *hif_drv) u32WidsCount++; - result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, + result = wilc_send_config_pkt(SET_CFG, strWIDList, u32WidsCount, get_id_from_handler(join_req_drv)); if (result) { PRINT_ER("failed to send config packet\n"); @@ -1381,7 +1381,7 @@ static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv) PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) PRINT_ER("Failed to send dissconect config packet\n"); @@ -1392,7 +1392,7 @@ static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv) hif_drv->usr_conn_req.ies_len = 0; kfree(hif_drv->usr_conn_req.ies); - eth_zero_addr(u8ConnectedSSID); + eth_zero_addr(wilc_connected_SSID); if (join_req && join_req_drv == hif_drv) { kfree(join_req); @@ -1421,7 +1421,7 @@ static s32 Handle_RcvdNtwrkInfo(struct host_if_drv *hif_drv, if (hif_drv->usr_scan_req.scan_result) { PRINT_D(HOSTINF_DBG, "State: Scanning, parsing network information received\n"); - parse_network_info(pstrRcvdNetworkInfo->buffer, &pstrNetworkInfo); + wilc_parse_network_info(pstrRcvdNetworkInfo->buffer, &pstrNetworkInfo); if ((!pstrNetworkInfo) || (!hif_drv->usr_scan_req.scan_result)) { PRINT_ER("driver is null\n"); @@ -1481,7 +1481,7 @@ done: pstrRcvdNetworkInfo->buffer = NULL; if (pstrNetworkInfo) { - DeallocateNetworkInfo(pstrNetworkInfo); + wilc_dealloc_network_info(pstrNetworkInfo); pstrNetworkInfo = NULL; } @@ -1560,10 +1560,10 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, if (u32RcvdAssocRespInfoLen != 0) { PRINT_D(HOSTINF_DBG, "Parsing association response\n"); - s32Err = ParseAssocRespInfo(rcv_assoc_resp, u32RcvdAssocRespInfoLen, + s32Err = wilc_parse_assoc_resp_info(rcv_assoc_resp, u32RcvdAssocRespInfoLen, &pstrConnectRespInfo); if (s32Err) { - PRINT_ER("ParseAssocRespInfo() returned error %d\n", s32Err); + PRINT_ER("wilc_parse_assoc_resp_info() returned error %d\n", s32Err); } else { strConnectInfo.u16ConnectStatus = pstrConnectRespInfo->u16ConnectStatus; @@ -1578,7 +1578,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, } if (pstrConnectRespInfo) { - DeallocateAssocRespInfo(pstrConnectRespInfo); + wilc_dealloc_assoc_resp_info(pstrConnectRespInfo); pstrConnectRespInfo = NULL; } } @@ -1588,11 +1588,11 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, if ((u8MacStatus == MAC_CONNECTED) && (strConnectInfo.u16ConnectStatus != SUCCESSFUL_STATUSCODE)) { PRINT_ER("Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n"); - eth_zero_addr(u8ConnectedSSID); + eth_zero_addr(wilc_connected_SSID); } else if (u8MacStatus == MAC_DISCONNECTED) { PRINT_ER("Received MAC status is MAC_DISCONNECTED\n"); - eth_zero_addr(u8ConnectedSSID); + eth_zero_addr(wilc_connected_SSID); } if (hif_drv->usr_conn_req.pu8bssid) { @@ -1623,14 +1623,14 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, if ((u8MacStatus == MAC_CONNECTED) && (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { - host_int_set_power_mgmt(hif_drv, 0, 0); + wilc_set_power_mgmt(hif_drv, 0, 0); PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n"); hif_drv->hif_state = HOST_IF_CONNECTED; PRINT_D(GENERIC_DBG, "Obtaining an IP, Disable Scan\n"); - g_obtainingIP = true; - mod_timer(&hDuringIpTimer, + wilc_optaining_ip = true; + mod_timer(&wilc_during_ip_timer, jiffies + msecs_to_jiffies(10000)); } else { PRINT_D(HOSTINF_DBG, "MAC status : %d and Connect Status : %d\n", u8MacStatus, strConnectInfo.u16ConnectStatus); @@ -1665,8 +1665,8 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, strDisconnectNotifInfo.ie_len = 0; if (hif_drv->usr_conn_req.conn_result) { - g_obtainingIP = false; - host_int_set_power_mgmt(hif_drv, 0, 0); + wilc_optaining_ip = false; + wilc_set_power_mgmt(hif_drv, 0, 0); hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, @@ -1764,7 +1764,7 @@ static int Handle_Key(struct host_if_drv *hif_drv, strWIDList[3].size = pstrHostIFkeyAttr->attr.wep.key_len; strWIDList[3].val = (s8 *)pu8keybuf; - result = send_config_pkt(SET_CFG, strWIDList, 4, + result = wilc_send_config_pkt(SET_CFG, strWIDList, 4, get_id_from_handler(hif_drv)); kfree(pu8keybuf); } @@ -1787,7 +1787,7 @@ static int Handle_Key(struct host_if_drv *hif_drv, wid.val = (s8 *)pu8keybuf; wid.size = pstrHostIFkeyAttr->attr.wep.key_len + 2; - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); kfree(pu8keybuf); } else if (pstrHostIFkeyAttr->action & REMOVEKEY) { @@ -1799,7 +1799,7 @@ static int Handle_Key(struct host_if_drv *hif_drv, wid.val = s8idxarray; wid.size = 1; - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); } else { wid.id = (u16)WID_KEY_ID; @@ -1809,7 +1809,7 @@ static int Handle_Key(struct host_if_drv *hif_drv, PRINT_D(HOSTINF_DBG, "Setting default key index\n"); - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); } up(&hif_drv->sem_test_key_block); @@ -1842,7 +1842,7 @@ static int Handle_Key(struct host_if_drv *hif_drv, strWIDList[1].val = (s8 *)pu8keybuf; strWIDList[1].size = RX_MIC_KEY_MSG_LEN; - result = send_config_pkt(SET_CFG, strWIDList, 2, + result = wilc_send_config_pkt(SET_CFG, strWIDList, 2, get_id_from_handler(hif_drv)); kfree(pu8keybuf); @@ -1875,7 +1875,7 @@ static int Handle_Key(struct host_if_drv *hif_drv, wid.val = (s8 *)pu8keybuf; wid.size = RX_MIC_KEY_MSG_LEN; - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); kfree(pu8keybuf); @@ -1914,7 +1914,7 @@ _WPARxGtk_end_case_: strWIDList[1].val = (s8 *)pu8keybuf; strWIDList[1].size = PTK_KEY_MSG_LEN + 1; - result = send_config_pkt(SET_CFG, strWIDList, 2, + result = wilc_send_config_pkt(SET_CFG, strWIDList, 2, get_id_from_handler(hif_drv)); kfree(pu8keybuf); up(&hif_drv->sem_test_key_block); @@ -1937,7 +1937,7 @@ _WPARxGtk_end_case_: wid.val = (s8 *)pu8keybuf; wid.size = PTK_KEY_MSG_LEN; - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); kfree(pu8keybuf); up(&hif_drv->sem_test_key_block); @@ -1972,7 +1972,7 @@ _WPAPtk_end_case_: wid.val = (s8 *)pu8keybuf; wid.size = (pstrHostIFkeyAttr->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1; - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); kfree(pu8keybuf); @@ -1999,12 +1999,12 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv) PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); - g_obtainingIP = false; - host_int_set_power_mgmt(hif_drv, 0, 0); + wilc_optaining_ip = false; + wilc_set_power_mgmt(hif_drv, 0, 0); - eth_zero_addr(u8ConnectedSSID); + eth_zero_addr(wilc_connected_SSID); - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { @@ -2068,14 +2068,14 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv) up(&hif_drv->sem_test_disconn_block); } -void resolve_disconnect_aberration(struct host_if_drv *hif_drv) +void wilc_resolve_disconnect_aberration(struct host_if_drv *hif_drv) { if (!hif_drv) return; if ((hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) || (hif_drv->hif_state == HOST_IF_CONNECTING)) { PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n"); - host_int_disconnect(hif_drv, 1); + wilc_disconnect(hif_drv, 1); } } @@ -2091,7 +2091,7 @@ static s32 Handle_GetChnl(struct host_if_drv *hif_drv) PRINT_D(HOSTINF_DBG, "Getting channel value\n"); - result = send_config_pkt(GET_CFG, &wid, 1, + result = wilc_send_config_pkt(GET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { @@ -2116,7 +2116,7 @@ static void Handle_GetRssi(struct host_if_drv *hif_drv) PRINT_D(HOSTINF_DBG, "Getting RSSI value\n"); - result = send_config_pkt(GET_CFG, &wid, 1, + result = wilc_send_config_pkt(GET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { PRINT_ER("Failed to get RSSI value\n"); @@ -2140,7 +2140,7 @@ static void Handle_GetLinkspeed(struct host_if_drv *hif_drv) PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n"); - result = send_config_pkt(GET_CFG, &wid, 1, + result = wilc_send_config_pkt(GET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { PRINT_ER("Failed to get LINKSPEED value\n"); @@ -2185,7 +2185,7 @@ static s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pst strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->tx_fail_cnt; u32WidsCount++; - result = send_config_pkt(GET_CFG, strWIDList, u32WidsCount, + result = wilc_send_config_pkt(GET_CFG, strWIDList, u32WidsCount, get_id_from_handler(hif_drv)); if (result) @@ -2212,7 +2212,7 @@ static s32 Handle_Get_InActiveTime(struct host_if_drv *hif_drv, PRINT_D(CFG80211_DBG, "SETING STA inactive time\n"); - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { @@ -2225,7 +2225,7 @@ static s32 Handle_Get_InActiveTime(struct host_if_drv *hif_drv, wid.val = (s8 *)&inactive_time; wid.size = sizeof(u32); - result = send_config_pkt(GET_CFG, &wid, 1, + result = wilc_send_config_pkt(GET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { @@ -2284,7 +2284,7 @@ static void Handle_AddBeacon(struct host_if_drv *hif_drv, memcpy(pu8CurrByte, pstrSetBeaconParam->tail, pstrSetBeaconParam->tail_len); pu8CurrByte += pstrSetBeaconParam->tail_len; - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) PRINT_ER("Failed to send add beacon config packet\n"); @@ -2313,7 +2313,7 @@ static void Handle_DelBeacon(struct host_if_drv *hif_drv) PRINT_D(HOSTINF_DBG, "Deleting BEACON\n"); - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) PRINT_ER("Failed to send delete beacon config packet\n"); @@ -2386,7 +2386,7 @@ static void Handle_AddStation(struct host_if_drv *hif_drv, pu8CurrByte = wid.val; pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result != 0) PRINT_ER("Failed to send add station config packet\n"); @@ -2428,7 +2428,7 @@ static void Handle_DelAllSta(struct host_if_drv *hif_drv, pu8CurrByte += ETH_ALEN; } - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) PRINT_ER("Failed to send add station config packet\n"); @@ -2460,7 +2460,7 @@ static void Handle_DelStation(struct host_if_drv *hif_drv, memcpy(pu8CurrByte, pstrDelStaParam->mac_addr, ETH_ALEN); - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) PRINT_ER("Failed to send add station config packet\n"); @@ -2488,7 +2488,7 @@ static void Handle_EditStation(struct host_if_drv *hif_drv, pu8CurrByte = wid.val; pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) PRINT_ER("Failed to send edit station config packet\n"); @@ -2527,7 +2527,7 @@ static int Handle_RemainOnChan(struct host_if_drv *hif_drv, goto ERRORHANDLER; } - if (g_obtainingIP || connecting) { + if (wilc_optaining_ip || wilc_connecting) { PRINT_D(GENERIC_DBG, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n"); result = -EBUSY; goto ERRORHANDLER; @@ -2549,7 +2549,7 @@ static int Handle_RemainOnChan(struct host_if_drv *hif_drv, wid.val[0] = u8remain_on_chan_flag; wid.val[1] = (s8)pstrHostIfRemainOnChan->ch; - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result != 0) PRINT_ER("Failed to set remain on channel\n"); @@ -2597,7 +2597,7 @@ static int Handle_RegisterFrame(struct host_if_drv *hif_drv, wid.size = sizeof(u16) + 2; - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { PRINT_ER("Failed to frame register config packet\n"); @@ -2629,7 +2629,7 @@ static u32 Handle_ListenStateExpired(struct host_if_drv *hif_drv, wid.val[0] = u8remain_on_chan_flag; wid.val[1] = FALSE_FRMWR_CHANNEL; - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result != 0) { PRINT_ER("Failed to set remain on channel\n"); @@ -2687,7 +2687,7 @@ static void Handle_PowerManagement(struct host_if_drv *hif_drv, PRINT_D(HOSTINF_DBG, "Handling Power Management\n"); - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) PRINT_ER("Failed to send power management config packet\n"); @@ -2721,10 +2721,10 @@ static void Handle_SetMulticastFilter(struct host_if_drv *hif_drv, *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 24) & 0xFF); if ((strHostIfSetMulti->cnt) > 0) - memcpy(pu8CurrByte, multicast_mac_addr_list, + memcpy(pu8CurrByte, wilc_multicast_mac_addr_list, ((strHostIfSetMulti->cnt) * ETH_ALEN)); - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) PRINT_ER("Failed to send setup multicast config packet\n"); @@ -2770,7 +2770,7 @@ static s32 Handle_AddBASession(struct host_if_drv *hif_drv, *ptr++ = 8; *ptr++ = 0; - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) PRINT_D(HOSTINF_DBG, "Couldn't open BA Session\n"); @@ -2789,7 +2789,7 @@ static s32 Handle_AddBASession(struct host_if_drv *hif_drv, *ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF); *ptr++ = ((strHostIfBASessionInfo->time_out >> 16) & 0xFF); *ptr++ = 3; - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); kfree(wid.val); @@ -2824,7 +2824,7 @@ static s32 Handle_DelAllRxBASessions(struct host_if_drv *hif_drv, *ptr++ = 0; *ptr++ = 32; - result = send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n"); @@ -2852,7 +2852,7 @@ static int hostIFthread(void *pvArg) break; } - if ((!g_wilc_initialized)) { + if ((!wilc_initialized)) { PRINT_D(GENERIC_DBG, "--WAIT--"); usleep_range(200 * 1000, 200 * 1000); wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -2912,8 +2912,8 @@ static int hostIFthread(void *pvArg) del_timer(&hif_drv->scan_timer); PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); - if (!linux_wlan_get_num_conn_ifcs()) - chip_sleep_manually(); + if (!wilc_wlan_get_num_conn_ifcs()) + wilc_chip_sleep_manually(); Handle_ScanDone(msg.drv, SCAN_EVENT_DONE); @@ -3073,7 +3073,7 @@ static void TimerCB_Connect(unsigned long arg) wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); } -s32 host_int_remove_key(struct host_if_drv *hif_drv, const u8 *pu8StaAddress) +s32 wilc_remove_key(struct host_if_drv *hif_drv, const u8 *pu8StaAddress) { struct wid wid; @@ -3085,7 +3085,7 @@ s32 host_int_remove_key(struct host_if_drv *hif_drv, const u8 *pu8StaAddress) return 0; } -int host_int_remove_wep_key(struct host_if_drv *hif_drv, u8 index) +int wilc_remove_wep_key(struct host_if_drv *hif_drv, u8 index) { int result = 0; struct host_if_msg msg; @@ -3112,7 +3112,7 @@ int host_int_remove_wep_key(struct host_if_drv *hif_drv, u8 index) return result; } -int host_int_set_wep_default_key(struct host_if_drv *hif_drv, u8 index) +int wilc_set_wep_default_keyid(struct host_if_drv *hif_drv, u8 index) { int result = 0; struct host_if_msg msg; @@ -3139,7 +3139,7 @@ int host_int_set_wep_default_key(struct host_if_drv *hif_drv, u8 index) return result; } -int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv, +int wilc_add_wep_key_bss_sta(struct host_if_drv *hif_drv, const u8 *key, u8 len, u8 index) @@ -3173,12 +3173,12 @@ int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv, return result; } -int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, - const u8 *key, - u8 len, - u8 index, - u8 mode, - enum AUTHTYPE auth_type) +int wilc_add_wep_key_bss_ap(struct host_if_drv *hif_drv, + const u8 *key, + u8 len, + u8 index, + u8 mode, + enum AUTHTYPE auth_type) { int result = 0; struct host_if_msg msg; @@ -3217,7 +3217,7 @@ int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, return result; } -s32 host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *pu8Ptk, +s32 wilc_add_ptk(struct host_if_drv *hif_drv, const u8 *pu8Ptk, u8 u8PtkKeylen, const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx) @@ -3282,7 +3282,7 @@ s32 host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *pu8Ptk, return result; } -s32 host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *pu8RxGtk, +s32 wilc_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *pu8RxGtk, u8 u8GtkKeylen, u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC, const u8 *pu8RxMic, const u8 *pu8TxMic, @@ -3344,7 +3344,7 @@ s32 host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *pu8RxGtk, return result; } -s32 host_int_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_attr *pu8PmkidInfoArray) +s32 wilc_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_attr *pu8PmkidInfoArray) { s32 result = 0; struct host_if_msg msg; @@ -3376,7 +3376,7 @@ s32 host_int_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_at return result; } -s32 hif_get_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress) +s32 wilc_get_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress) { s32 result = 0; struct host_if_msg msg; @@ -3397,7 +3397,7 @@ s32 hif_get_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress) return result; } -s32 host_int_set_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress) +s32 wilc_set_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress) { s32 result = 0; struct host_if_msg msg; @@ -3428,7 +3428,7 @@ s32 host_int_set_start_scan_req(struct host_if_drv *hif_drv, u8 scanSource) return 0; } -s32 host_int_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid, +s32 wilc_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid, const u8 *pu8ssid, size_t ssidLen, const u8 *pu8IEs, size_t IEsLen, wilc_connect_result pfConnectResult, void *pvUserArg, @@ -3495,7 +3495,7 @@ s32 host_int_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid, return result; } -s32 host_int_flush_join_req(struct host_if_drv *hif_drv) +s32 wilc_flush_join_req(struct host_if_drv *hif_drv) { s32 result = 0; struct host_if_msg msg; @@ -3520,7 +3520,7 @@ s32 host_int_flush_join_req(struct host_if_drv *hif_drv) return result; } -s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode) +s32 wilc_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode) { s32 result = 0; struct host_if_msg msg; @@ -3562,7 +3562,7 @@ static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, wid.val = pu8AssocRespInfo; wid.size = u32MaxAssocRespInfoLen; - result = send_config_pkt(GET_CFG, &wid, 1, + result = wilc_send_config_pkt(GET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { *pu32RcvdAssocRespInfoLen = 0; @@ -3575,7 +3575,7 @@ static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, return result; } -int host_int_set_mac_chnl_num(struct host_if_drv *hif_drv, u8 channel) +int wilc_set_mac_chnl_num(struct host_if_drv *hif_drv, u8 channel) { int result; struct host_if_msg msg; @@ -3599,7 +3599,7 @@ int host_int_set_mac_chnl_num(struct host_if_drv *hif_drv, u8 channel) return 0; } -int host_int_wait_msg_queue_idle(void) +int wilc_wait_msg_queue_idle(void) { int result = 0; struct host_if_msg msg; @@ -3617,7 +3617,7 @@ int host_int_wait_msg_queue_idle(void) return result; } -int host_int_set_wfi_drv_handler(struct host_if_drv *hif_drv) +int wilc_set_wfi_drv_handler(struct host_if_drv *hif_drv) { int result = 0; struct host_if_msg msg; @@ -3636,7 +3636,7 @@ int host_int_set_wfi_drv_handler(struct host_if_drv *hif_drv) return result; } -int host_int_set_operation_mode(struct host_if_drv *hif_drv, u32 mode) +int wilc_set_operation_mode(struct host_if_drv *hif_drv, u32 mode) { int result = 0; struct host_if_msg msg; @@ -3655,7 +3655,7 @@ int host_int_set_operation_mode(struct host_if_drv *hif_drv, u32 mode) return result; } -s32 host_int_get_inactive_time(struct host_if_drv *hif_drv, +s32 wilc_get_inactive_time(struct host_if_drv *hif_drv, const u8 *mac, u32 *pu32InactiveTime) { s32 result = 0; @@ -3683,7 +3683,7 @@ s32 host_int_get_inactive_time(struct host_if_drv *hif_drv, return result; } -s32 host_int_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi) +s32 wilc_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi) { s32 result = 0; struct host_if_msg msg; @@ -3710,7 +3710,7 @@ s32 host_int_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi) return result; } -s32 host_int_get_statistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics) +s32 wilc_get_statistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics) { s32 result = 0; struct host_if_msg msg; @@ -3730,7 +3730,7 @@ s32 host_int_get_statistics(struct host_if_drv *hif_drv, struct rf_info *pstrSta return result; } -s32 host_int_scan(struct host_if_drv *hif_drv, u8 u8ScanSource, +s32 wilc_scan(struct host_if_drv *hif_drv, u8 u8ScanSource, u8 u8ScanType, u8 *pu8ChnlFreqList, u8 u8ChnlListLen, const u8 *pu8IEs, size_t IEsLen, wilc_scan_result ScanResult, @@ -3783,7 +3783,7 @@ s32 host_int_scan(struct host_if_drv *hif_drv, u8 u8ScanSource, return result; } -s32 hif_set_cfg(struct host_if_drv *hif_drv, +s32 wilc_hif_set_cfg(struct host_if_drv *hif_drv, struct cfg_param_val *pstrCfgParamVal) { s32 result = 0; @@ -3832,7 +3832,7 @@ static void GetPeriodicRSSI(unsigned long arg) mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000)); } -s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) +s32 wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) { s32 result = 0; struct host_if_drv *hif_drv; @@ -3861,7 +3861,7 @@ s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) goto _fail_timer_2; } - g_obtainingIP = false; + wilc_optaining_ip = false; PRINT_D(HOSTINF_DBG, "Global handle pointer value=%p\n", hif_drv); if (clients_count == 0) { @@ -3940,7 +3940,7 @@ _fail_: return result; } -s32 host_int_deinit(struct host_if_drv *hif_drv) +s32 wilc_deinit(struct host_if_drv *hif_drv) { s32 result = 0; struct host_if_msg msg; @@ -3967,7 +3967,7 @@ s32 host_int_deinit(struct host_if_drv *hif_drv) del_timer_sync(&hif_drv->remain_on_ch_timer); - host_int_set_wfi_drv_handler(NULL); + wilc_set_wfi_drv_handler(NULL); down(&hif_sema_driver); if (hif_drv->usr_scan_req.scan_result) { @@ -4012,7 +4012,7 @@ s32 host_int_deinit(struct host_if_drv *hif_drv) return result; } -void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) +void wilc_network_info_received(u8 *pu8Buffer, u32 u32Length) { s32 result = 0; struct host_if_msg msg; @@ -4041,7 +4041,7 @@ void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) PRINT_ER("Error in sending network info message queue message parameters: Error(%d)\n", result); } -void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) +void wilc_gnrl_async_info_received(u8 *pu8Buffer, u32 u32Length) { s32 result = 0; struct host_if_msg msg; @@ -4082,7 +4082,7 @@ void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) up(&hif_sema_deinit); } -void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) +void wilc_scan_complete_received(u8 *pu8Buffer, u32 u32Length) { s32 result = 0; struct host_if_msg msg; @@ -4111,7 +4111,7 @@ void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) return; } -s32 host_int_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID, +s32 wilc_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID, u32 u32duration, u16 chan, wilc_remain_on_chan_expired RemainOnChanExpired, wilc_remain_on_chan_ready RemainOnChanReady, @@ -4143,7 +4143,7 @@ s32 host_int_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID, return result; } -s32 host_int_ListenStateExpired(struct host_if_drv *hif_drv, u32 u32SessionID) +s32 wilc_listen_state_expired(struct host_if_drv *hif_drv, u32 u32SessionID) { s32 result = 0; struct host_if_msg msg; @@ -4167,7 +4167,7 @@ s32 host_int_ListenStateExpired(struct host_if_drv *hif_drv, u32 u32SessionID) return result; } -s32 host_int_frame_register(struct host_if_drv *hif_drv, u16 u16FrameType, bool bReg) +s32 wilc_frame_register(struct host_if_drv *hif_drv, u16 u16FrameType, bool bReg) { s32 result = 0; struct host_if_msg msg; @@ -4206,7 +4206,7 @@ s32 host_int_frame_register(struct host_if_drv *hif_drv, u16 u16FrameType, bool return result; } -s32 host_int_add_beacon(struct host_if_drv *hif_drv, u32 u32Interval, +s32 wilc_add_beacon(struct host_if_drv *hif_drv, u32 u32Interval, u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head, u32 u32TailLen, u8 *pu8Tail) { @@ -4260,7 +4260,7 @@ ERRORHANDLER: return result; } -int host_int_del_beacon(struct host_if_drv *hif_drv) +int wilc_del_beacon(struct host_if_drv *hif_drv) { int result = 0; struct host_if_msg msg; @@ -4281,8 +4281,8 @@ int host_int_del_beacon(struct host_if_drv *hif_drv) return result; } -int host_int_add_station(struct host_if_drv *hif_drv, - struct add_sta_param *sta_param) +int wilc_add_station(struct host_if_drv *hif_drv, + struct add_sta_param *sta_param) { int result = 0; struct host_if_msg msg; @@ -4315,7 +4315,7 @@ int host_int_add_station(struct host_if_drv *hif_drv, return result; } -int host_int_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr) +int wilc_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr) { int result = 0; struct host_if_msg msg; @@ -4344,7 +4344,7 @@ int host_int_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr) return result; } -s32 host_int_del_allstation(struct host_if_drv *hif_drv, +s32 wilc_del_allstation(struct host_if_drv *hif_drv, u8 pu8MacAddr[][ETH_ALEN]) { s32 result = 0; @@ -4395,7 +4395,7 @@ s32 host_int_del_allstation(struct host_if_drv *hif_drv, return result; } -s32 host_int_edit_station(struct host_if_drv *hif_drv, +s32 wilc_edit_station(struct host_if_drv *hif_drv, struct add_sta_param *pstrStaParams) { s32 result = 0; @@ -4433,7 +4433,7 @@ s32 host_int_edit_station(struct host_if_drv *hif_drv, return result; } -s32 host_int_set_power_mgmt(struct host_if_drv *hif_drv, +s32 wilc_set_power_mgmt(struct host_if_drv *hif_drv, bool bIsEnabled, u32 u32Timeout) { @@ -4464,7 +4464,7 @@ s32 host_int_set_power_mgmt(struct host_if_drv *hif_drv, return result; } -s32 host_int_setup_multicast_filter(struct host_if_drv *hif_drv, +s32 wilc_setup_multicast_filter(struct host_if_drv *hif_drv, bool bIsEnabled, u32 u32count) { @@ -4650,7 +4650,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) return (void *)pNewJoinBssParam; } -void host_int_freeJoinParams(void *pJoinParams) +void wilc_free_join_params(void *pJoinParams) { if ((struct bss_param *)pJoinParams) kfree((struct bss_param *)pJoinParams); @@ -4658,7 +4658,7 @@ void host_int_freeJoinParams(void *pJoinParams) PRINT_ER("Unable to FREE null pointer\n"); } -s32 host_int_del_All_Rx_BASession(struct host_if_drv *hif_drv, +s32 wilc_del_all_rx_ba_session(struct host_if_drv *hif_drv, char *pBSSID, char TID) { @@ -4688,7 +4688,7 @@ s32 host_int_del_All_Rx_BASession(struct host_if_drv *hif_drv, return result; } -s32 host_int_setup_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx) +s32 wilc_setup_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx) { s32 result = 0; struct host_if_msg msg; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 312da75fc02e..d0b85a53c29e 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -303,95 +303,95 @@ struct add_sta_param { u16 flags_set; }; -s32 host_int_remove_key(struct host_if_drv *hWFIDrv, const u8 *pu8StaAddress); -int host_int_remove_wep_key(struct host_if_drv *wfi_drv, u8 index); -int host_int_set_wep_default_key(struct host_if_drv *hif_drv, u8 index); -int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv, +s32 wilc_remove_key(struct host_if_drv *hWFIDrv, const u8 *pu8StaAddress); +int wilc_remove_wep_key(struct host_if_drv *wfi_drv, u8 index); +int wilc_set_wep_default_keyid(struct host_if_drv *hif_drv, u8 index); +int wilc_add_wep_key_bss_sta(struct host_if_drv *hif_drv, const u8 *key, u8 len, u8 index); -int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, +int wilc_add_wep_key_bss_ap(struct host_if_drv *hif_drv, const u8 *key, u8 len, u8 index, u8 mode, enum AUTHTYPE auth_type); -s32 host_int_add_ptk(struct host_if_drv *hWFIDrv, const u8 *pu8Ptk, +s32 wilc_add_ptk(struct host_if_drv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen, const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx); -s32 host_int_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, +s32 wilc_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime); -s32 host_int_add_rx_gtk(struct host_if_drv *hWFIDrv, const u8 *pu8RxGtk, +s32 wilc_add_rx_gtk(struct host_if_drv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKeylen, u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode); -s32 host_int_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen, +s32 wilc_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk, u8 u8KeyIdx); -s32 host_int_set_pmkid_info(struct host_if_drv *hWFIDrv, +s32 wilc_set_pmkid_info(struct host_if_drv *hWFIDrv, struct host_if_pmkid_attr *pu8PmkidInfoArray); -s32 hif_get_mac_address(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress); -s32 host_int_set_MacAddress(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress); -int host_int_wait_msg_queue_idle(void); -s32 host_int_set_start_scan_req(struct host_if_drv *hWFIDrv, u8 scanSource); -s32 host_int_set_join_req(struct host_if_drv *hWFIDrv, u8 *pu8bssid, +s32 wilc_get_mac_address(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress); +s32 wilc_set_mac_address(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress); +int wilc_wait_msg_queue_idle(void); +s32 wilc_set_start_scan_req(struct host_if_drv *hWFIDrv, u8 scanSource); +s32 wilc_set_join_req(struct host_if_drv *hWFIDrv, u8 *pu8bssid, const u8 *pu8ssid, size_t ssidLen, const u8 *pu8IEs, size_t IEsLen, wilc_connect_result pfConnectResult, void *pvUserArg, u8 u8security, enum AUTHTYPE tenuAuth_type, u8 u8channel, void *pJoinParams); -s32 host_int_flush_join_req(struct host_if_drv *hWFIDrv); -s32 host_int_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode); -int host_int_set_mac_chnl_num(struct host_if_drv *wfi_drv, u8 channel); -s32 host_int_get_rssi(struct host_if_drv *hWFIDrv, s8 *ps8Rssi); -s32 host_int_scan(struct host_if_drv *hWFIDrv, u8 u8ScanSource, +s32 wilc_flush_join_req(struct host_if_drv *hWFIDrv); +s32 wilc_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode); +int wilc_set_mac_chnl_num(struct host_if_drv *wfi_drv, u8 channel); +s32 wilc_get_rssi(struct host_if_drv *hWFIDrv, s8 *ps8Rssi); +s32 wilc_scan(struct host_if_drv *hWFIDrv, u8 u8ScanSource, u8 u8ScanType, u8 *pu8ChnlFreqList, u8 u8ChnlListLen, const u8 *pu8IEs, size_t IEsLen, wilc_scan_result ScanResult, void *pvUserArg, struct hidden_network *pstrHiddenNetwork); -s32 hif_set_cfg(struct host_if_drv *hWFIDrv, +s32 wilc_hif_set_cfg(struct host_if_drv *hWFIDrv, struct cfg_param_val *pstrCfgParamVal); -s32 host_int_init(struct net_device *dev, struct host_if_drv **phWFIDrv); -s32 host_int_deinit(struct host_if_drv *hWFIDrv); -s32 host_int_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval, +s32 wilc_init(struct net_device *dev, struct host_if_drv **phWFIDrv); +s32 wilc_deinit(struct host_if_drv *hWFIDrv); +s32 wilc_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval, u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head, u32 u32TailLen, u8 *pu8tail); -int host_int_del_beacon(struct host_if_drv *hif_drv); -int host_int_add_station(struct host_if_drv *hif_drv, +int wilc_del_beacon(struct host_if_drv *hif_drv); +int wilc_add_station(struct host_if_drv *hif_drv, struct add_sta_param *sta_param); -s32 host_int_del_allstation(struct host_if_drv *hWFIDrv, +s32 wilc_del_allstation(struct host_if_drv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]); -int host_int_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr); -s32 host_int_edit_station(struct host_if_drv *hWFIDrv, +int wilc_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr); +s32 wilc_edit_station(struct host_if_drv *hWFIDrv, struct add_sta_param *pstrStaParams); -s32 host_int_set_power_mgmt(struct host_if_drv *hWFIDrv, +s32 wilc_set_power_mgmt(struct host_if_drv *hWFIDrv, bool bIsEnabled, u32 u32Timeout); -s32 host_int_setup_multicast_filter(struct host_if_drv *hWFIDrv, +s32 wilc_setup_multicast_filter(struct host_if_drv *hWFIDrv, bool bIsEnabled, u32 u32count); -s32 host_int_setup_ipaddress(struct host_if_drv *hWFIDrv, +s32 wilc_setup_ipaddress(struct host_if_drv *hWFIDrv, u8 *pu8IPAddr, u8 idx); -s32 host_int_del_All_Rx_BASession(struct host_if_drv *hWFIDrv, +s32 wilc_del_all_rx_ba_session(struct host_if_drv *hWFIDrv, char *pBSSID, char TID); -s32 host_int_remain_on_channel(struct host_if_drv *hWFIDrv, +s32 wilc_remain_on_channel(struct host_if_drv *hWFIDrv, u32 u32SessionID, u32 u32duration, u16 chan, wilc_remain_on_chan_expired RemainOnChanExpired, wilc_remain_on_chan_ready RemainOnChanReady, void *pvUserArg); -s32 host_int_ListenStateExpired(struct host_if_drv *hWFIDrv, u32 u32SessionID); -s32 host_int_frame_register(struct host_if_drv *hWFIDrv, +s32 wilc_listen_state_expired(struct host_if_drv *hWFIDrv, u32 u32SessionID); +s32 wilc_frame_register(struct host_if_drv *hWFIDrv, u16 u16FrameType, bool bReg); -int host_int_set_wfi_drv_handler(struct host_if_drv *address); -int host_int_set_operation_mode(struct host_if_drv *wfi_drv, u32 mode); +int wilc_set_wfi_drv_handler(struct host_if_drv *address); +int wilc_set_operation_mode(struct host_if_drv *wfi_drv, u32 mode); -void host_int_freeJoinParams(void *pJoinParams); +void wilc_free_join_params(void *pJoinParams); -s32 host_int_get_statistics(struct host_if_drv *hWFIDrv, +s32 wilc_get_statistics(struct host_if_drv *hWFIDrv, struct rf_info *pstrStatistics); -void resolve_disconnect_aberration(struct host_if_drv *hif_drv); +void wilc_resolve_disconnect_aberration(struct host_if_drv *hif_drv); #endif diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c index 2d518acb4af3..f0a458764ff2 100644 --- a/drivers/staging/wilc1000/linux_mon.c +++ b/drivers/staging/wilc1000/linux_mon.c @@ -26,7 +26,7 @@ struct wilc_wfi_radiotap_cb_hdr { static struct net_device *wilc_wfi_mon; /* global monitor netdev */ -extern int mac_xmit(struct sk_buff *skb, struct net_device *dev); +extern int wilc_mac_xmit(struct sk_buff *skb, struct net_device *dev); static u8 srcAdd[6]; @@ -298,7 +298,7 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb, mon_mgmt_tx(mon_priv->real_ndev, skb->data, skb->len); dev_kfree_skb(skb); } else - ret = mac_xmit(skb, mon_priv->real_ndev); + ret = wilc_mac_xmit(skb, mon_priv->real_ndev); return ret; } diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index b95dba74a37d..d3d07fc30e23 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -37,9 +37,9 @@ #define _linux_wlan_device_detection() {} #define _linux_wlan_device_removal() {} -extern bool g_obtainingIP; -extern u8 multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; -extern struct timer_list hDuringIpTimer; +extern bool wilc_optaining_ip; +extern u8 wilc_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; +extern struct timer_list wilc_during_ip_timer; static int linux_wlan_device_power(int on_off) { @@ -86,20 +86,20 @@ extern void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size); static void linux_wlan_tx_complete(void *priv, int status); static int mac_init_fn(struct net_device *ndev); -int mac_xmit(struct sk_buff *skb, struct net_device *dev); -int mac_open(struct net_device *ndev); -int mac_close(struct net_device *ndev); +int wilc_mac_xmit(struct sk_buff *skb, struct net_device *dev); +int wilc_mac_open(struct net_device *ndev); +int wilc_mac_close(struct net_device *ndev); static struct net_device_stats *mac_stats(struct net_device *dev); static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd); static void wilc_set_multicast_list(struct net_device *dev); -struct wilc *g_linux_wlan; -bool bEnablePS = true; +struct wilc *wilc_dev; +bool wilc_enable_ps = true; static const struct net_device_ops wilc_netdev_ops = { .ndo_init = mac_init_fn, - .ndo_open = mac_open, - .ndo_stop = mac_close, - .ndo_start_xmit = mac_xmit, + .ndo_open = wilc_mac_open, + .ndo_stop = wilc_mac_close, + .ndo_start_xmit = wilc_mac_xmit, .ndo_do_ioctl = mac_ioctl, .ndo_get_stats = mac_stats, .ndo_set_rx_mode = wilc_set_multicast_list, @@ -155,13 +155,13 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event if (nic->iftype == STATION_MODE || nic->iftype == CLIENT_MODE) { hif_drv->IFC_UP = 1; - g_obtainingIP = false; - del_timer(&hDuringIpTimer); + wilc_optaining_ip = false; + del_timer(&wilc_during_ip_timer); PRINT_D(GENERIC_DBG, "IP obtained , enable scan\n"); } - if (bEnablePS) - host_int_set_power_mgmt(hif_drv, 1, 0); + if (wilc_enable_ps) + wilc_set_power_mgmt(hif_drv, 1, 0); PRINT_D(GENERIC_DBG, "[%s] Up IP\n", dev_iface->ifa_label); @@ -169,7 +169,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n", ip_addr_buf[0], ip_addr_buf[1], ip_addr_buf[2], ip_addr_buf[3]); - host_int_setup_ipaddress(hif_drv, ip_addr_buf, nic->u8IfIdx); + wilc_setup_ipaddress(hif_drv, ip_addr_buf, nic->u8IfIdx); break; @@ -179,13 +179,13 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event PRINT_INFO(GENERIC_DBG, "\n ============== IP Address Released ===============\n\n"); if (nic->iftype == STATION_MODE || nic->iftype == CLIENT_MODE) { hif_drv->IFC_UP = 0; - g_obtainingIP = false; + wilc_optaining_ip = false; } if (memcmp(dev_iface->ifa_label, wlan_dev_name, 5) == 0) - host_int_set_power_mgmt(hif_drv, 0, 0); + wilc_set_power_mgmt(hif_drv, 0, 0); - resolve_disconnect_aberration(hif_drv); + wilc_resolve_disconnect_aberration(hif_drv); PRINT_D(GENERIC_DBG, "[%s] Down IP\n", dev_iface->ifa_label); @@ -194,7 +194,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event ip_addr_buf[0], ip_addr_buf[1], ip_addr_buf[2], ip_addr_buf[3]); - host_int_setup_ipaddress(hif_drv, ip_addr_buf, nic->u8IfIdx); + wilc_setup_ipaddress(hif_drv, ip_addr_buf, nic->u8IfIdx); break; @@ -358,7 +358,7 @@ static struct net_device *get_if_handler(struct wilc *wilc, u8 *mac_header) return NULL; } -int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid) +int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid) { int i = 0; int ret = -1; @@ -378,14 +378,14 @@ int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid) return ret; } -int linux_wlan_get_num_conn_ifcs(void) +int wilc_wlan_get_num_conn_ifcs(void) { u8 i = 0; u8 null_bssid[6] = {0}; u8 ret_val = 0; - for (i = 0; i < g_linux_wlan->vif_num; i++) - if (memcmp(g_linux_wlan->vif[i].bssid, null_bssid, 6)) + for (i = 0; i < wilc_dev->vif_num; i++) + if (memcmp(wilc_dev->vif[i].bssid, null_bssid, 6)) ret_val++; return ret_val; @@ -466,7 +466,7 @@ void linux_wlan_rx_complete(void) PRINT_D(RX_DBG, "RX completed\n"); } -int linux_wlan_get_firmware(struct net_device *dev) +int wilc_wlan_get_firmware(struct net_device *dev) { perInterface_wlan_t *nic; struct wilc *wilc; @@ -799,7 +799,7 @@ void wilc1000_wlan_deinit(struct net_device *dev) PRINT_D(INIT_DBG, "Disabling IRQ\n"); #ifdef WILC_SDIO mutex_lock(&wl->hif_cs); - disable_sdio_interrupt(); + wilc_sdio_disable_interrupt(); mutex_unlock(&wl->hif_cs); #endif if (&wl->txq_event) @@ -820,7 +820,7 @@ void wilc1000_wlan_deinit(struct net_device *dev) PRINT_D(INIT_DBG, "Disabling IRQ 2\n"); mutex_lock(&wl->hif_cs); - disable_sdio_interrupt(); + wilc_sdio_disable_interrupt(); mutex_unlock(&wl->hif_cs); #endif #endif @@ -972,14 +972,14 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) } #if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO) - if (enable_sdio_interrupt()) { + if (wilc_sdio_enable_interrupt()) { PRINT_ER("couldn't initialize IRQ\n"); ret = -EIO; goto _fail_irq_init_; } #endif - if (linux_wlan_get_firmware(dev)) { + if (wilc_wlan_get_firmware(dev)) { PRINT_ER("Can't get firmware\n"); ret = -EIO; goto _fail_irq_enable_; @@ -1027,7 +1027,7 @@ _fail_fw_start_: _fail_irq_enable_: #if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO) - disable_sdio_interrupt(); + wilc_sdio_disable_interrupt(); _fail_irq_init_: #endif #if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO) @@ -1054,7 +1054,7 @@ static int mac_init_fn(struct net_device *ndev) return 0; } -int mac_open(struct net_device *ndev) +int wilc_mac_open(struct net_device *ndev) { perInterface_wlan_t *nic; @@ -1092,9 +1092,9 @@ int mac_open(struct net_device *ndev) return ret; } - set_machw_change_vir_if(ndev, false); + wilc_set_machw_change_vir_if(ndev, false); - hif_get_mac_address(priv->hWILCWFIDrv, mac_add); + wilc_get_mac_address(priv->hWILCWFIDrv, mac_add); PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add); for (i = 0; i < wl->vif_num; i++) { @@ -1159,29 +1159,29 @@ static void wilc_set_multicast_list(struct net_device *dev) if ((dev->flags & IFF_ALLMULTI) || (dev->mc.count) > WILC_MULTICAST_TABLE_SIZE) { PRINT_D(INIT_DBG, "Disable multicast filter, retrive all multicast packets\n"); - host_int_setup_multicast_filter(hif_drv, false, 0); + wilc_setup_multicast_filter(hif_drv, false, 0); return; } if ((dev->mc.count) == 0) { PRINT_D(INIT_DBG, "Enable multicast filter, retrive directed packets only.\n"); - host_int_setup_multicast_filter(hif_drv, true, 0); + wilc_setup_multicast_filter(hif_drv, true, 0); return; } netdev_for_each_mc_addr(ha, dev) { - memcpy(multicast_mac_addr_list[i], ha->addr, ETH_ALEN); + memcpy(wilc_multicast_mac_addr_list[i], ha->addr, ETH_ALEN); PRINT_D(INIT_DBG, "Entry[%d]: %x:%x:%x:%x:%x:%x\n", i, - multicast_mac_addr_list[i][0], - multicast_mac_addr_list[i][1], - multicast_mac_addr_list[i][2], - multicast_mac_addr_list[i][3], - multicast_mac_addr_list[i][4], - multicast_mac_addr_list[i][5]); + wilc_multicast_mac_addr_list[i][0], + wilc_multicast_mac_addr_list[i][1], + wilc_multicast_mac_addr_list[i][2], + wilc_multicast_mac_addr_list[i][3], + wilc_multicast_mac_addr_list[i][4], + wilc_multicast_mac_addr_list[i][5]); i++; } - host_int_setup_multicast_filter(hif_drv, true, (dev->mc.count)); + wilc_setup_multicast_filter(hif_drv, true, (dev->mc.count)); return; } @@ -1198,7 +1198,7 @@ static void linux_wlan_tx_complete(void *priv, int status) kfree(pv_data); } -int mac_xmit(struct sk_buff *skb, struct net_device *ndev) +int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev) { perInterface_wlan_t *nic; struct tx_complete_data *tx_data = NULL; @@ -1259,7 +1259,7 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev) return 0; } -int mac_close(struct net_device *ndev) +int wilc_mac_close(struct net_device *ndev) { struct wilc_priv *priv; perInterface_wlan_t *nic; @@ -1353,8 +1353,7 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) if (strncasecmp(buff, "RSSI", length) == 0) { priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy); - ret = host_int_get_rssi(priv->hWILCWFIDrv, - &rssi); + ret = wilc_get_rssi(priv->hWILCWFIDrv, &rssi); if (ret) PRINT_ER("Failed to send get rssi param's message queue "); PRINT_INFO(GENERIC_DBG, "RSSI :%d\n", rssi); @@ -1472,7 +1471,7 @@ void wl_wlan_cleanup(struct wilc *wilc) for (i = 0; i < NUM_CONCURRENT_IFC; i++) if (wilc->vif[i].ndev) if (nic[i]->mac_opened) - mac_close(wilc->vif[i].ndev); + wilc_mac_close(wilc->vif[i].ndev); for (i = 0; i < NUM_CONCURRENT_IFC; i++) { unregister_netdev(wilc->vif[i].ndev); @@ -1498,11 +1497,11 @@ int wilc_netdev_init(struct wilc **wilc) sema_init(&close_exit_sync, 0); - g_linux_wlan = kzalloc(sizeof(*g_linux_wlan), GFP_KERNEL); - if (!g_linux_wlan) + wilc_dev = kzalloc(sizeof(*wilc_dev), GFP_KERNEL); + if (!wilc_dev) return -ENOMEM; - *wilc = g_linux_wlan; + *wilc = wilc_dev; register_inetaddr_notifier(&g_dev_notifier); @@ -1521,11 +1520,11 @@ int wilc_netdev_init(struct wilc **wilc) else strcpy(ndev->name, "p2p%d"); - nic->u8IfIdx = g_linux_wlan->vif_num; + nic->u8IfIdx = wilc_dev->vif_num; nic->wilc_netdev = ndev; nic->wilc = *wilc; - g_linux_wlan->vif[g_linux_wlan->vif_num].ndev = ndev; - g_linux_wlan->vif_num++; + wilc_dev->vif[wilc_dev->vif_num].ndev = ndev; + wilc_dev->vif_num++; ndev->netdev_ops = &wilc_netdev_ops; { @@ -1533,7 +1532,7 @@ int wilc_netdev_init(struct wilc **wilc) wdev = wilc_create_wiphy(ndev); #ifdef WILC_SDIO - SET_NETDEV_DEV(ndev, &local_sdio_func->dev); + SET_NETDEV_DEV(ndev, &wilc_sdio_func->dev); #endif if (!wdev) { @@ -1561,13 +1560,13 @@ int wilc_netdev_init(struct wilc **wilc) } #ifndef WILC_SDIO - if (!linux_spi_init()) { + if (!wilc_spi_init()) { PRINT_ER("Can't initialize SPI\n"); return -1; } - g_linux_wlan->wilc_spidev = wilc_spi_dev; + wilc_dev->wilc_spidev = wilc_spi_dev; #else - g_linux_wlan->wilc_sdio_func = local_sdio_func; + wilc_dev->wilc_sdio_func = wilc_sdio_func; #endif return 0; diff --git a/drivers/staging/wilc1000/linux_wlan_common.h b/drivers/staging/wilc1000/linux_wlan_common.h index 2b76e41ebd4d..b8dfc4a5e5cb 100644 --- a/drivers/staging/wilc1000/linux_wlan_common.h +++ b/drivers/staging/wilc1000/linux_wlan_common.h @@ -41,8 +41,8 @@ enum debug_region { int wilc_debugfs_init(void); void wilc_debugfs_remove(void); -extern atomic_t REGION; -extern atomic_t DEBUG_LEVEL; +extern atomic_t WILC_REGION; +extern atomic_t WILC_DEBUG_LEVEL; #define DEBUG BIT(0) #define INFO BIT(1) @@ -51,8 +51,8 @@ extern atomic_t DEBUG_LEVEL; #define PRINT_D(region, ...) \ do { \ - if ((atomic_read(&DEBUG_LEVEL) & DEBUG) && \ - ((atomic_read(®ION)) & (region))) { \ + if ((atomic_read(&WILC_DEBUG_LEVEL) & DEBUG) && \ + ((atomic_read(&WILC_REGION)) & (region))) { \ printk("DBG [%s: %d]", __func__, __LINE__); \ printk(__VA_ARGS__); \ } \ @@ -60,8 +60,8 @@ extern atomic_t DEBUG_LEVEL; #define PRINT_INFO(region, ...) \ do { \ - if ((atomic_read(&DEBUG_LEVEL) & INFO) && \ - ((atomic_read(®ION)) & (region))) { \ + if ((atomic_read(&WILC_DEBUG_LEVEL) & INFO) && \ + ((atomic_read(&WILC_REGION)) & (region))) { \ printk("INFO [%s]", __func__); \ printk(__VA_ARGS__); \ } \ @@ -69,8 +69,8 @@ extern atomic_t DEBUG_LEVEL; #define PRINT_WRN(region, ...) \ do { \ - if ((atomic_read(&DEBUG_LEVEL) & WRN) && \ - ((atomic_read(®ION)) & (region))) { \ + if ((atomic_read(&WILC_DEBUG_LEVEL) & WRN) && \ + ((atomic_read(&WILC_REGION)) & (region))) { \ printk("WRN [%s: %d]", __func__, __LINE__); \ printk(__VA_ARGS__); \ } \ @@ -78,7 +78,7 @@ extern atomic_t DEBUG_LEVEL; #define PRINT_ER(...) \ do { \ - if ((atomic_read(&DEBUG_LEVEL) & ERR)) { \ + if ((atomic_read(&WILC_DEBUG_LEVEL) & ERR)) { \ printk("ERR [%s: %d]", __func__, __LINE__); \ printk(__VA_ARGS__); \ } \ diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index a0640ebe904e..0b01873faf79 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -26,7 +26,7 @@ struct wilc_sdio { struct wilc *wilc; }; -struct sdio_func *local_sdio_func; +struct sdio_func *wilc_sdio_func; static unsigned int sdio_default_speed; @@ -53,9 +53,9 @@ static void wilc_sdio_interrupt(struct sdio_func *func) #endif -int linux_sdio_cmd52(sdio_cmd52_t *cmd) +int wilc_sdio_cmd52(sdio_cmd52_t *cmd) { - struct sdio_func *func = g_linux_wlan->wilc_sdio_func; + struct sdio_func *func = wilc_dev->wilc_sdio_func; int ret; u8 data; @@ -85,9 +85,9 @@ int linux_sdio_cmd52(sdio_cmd52_t *cmd) } -int linux_sdio_cmd53(sdio_cmd53_t *cmd) +int wilc_sdio_cmd53(sdio_cmd53_t *cmd) { - struct sdio_func *func = g_linux_wlan->wilc_sdio_func; + struct sdio_func *func = wilc_dev->wilc_sdio_func; int size, ret; sdio_claim_host(func); @@ -127,7 +127,7 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id return -ENOMEM; PRINT_D(INIT_DBG, "Initializing netdev\n"); - local_sdio_func = func; + wilc_sdio_func = func; if (wilc_netdev_init(&wilc)) { PRINT_ER("Couldn't initialize netdev\n"); kfree(wl_sdio); @@ -157,14 +157,14 @@ struct sdio_driver wilc_bus = { .remove = linux_sdio_remove, }; -int enable_sdio_interrupt(void) +int wilc_sdio_enable_interrupt(void) { int ret = 0; #ifndef WILC_SDIO_IRQ_GPIO - sdio_claim_host(local_sdio_func); - ret = sdio_claim_irq(local_sdio_func, wilc_sdio_interrupt); - sdio_release_host(local_sdio_func); + sdio_claim_host(wilc_sdio_func); + ret = sdio_claim_irq(wilc_sdio_func, wilc_sdio_interrupt); + sdio_release_host(wilc_sdio_func); if (ret < 0) { PRINT_ER("can't claim sdio_irq, err(%d)\n", ret); @@ -174,22 +174,22 @@ int enable_sdio_interrupt(void) return ret; } -void disable_sdio_interrupt(void) +void wilc_sdio_disable_interrupt(void) { #ifndef WILC_SDIO_IRQ_GPIO int ret; - PRINT_D(INIT_DBG, "disable_sdio_interrupt IN\n"); + PRINT_D(INIT_DBG, "wilc_sdio_disable_interrupt IN\n"); - sdio_claim_host(local_sdio_func); - ret = sdio_release_irq(local_sdio_func); + sdio_claim_host(wilc_sdio_func); + ret = sdio_release_irq(wilc_sdio_func); if (ret < 0) { PRINT_ER("can't release sdio_irq, err(%d)\n", ret); } - sdio_release_host(local_sdio_func); + sdio_release_host(wilc_sdio_func); - PRINT_D(INIT_DBG, "disable_sdio_interrupt OUT\n"); + PRINT_D(INIT_DBG, "wilc_sdio_disable_interrupt OUT\n"); #endif } @@ -197,13 +197,13 @@ static int linux_sdio_set_speed(int speed) { struct mmc_ios ios; - sdio_claim_host(local_sdio_func); + sdio_claim_host(wilc_sdio_func); - memcpy((void *)&ios, (void *)&local_sdio_func->card->host->ios, sizeof(struct mmc_ios)); - local_sdio_func->card->host->ios.clock = speed; + memcpy((void *)&ios, (void *)&wilc_sdio_func->card->host->ios, sizeof(struct mmc_ios)); + wilc_sdio_func->card->host->ios.clock = speed; ios.clock = speed; - local_sdio_func->card->host->ops->set_ios(local_sdio_func->card->host, &ios); - sdio_release_host(local_sdio_func); + wilc_sdio_func->card->host->ops->set_ios(wilc_sdio_func->card->host, &ios); + sdio_release_host(wilc_sdio_func); PRINT_INFO(INIT_DBG, "@@@@@@@@@@@@ change SDIO speed to %d @@@@@@@@@\n", speed); return 1; @@ -211,10 +211,10 @@ static int linux_sdio_set_speed(int speed) static int linux_sdio_get_speed(void) { - return local_sdio_func->card->host->ios.clock; + return wilc_sdio_func->card->host->ios.clock; } -int linux_sdio_init(void) +int wilc_sdio_init(void) { /** @@ -226,12 +226,12 @@ int linux_sdio_init(void) return 1; } -int linux_sdio_set_max_speed(void) +int wilc_sdio_set_max_speed(void) { return linux_sdio_set_speed(MAX_SPEED); } -int linux_sdio_set_default_speed(void) +int wilc_sdio_set_default_speed(void) { return linux_sdio_set_speed(sdio_default_speed); } diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h b/drivers/staging/wilc1000/linux_wlan_sdio.h index 7c59b2f6543a..49cce2c43410 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.h +++ b/drivers/staging/wilc1000/linux_wlan_sdio.h @@ -1,13 +1,13 @@ -extern struct sdio_func *local_sdio_func; +extern struct sdio_func *wilc_sdio_func; extern struct sdio_driver wilc_bus; #include -int linux_sdio_init(void); -int linux_sdio_cmd52(sdio_cmd52_t *cmd); -int linux_sdio_cmd53(sdio_cmd53_t *cmd); -int enable_sdio_interrupt(void); -void disable_sdio_interrupt(void); -int linux_sdio_set_max_speed(void); -int linux_sdio_set_default_speed(void); +int wilc_sdio_init(void); +int wilc_sdio_cmd52(sdio_cmd52_t *cmd); +int wilc_sdio_cmd53(sdio_cmd53_t *cmd); +int wilc_sdio_enable_interrupt(void); +void wilc_sdio_disable_interrupt(void); +int wilc_sdio_set_max_speed(void); +int wilc_sdio_set_default_speed(void); diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index 3655077a936f..790128f6d034 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -79,7 +79,7 @@ struct spi_driver wilc_bus __refdata = { .remove = __exit_p(wilc_bus_remove), }; -int linux_spi_init(void) +int wilc_spi_init(void) { int ret = 1; static int called; @@ -102,7 +102,7 @@ int linux_spi_init(void) #if defined(TXRX_PHASE_SIZE) -int linux_spi_write(u8 *b, u32 len) +int wilc_spi_write(u8 *b, u32 len) { int ret; @@ -179,7 +179,7 @@ int linux_spi_write(u8 *b, u32 len) } #else -int linux_spi_write(u8 *b, u32 len) +int wilc_spi_write(u8 *b, u32 len) { int ret; @@ -230,7 +230,7 @@ int linux_spi_write(u8 *b, u32 len) #if defined(TXRX_PHASE_SIZE) -int linux_spi_read(u8 *rb, u32 rlen) +int wilc_spi_read(u8 *rb, u32 rlen) { int ret; @@ -304,7 +304,7 @@ int linux_spi_read(u8 *rb, u32 rlen) } #else -int linux_spi_read(u8 *rb, u32 rlen) +int wilc_spi_read(u8 *rb, u32 rlen) { int ret; @@ -349,7 +349,7 @@ int linux_spi_read(u8 *rb, u32 rlen) #endif -int linux_spi_write_read(u8 *wb, u8 *rb, u32 rlen) +int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen) { int ret; @@ -386,7 +386,7 @@ int linux_spi_write_read(u8 *wb, u8 *rb, u32 rlen) return ret; } -int linux_spi_set_max_speed(void) +int wilc_spi_set_max_speed(void) { SPEED = MAX_SPEED; diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h b/drivers/staging/wilc1000/linux_wlan_spi.h index 2edd97b4c5cc..aecb522ff56d 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.h +++ b/drivers/staging/wilc1000/linux_wlan_spi.h @@ -5,9 +5,9 @@ extern struct spi_device *wilc_spi_dev; extern struct spi_driver wilc_bus; -int linux_spi_init(void); -int linux_spi_write(u8 *b, u32 len); -int linux_spi_read(u8 *rb, u32 rlen); -int linux_spi_write_read(u8 *wb, u8 *rb, u32 rlen); -int linux_spi_set_max_speed(void); +int wilc_spi_init(void); +int wilc_spi_write(u8 *b, u32 len); +int wilc_spi_read(u8 *rb, u32 rlen); +int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen); +int wilc_spi_set_max_speed(void); #endif diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c index ae111862e7a9..d70f96f475b8 100644 --- a/drivers/staging/wilc1000/wilc_debugfs.c +++ b/drivers/staging/wilc1000/wilc_debugfs.c @@ -26,8 +26,8 @@ static struct dentry *wilc_dir; #define DBG_REGION_ALL (GENERIC_DBG | HOSTAPD_DBG | HOSTINF_DBG | CORECONFIG_DBG | CFG80211_DBG | INT_DBG | TX_DBG | RX_DBG | LOCK_DBG | INIT_DBG | BUS_DBG | MEM_DBG) #define DBG_LEVEL_ALL (DEBUG | INFO | WRN | ERR) -atomic_t REGION = ATOMIC_INIT(INIT_DBG | GENERIC_DBG | CFG80211_DBG | FIRM_DBG | HOSTAPD_DBG); -atomic_t DEBUG_LEVEL = ATOMIC_INIT(ERR); +atomic_t WILC_REGION = ATOMIC_INIT(INIT_DBG | GENERIC_DBG | CFG80211_DBG | FIRM_DBG | HOSTAPD_DBG); +atomic_t WILC_DEBUG_LEVEL = ATOMIC_INIT(ERR); /* * -------------------------------------------------------------------------------- @@ -43,7 +43,7 @@ static ssize_t wilc_debug_level_read(struct file *file, char __user *userbuf, si if (*ppos > 0) return 0; - res = scnprintf(buf, sizeof(buf), "Debug Level: %x\n", atomic_read(&DEBUG_LEVEL)); + res = scnprintf(buf, sizeof(buf), "Debug Level: %x\n", atomic_read(&WILC_DEBUG_LEVEL)); return simple_read_from_buffer(userbuf, count, ppos, buf, res); } @@ -59,11 +59,11 @@ static ssize_t wilc_debug_level_write(struct file *filp, const char __user *buf, return ret; if (flag > DBG_LEVEL_ALL) { - printk("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", __func__, flag, atomic_read(&DEBUG_LEVEL)); + printk("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", __func__, flag, atomic_read(&WILC_DEBUG_LEVEL)); return -EINVAL; } - atomic_set(&DEBUG_LEVEL, (int)flag); + atomic_set(&WILC_DEBUG_LEVEL, (int)flag); if (flag == 0) printk("Debug-level disabled\n"); @@ -82,7 +82,7 @@ static ssize_t wilc_debug_region_read(struct file *file, char __user *userbuf, s if (*ppos > 0) return 0; - res = scnprintf(buf, sizeof(buf), "Debug region: %x\n", atomic_read(®ION)); + res = scnprintf(buf, sizeof(buf), "Debug region: %x\n", atomic_read(&WILC_REGION)); return simple_read_from_buffer(userbuf, count, ppos, buf, res); } @@ -102,12 +102,12 @@ static ssize_t wilc_debug_region_write(struct file *filp, const char *buf, size_ flag = buffer[0] - '0'; if (flag > DBG_REGION_ALL) { - printk("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", __func__, flag, atomic_read(®ION)); + printk("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", __func__, flag, atomic_read(&WILC_REGION)); return -EFAULT; } - atomic_set(®ION, (int)flag); - printk("new debug-region is %x\n", atomic_read(®ION)); + atomic_set(&WILC_REGION, (int)flag); + printk("new debug-region is %x\n", atomic_read(&WILC_REGION)); return count; } diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index d26e4cf0f436..7fca3b23b485 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -48,21 +48,21 @@ static int sdio_set_func0_csa_address(u32 adr) cmd.raw = 0; cmd.address = 0x10c; cmd.data = (u8)adr; - if (!linux_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10c data...\n"); goto _fail_; } cmd.address = 0x10d; cmd.data = (u8)(adr >> 8); - if (!linux_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10d data...\n"); goto _fail_; } cmd.address = 0x10e; cmd.data = (u8)(adr >> 16); - if (!linux_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10e data...\n"); goto _fail_; } @@ -81,14 +81,14 @@ static int sdio_set_func0_block_size(u32 block_size) cmd.raw = 0; cmd.address = 0x10; cmd.data = (u8)block_size; - if (!linux_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10 data...\n"); goto _fail_; } cmd.address = 0x11; cmd.data = (u8)(block_size >> 8); - if (!linux_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x11 data...\n"); goto _fail_; } @@ -113,13 +113,13 @@ static int sdio_set_func1_block_size(u32 block_size) cmd.raw = 0; cmd.address = 0x110; cmd.data = (u8)block_size; - if (!linux_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x110 data...\n"); goto _fail_; } cmd.address = 0x111; cmd.data = (u8)(block_size >> 8); - if (!linux_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x111 data...\n"); goto _fail_; } @@ -140,7 +140,7 @@ static int sdio_clear_int(void) cmd.raw = 0; cmd.address = 0x4; cmd.data = 0; - linux_sdio_cmd52(&cmd); + wilc_sdio_cmd52(&cmd); return cmd.data; #else @@ -176,7 +176,7 @@ static int sdio_write_reg(u32 addr, u32 data) cmd.raw = 0; cmd.address = addr; cmd.data = data; - if (!linux_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd 52, read reg (%08x) ...\n", addr); goto _fail_; } @@ -198,7 +198,7 @@ static int sdio_write_reg(u32 addr, u32 data) cmd.buffer = (u8 *)&data; cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */ - if (!linux_sdio_cmd53(&cmd)) { + if (!wilc_sdio_cmd53(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53, write reg (%08x)...\n", addr); goto _fail_; } @@ -261,7 +261,7 @@ static int sdio_write(u32 addr, u8 *buf, u32 size) if (!sdio_set_func0_csa_address(addr)) goto _fail_; } - if (!linux_sdio_cmd53(&cmd)) { + if (!wilc_sdio_cmd53(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block send...\n", addr); goto _fail_; } @@ -282,7 +282,7 @@ static int sdio_write(u32 addr, u8 *buf, u32 size) if (!sdio_set_func0_csa_address(addr)) goto _fail_; } - if (!linux_sdio_cmd53(&cmd)) { + if (!wilc_sdio_cmd53(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], bytes send...\n", addr); goto _fail_; } @@ -304,7 +304,7 @@ static int sdio_read_reg(u32 addr, u32 *data) cmd.function = 0; cmd.raw = 0; cmd.address = addr; - if (!linux_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd 52, read reg (%08x) ...\n", addr); goto _fail_; } @@ -325,7 +325,7 @@ static int sdio_read_reg(u32 addr, u32 *data) cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */ - if (!linux_sdio_cmd53(&cmd)) { + if (!wilc_sdio_cmd53(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53, read reg (%08x)...\n", addr); goto _fail_; } @@ -392,7 +392,7 @@ static int sdio_read(u32 addr, u8 *buf, u32 size) if (!sdio_set_func0_csa_address(addr)) goto _fail_; } - if (!linux_sdio_cmd53(&cmd)) { + if (!wilc_sdio_cmd53(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block read...\n", addr); goto _fail_; } @@ -413,7 +413,7 @@ static int sdio_read(u32 addr, u8 *buf, u32 size) if (!sdio_set_func0_csa_address(addr)) goto _fail_; } - if (!linux_sdio_cmd53(&cmd)) { + if (!wilc_sdio_cmd53(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], bytes read...\n", addr); goto _fail_; } @@ -505,7 +505,7 @@ static int sdio_init(struct wilc *wilc, wilc_debug_func func) g_sdio.dPrint = func; - if (!linux_sdio_init()) { + if (!wilc_sdio_init()) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed io init bus...\n"); return 0; } else { @@ -520,7 +520,7 @@ static int sdio_init(struct wilc *wilc, wilc_debug_func func) cmd.raw = 1; cmd.address = 0x100; cmd.data = 0x80; - if (!linux_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, enable csa...\n"); goto _fail_; } @@ -542,7 +542,7 @@ static int sdio_init(struct wilc *wilc, wilc_debug_func func) cmd.raw = 1; cmd.address = 0x2; cmd.data = 0x2; - if (!linux_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio] Fail cmd 52, set IOE register...\n"); goto _fail_; } @@ -557,7 +557,7 @@ static int sdio_init(struct wilc *wilc, wilc_debug_func func) loop = 3; do { cmd.data = 0; - if (!linux_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, get IOR register...\n"); goto _fail_; } @@ -586,7 +586,7 @@ static int sdio_init(struct wilc *wilc, wilc_debug_func func) cmd.raw = 1; cmd.address = 0x4; cmd.data = 0x3; - if (!linux_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(&cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, set IEN register...\n"); goto _fail_; } @@ -614,12 +614,12 @@ _fail_: static void sdio_set_max_speed(void) { - linux_sdio_set_max_speed(); + wilc_sdio_set_max_speed(); } static void sdio_set_default_speed(void) { - linux_sdio_set_default_speed(); + wilc_sdio_set_default_speed(); } static int sdio_read_size(u32 *size) @@ -636,7 +636,7 @@ static int sdio_read_size(u32 *size) cmd.raw = 0; cmd.address = 0xf2; cmd.data = 0; - linux_sdio_cmd52(&cmd); + wilc_sdio_cmd52(&cmd); tmp = cmd.data; /* cmd.read_write = 0; */ @@ -644,7 +644,7 @@ static int sdio_read_size(u32 *size) /* cmd.raw = 0; */ cmd.address = 0xf3; cmd.data = 0; - linux_sdio_cmd52(&cmd); + wilc_sdio_cmd52(&cmd); tmp |= (cmd.data << 8); *size = tmp; @@ -666,7 +666,7 @@ static int sdio_read_int(u32 *int_status) cmd.function = 1; cmd.address = 0x04; cmd.data = 0; - linux_sdio_cmd52(&cmd); + wilc_sdio_cmd52(&cmd); if (cmd.data & BIT(0)) tmp |= INT_0; @@ -699,7 +699,7 @@ static int sdio_read_int(u32 *int_status) cmd.raw = 0; cmd.address = 0xf7; cmd.data = 0; - linux_sdio_cmd52(&cmd); + wilc_sdio_cmd52(&cmd); irq_flags = cmd.data & 0x1f; tmp |= ((irq_flags >> 0) << IRG_FLAGS_OFFSET); } @@ -746,7 +746,7 @@ static int sdio_clear_int_ext(u32 val) cmd.address = 0xf8; cmd.data = reg; - ret = linux_sdio_cmd52(&cmd); + ret = wilc_sdio_cmd52(&cmd); if (!ret) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0xf8 data (%d) ...\n", __LINE__); goto _fail_; @@ -775,7 +775,7 @@ static int sdio_clear_int_ext(u32 val) cmd.address = 0xf8; cmd.data = BIT(i); - ret = linux_sdio_cmd52(&cmd); + ret = wilc_sdio_cmd52(&cmd); if (!ret) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0xf8 data (%d) ...\n", __LINE__); goto _fail_; @@ -819,7 +819,7 @@ static int sdio_clear_int_ext(u32 val) cmd.raw = 0; cmd.address = 0xf6; cmd.data = vmm_ctl; - ret = linux_sdio_cmd52(&cmd); + ret = wilc_sdio_cmd52(&cmd); if (!ret) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0xf6 data (%d) ...\n", __LINE__); goto _fail_; @@ -925,7 +925,7 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */) * ********************************************/ -struct wilc_hif_func hif_sdio = { +struct wilc_hif_func wilc_hif_sdio = { sdio_init, sdio_deinit, sdio_read_reg, diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index 9af35d1ef99e..dc9cdf5e4065 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -22,8 +22,8 @@ typedef struct { static wilc_spi_t g_spi; -static int wilc_spi_read(u32, u8 *, u32); -static int wilc_spi_write(u32, u8 *, u32); +static int _wilc_spi_read(u32, u8 *, u32); +static int _wilc_spi_write(u32, u8 *, u32); /******************************************** * @@ -249,7 +249,7 @@ static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless) } rix = len; - if (!linux_spi_write_read(wb, rb, len2)) { + if (!wilc_spi_write_read(wb, rb, len2)) { PRINT_ER("[wilc spi]: Failed cmd write, bus error...\n"); result = N_FAIL; return result; @@ -364,7 +364,7 @@ static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless) /** * Read bytes **/ - if (!linux_spi_read(&b[ix], nbytes)) { + if (!wilc_spi_read(&b[ix], nbytes)) { PRINT_ER("[wilc spi]: Failed data block read, bus error...\n"); result = N_FAIL; goto _error_; @@ -374,7 +374,7 @@ static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless) * Read Crc **/ if (!g_spi.crc_off) { - if (!linux_spi_read(crc, 2)) { + if (!wilc_spi_read(crc, 2)) { PRINT_ER("[wilc spi]: Failed data block crc read, bus error...\n"); result = N_FAIL; goto _error_; @@ -405,7 +405,7 @@ static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless) **/ retry = 10; do { - if (!linux_spi_read(&rsp, 1)) { + if (!wilc_spi_read(&rsp, 1)) { PRINT_ER("[wilc spi]: Failed data response read, bus error...\n"); result = N_FAIL; break; @@ -421,7 +421,7 @@ static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless) /** * Read bytes **/ - if (!linux_spi_read(&b[ix], nbytes)) { + if (!wilc_spi_read(&b[ix], nbytes)) { PRINT_ER("[wilc spi]: Failed data block read, bus error...\n"); result = N_FAIL; break; @@ -431,7 +431,7 @@ static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless) * Read Crc **/ if (!g_spi.crc_off) { - if (!linux_spi_read(crc, 2)) { + if (!wilc_spi_read(crc, 2)) { PRINT_ER("[wilc spi]: Failed data block crc read, bus error...\n"); result = N_FAIL; break; @@ -481,7 +481,7 @@ static int spi_data_write(u8 *b, u32 sz) order = 0x2; } cmd |= order; - if (!linux_spi_write(&cmd, 1)) { + if (!wilc_spi_write(&cmd, 1)) { PRINT_ER("[wilc spi]: Failed data block cmd write, bus error...\n"); result = N_FAIL; break; @@ -490,7 +490,7 @@ static int spi_data_write(u8 *b, u32 sz) /** * Write data **/ - if (!linux_spi_write(&b[ix], nbytes)) { + if (!wilc_spi_write(&b[ix], nbytes)) { PRINT_ER("[wilc spi]: Failed data block write, bus error...\n"); result = N_FAIL; break; @@ -500,7 +500,7 @@ static int spi_data_write(u8 *b, u32 sz) * Write Crc **/ if (!g_spi.crc_off) { - if (!linux_spi_write(crc, 2)) { + if (!wilc_spi_write(crc, 2)) { PRINT_ER("[wilc spi]: Failed data block crc write, bus error...\n"); result = N_FAIL; break; @@ -585,7 +585,7 @@ static int wilc_spi_write_reg(u32 addr, u32 data) return result; } -static int wilc_spi_write(u32 addr, u8 *buf, u32 size) +static int _wilc_spi_write(u32 addr, u8 *buf, u32 size) { int result; u8 cmd = CMD_DMA_EXT_WRITE; @@ -639,7 +639,7 @@ static int wilc_spi_read_reg(u32 addr, u32 *data) return 1; } -static int wilc_spi_read(u32 addr, u8 *buf, u32 size) +static int _wilc_spi_read(u32 addr, u8 *buf, u32 size) { u8 cmd = CMD_DMA_EXT_READ; int result; @@ -675,7 +675,7 @@ static int wilc_spi_clear_int(void) return 1; } -static int wilc_spi_deinit(void *pv) +static int _wilc_spi_deinit(void *pv) { /** * TODO: @@ -721,7 +721,7 @@ static int wilc_spi_sync(void) return 1; } -static int wilc_spi_init(struct wilc *wilc, wilc_debug_func func) +static int _wilc_spi_init(struct wilc *wilc, wilc_debug_func func) { u32 reg; u32 chipid; @@ -740,7 +740,7 @@ static int wilc_spi_init(struct wilc *wilc, wilc_debug_func func) memset(&g_spi, 0, sizeof(wilc_spi_t)); g_spi.dPrint = func; - if (!linux_spi_init()) { + if (!wilc_spi_init()) { PRINT_ER("[wilc spi]: Failed io init bus...\n"); return 0; } else { @@ -795,7 +795,7 @@ static int wilc_spi_init(struct wilc *wilc, wilc_debug_func func) static void wilc_spi_max_bus_speed(void) { - linux_spi_set_max_speed(); + wilc_spi_set_max_speed(); } static void wilc_spi_default_bus_speed(void) @@ -1021,20 +1021,20 @@ static int wilc_spi_sync_ext(int nint /* how mant interrupts to enable. */) * Global spi HIF function table * ********************************************/ -struct wilc_hif_func hif_spi = { - wilc_spi_init, - wilc_spi_deinit, +struct wilc_hif_func wilc_hif_spi = { + _wilc_spi_init, + _wilc_spi_deinit, wilc_spi_read_reg, wilc_spi_write_reg, - wilc_spi_read, - wilc_spi_write, + _wilc_spi_read, + _wilc_spi_write, wilc_spi_sync, wilc_spi_clear_int, wilc_spi_read_int, wilc_spi_clear_int_ext, wilc_spi_read_size, - wilc_spi_write, - wilc_spi_read, + _wilc_spi_write, + _wilc_spi_read, wilc_spi_sync_ext, wilc_spi_max_bus_speed, wilc_spi_default_bus_speed, diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 842f0e4bec97..f8fd7a895d44 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -21,18 +21,18 @@ #define IS_MGMT_STATUS_SUCCES 0x040 #define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff) -extern int mac_open(struct net_device *ndev); -extern int mac_close(struct net_device *ndev); +extern int wilc_mac_open(struct net_device *ndev); +extern int wilc_mac_close(struct net_device *ndev); static tstrNetworkInfo astrLastScannedNtwrksShadow[MAX_NUM_SCANNED_NETWORKS_SHADOW]; static u32 u32LastScannedNtwrksCountShadow; -struct timer_list hDuringIpTimer; +struct timer_list wilc_during_ip_timer; static struct timer_list hAgingTimer; static u8 op_ifcs; -extern u8 u8ConnectedSSID[6]; +extern u8 wilc_connected_SSID[6]; -u8 g_wilc_initialized = 1; -extern bool g_obtainingIP; +u8 wilc_initialized = 1; +extern bool wilc_optaining_ip; #define CHAN2G(_channel, _freq, _flags) { \ .band = IEEE80211_BAND_2GHZ, \ @@ -139,7 +139,7 @@ static void clear_shadow_scan(void *pUserVoid) astrLastScannedNtwrksShadow[u32LastScannedNtwrksCountShadow].pu8IEs = NULL; } - host_int_freeJoinParams(astrLastScannedNtwrksShadow[i].pJoinParams); + wilc_free_join_params(astrLastScannedNtwrksShadow[i].pJoinParams); astrLastScannedNtwrksShadow[i].pJoinParams = NULL; } u32LastScannedNtwrksCountShadow = 0; @@ -232,7 +232,7 @@ static void remove_network_from_shadow(unsigned long arg) kfree(astrLastScannedNtwrksShadow[i].pu8IEs); astrLastScannedNtwrksShadow[i].pu8IEs = NULL; - host_int_freeJoinParams(astrLastScannedNtwrksShadow[i].pJoinParams); + wilc_free_join_params(astrLastScannedNtwrksShadow[i].pJoinParams); for (j = i; (j < u32LastScannedNtwrksCountShadow - 1); j++) { astrLastScannedNtwrksShadow[j] = astrLastScannedNtwrksShadow[j + 1]; @@ -253,7 +253,7 @@ static void remove_network_from_shadow(unsigned long arg) static void clear_duringIP(unsigned long arg) { PRINT_D(GENERIC_DBG, "GO:IP Obtained , enable scan\n"); - g_obtainingIP = false; + wilc_optaining_ip = false; } static int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid) @@ -331,7 +331,7 @@ static void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserV astrLastScannedNtwrksShadow[ap_index].u32TimeRcvdInScanCached = jiffies; astrLastScannedNtwrksShadow[ap_index].u8Found = 1; if (ap_found != -1) - host_int_freeJoinParams(astrLastScannedNtwrksShadow[ap_index].pJoinParams); + wilc_free_join_params(astrLastScannedNtwrksShadow[ap_index].pJoinParams); astrLastScannedNtwrksShadow[ap_index].pJoinParams = pJoinParams; } @@ -484,7 +484,7 @@ static void CfgScanResult(enum scan_event enuScanEvent, tstrNetworkInfo *pstrNet * @date 01 MAR 2012 * @version 1.0 */ -int connecting; +int wilc_connecting; static void CfgConnectResult(enum conn_event enuConnDisconnEvent, tstrConnectInfo *pstrConnectInfo, @@ -499,7 +499,7 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, struct wilc *wl; perInterface_wlan_t *nic; - connecting = 0; + wilc_connecting = 0; priv = (struct wilc_priv *)pUserVoid; dev = priv->dev; @@ -520,8 +520,8 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, /* The case here is that our station was waiting for association response frame and has just received it containing status code * = SUCCESSFUL_STATUSCODE, while mac status is MAC_DISCONNECTED (which means something wrong happened) */ u16ConnectStatus = WLAN_STATUS_UNSPECIFIED_FAILURE; - linux_wlan_set_bssid(priv->dev, NullBssid); - eth_zero_addr(u8ConnectedSSID); + wilc_wlan_set_bssid(priv->dev, NullBssid); + eth_zero_addr(wilc_connected_SSID); /*Invalidate u8WLANChannel value on wlan0 disconnect*/ if (!pstrWFIDrv->p2p_connect) @@ -572,15 +572,15 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, u16ConnectStatus, GFP_KERNEL); /* TODO: mostafa: u16ConnectStatus to */ /* be replaced by pstrConnectInfo->u16ConnectStatus */ } else if (enuConnDisconnEvent == CONN_DISCONN_EVENT_DISCONN_NOTIF) { - g_obtainingIP = false; + wilc_optaining_ip = false; PRINT_ER("Received MAC_DISCONNECTED from firmware with reason %d on dev [%p]\n", pstrDisconnectNotifInfo->u16reason, priv->dev); u8P2Plocalrandom = 0x01; u8P2Precvrandom = 0x00; bWilc_ie = false; eth_zero_addr(priv->au8AssociatedBss); - linux_wlan_set_bssid(priv->dev, NullBssid); - eth_zero_addr(u8ConnectedSSID); + wilc_wlan_set_bssid(priv->dev, NullBssid); + eth_zero_addr(wilc_connected_SSID); /*Invalidate u8WLANChannel value on wlan0 disconnect*/ if (!pstrWFIDrv->p2p_connect) @@ -630,7 +630,7 @@ static int set_channel(struct wiphy *wiphy, PRINT_D(CFG80211_DBG, "Setting channel %d with frequency %d\n", channelnum, chandef->chan->center_freq); curr_channel = channelnum; - result = host_int_set_mac_chnl_num(priv->hWILCWFIDrv, channelnum); + result = wilc_set_mac_chnl_num(priv->hWILCWFIDrv, channelnum); if (result != 0) PRINT_ER("Error in setting channel %d\n", channelnum); @@ -665,7 +665,7 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) priv->u32RcvdChCount = 0; - host_int_set_wfi_drv_handler(priv->hWILCWFIDrv); + wilc_set_wfi_drv_handler(priv->hWILCWFIDrv); reset_shadow_found(priv); @@ -702,13 +702,13 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) } } PRINT_D(CFG80211_DBG, "Trigger Scan Request\n"); - s32Error = host_int_scan(priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN, + s32Error = wilc_scan(priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN, au8ScanChanList, request->n_channels, (const u8 *)request->ie, request->ie_len, CfgScanResult, (void *)priv, &strHiddenNetwork); } else { PRINT_D(CFG80211_DBG, "Trigger Scan Request\n"); - s32Error = host_int_scan(priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN, + s32Error = wilc_scan(priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN, au8ScanChanList, request->n_channels, (const u8 *)request->ie, request->ie_len, CfgScanResult, (void *)priv, NULL); @@ -755,11 +755,11 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, tstrNetworkInfo *pstrNetworkInfo = NULL; - connecting = 1; + wilc_connecting = 1; priv = wiphy_priv(wiphy); pstrWFIDrv = (struct host_if_drv *)(priv->hWILCWFIDrv); - host_int_set_wfi_drv_handler(priv->hWILCWFIDrv); + wilc_set_wfi_drv_handler(priv->hWILCWFIDrv); PRINT_D(CFG80211_DBG, "Connecting to SSID [%s] on netdev [%p] host if [%p]\n", sme->ssid, dev, priv->hWILCWFIDrv); if (!(strncmp(sme->ssid, "DIRECT-", 7))) { @@ -852,8 +852,8 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, g_key_wep_params.key_idx = sme->key_idx; g_wep_keys_saved = true; - host_int_set_wep_default_key(priv->hWILCWFIDrv, sme->key_idx); - host_int_add_wep_key_bss_sta(priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx); + wilc_set_wep_default_keyid(priv->hWILCWFIDrv, sme->key_idx); + wilc_add_wep_key_bss_sta(priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx); } else if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_WEP104) { u8security = ENCRYPT_ENABLED | WEP | WEP_EXTENDED; pcgroup_encrypt_val = "WEP104"; @@ -869,8 +869,8 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, g_key_wep_params.key_idx = sme->key_idx; g_wep_keys_saved = true; - host_int_set_wep_default_key(priv->hWILCWFIDrv, sme->key_idx); - host_int_add_wep_key_bss_sta(priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx); + wilc_set_wep_default_keyid(priv->hWILCWFIDrv, sme->key_idx); + wilc_add_wep_key_bss_sta(priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx); } else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) { if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_TKIP) { u8security = ENCRYPT_ENABLED | WPA2 | TKIP; @@ -961,15 +961,15 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, if (!pstrWFIDrv->p2p_connect) u8WLANChannel = pstrNetworkInfo->u8channel; - linux_wlan_set_bssid(dev, pstrNetworkInfo->au8bssid); + wilc_wlan_set_bssid(dev, pstrNetworkInfo->au8bssid); - s32Error = host_int_set_join_req(priv->hWILCWFIDrv, pstrNetworkInfo->au8bssid, sme->ssid, + s32Error = wilc_set_join_req(priv->hWILCWFIDrv, pstrNetworkInfo->au8bssid, sme->ssid, sme->ssid_len, sme->ie, sme->ie_len, CfgConnectResult, (void *)priv, u8security, tenuAuth_type, pstrNetworkInfo->u8channel, pstrNetworkInfo->pJoinParams); if (s32Error != 0) { - PRINT_ER("host_int_set_join_req(): Error(%d)\n", s32Error); + PRINT_ER("wilc_set_join_req(): Error(%d)\n", s32Error); s32Error = -ENOENT; goto done; } @@ -996,14 +996,14 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co struct host_if_drv *pstrWFIDrv; u8 NullBssid[ETH_ALEN] = {0}; - connecting = 0; + wilc_connecting = 0; priv = wiphy_priv(wiphy); /*Invalidate u8WLANChannel value on wlan0 disconnect*/ pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv; if (!pstrWFIDrv->p2p_connect) u8WLANChannel = INVALID_CHANNEL; - linux_wlan_set_bssid(priv->dev, NullBssid); + wilc_wlan_set_bssid(priv->dev, NullBssid); PRINT_D(CFG80211_DBG, "Disconnecting with reason code(%d)\n", reason_code); @@ -1012,7 +1012,7 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co bWilc_ie = false; pstrWFIDrv->p2p_timeout = 0; - s32Error = host_int_disconnect(priv->hWILCWFIDrv, reason_code); + s32Error = wilc_disconnect(priv->hWILCWFIDrv, reason_code); if (s32Error != 0) { PRINT_ER("Error in disconnecting: Error(%d)\n", s32Error); s32Error = -EINVAL; @@ -1083,7 +1083,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, else u8mode = ENCRYPT_ENABLED | WEP | WEP_EXTENDED; - host_int_add_wep_key_bss_ap(priv->hWILCWFIDrv, params->key, params->key_len, key_index, u8mode, tenuAuth_type); + wilc_add_wep_key_bss_ap(priv->hWILCWFIDrv, params->key, params->key_len, key_index, u8mode, tenuAuth_type); break; } if (memcmp(params->key, priv->WILC_WFI_wep_key[key_index], params->key_len)) { @@ -1097,7 +1097,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, for (i = 0; i < params->key_len; i++) PRINT_INFO(CFG80211_DBG, "WEP key value[%d] = %d\n", i, params->key[i]); } - host_int_add_wep_key_bss_sta(priv->hWILCWFIDrv, params->key, params->key_len, key_index); + wilc_add_wep_key_bss_sta(priv->hWILCWFIDrv, params->key, params->key_len, key_index); } break; @@ -1160,7 +1160,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, } - host_int_add_rx_gtk(priv->hWILCWFIDrv, params->key, KeyLen, + wilc_add_rx_gtk(priv->hWILCWFIDrv, params->key, KeyLen, key_index, params->seq_len, params->seq, pu8RxMic, pu8TxMic, AP_MODE, u8gmode); } else { @@ -1205,7 +1205,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, priv->wilc_ptk[key_index]->key_len = params->key_len; priv->wilc_ptk[key_index]->seq_len = params->seq_len; - host_int_add_ptk(priv->hWILCWFIDrv, params->key, KeyLen, mac_addr, + wilc_add_ptk(priv->hWILCWFIDrv, params->key, KeyLen, mac_addr, pu8RxMic, pu8TxMic, AP_MODE, u8pmode, key_index); } break; @@ -1247,7 +1247,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, g_gtk_keys_saved = true; } - host_int_add_rx_gtk(priv->hWILCWFIDrv, params->key, KeyLen, + wilc_add_rx_gtk(priv->hWILCWFIDrv, params->key, KeyLen, key_index, params->seq_len, params->seq, pu8RxMic, pu8TxMic, STATION_MODE, u8mode); } else { if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) { @@ -1283,7 +1283,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, g_ptk_keys_saved = true; } - host_int_add_ptk(priv->hWILCWFIDrv, params->key, KeyLen, mac_addr, + wilc_add_ptk(priv->hWILCWFIDrv, params->key, KeyLen, mac_addr, pu8RxMic, pu8TxMic, STATION_MODE, u8mode, key_index); PRINT_D(CFG80211_DBG, "Adding pairwise key\n"); if (INFO) { @@ -1372,7 +1372,7 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev, g_key_gtk_params.seq = NULL; /*Reset WILC_CHANGING_VIR_IF register to allow adding futrue keys to CE H/W*/ - set_machw_change_vir_if(netdev, false); + wilc_set_machw_change_vir_if(netdev, false); } if (key_index >= 0 && key_index <= 3) { @@ -1380,10 +1380,10 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev, priv->WILC_WFI_wep_key_len[key_index] = 0; PRINT_D(CFG80211_DBG, "Removing WEP key with index = %d\n", key_index); - host_int_remove_wep_key(priv->hWILCWFIDrv, key_index); + wilc_remove_wep_key(priv->hWILCWFIDrv, key_index); } else { PRINT_D(CFG80211_DBG, "Removing all installed keys\n"); - host_int_remove_key(priv->hWILCWFIDrv, mac_addr); + wilc_remove_key(priv->hWILCWFIDrv, mac_addr); } return 0; @@ -1461,7 +1461,7 @@ static int set_default_key(struct wiphy *wiphy, struct net_device *netdev, u8 ke if (key_index != priv->WILC_WFI_wep_default) { - host_int_set_wep_default_key(priv->hWILCWFIDrv, key_index); + wilc_set_wep_default_keyid(priv->hWILCWFIDrv, key_index); } return 0; @@ -1509,7 +1509,7 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, sinfo->filled |= BIT(NL80211_STA_INFO_INACTIVE_TIME); - host_int_get_inactive_time(priv->hWILCWFIDrv, mac, &(inactive_time)); + wilc_get_inactive_time(priv->hWILCWFIDrv, mac, &(inactive_time)); sinfo->inactive_time = 1000 * inactive_time; PRINT_D(CFG80211_DBG, "Inactive time %d\n", sinfo->inactive_time); @@ -1518,7 +1518,7 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, if (nic->iftype == STATION_MODE) { struct rf_info strStatistics; - host_int_get_statistics(priv->hWILCWFIDrv, &strStatistics); + wilc_get_statistics(priv->hWILCWFIDrv, &strStatistics); sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL) | BIT(NL80211_STA_INFO_RX_PACKETS) | @@ -1534,9 +1534,9 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, if ((strStatistics.link_speed > TCP_ACK_FILTER_LINK_SPEED_THRESH) && (strStatistics.link_speed != DEFAULT_LINK_SPEED)) - enable_tcp_ack_filter(true); + wilc_enable_tcp_ack_filter(true); else if (strStatistics.link_speed != DEFAULT_LINK_SPEED) - enable_tcp_ack_filter(false); + wilc_enable_tcp_ack_filter(false); PRINT_D(CORECONFIG_DBG, "*** stats[%d][%d][%d][%d][%d]\n", sinfo->signal, sinfo->rx_packets, sinfo->tx_packets, sinfo->tx_failed, sinfo->txrate.legacy); @@ -1623,7 +1623,7 @@ static int set_wiphy_params(struct wiphy *wiphy, u32 changed) } PRINT_D(CFG80211_DBG, "Setting CFG params in the host interface\n"); - s32Error = hif_set_cfg(priv->hWILCWFIDrv, &pstrCfgParamVal); + s32Error = wilc_hif_set_cfg(priv->hWILCWFIDrv, &pstrCfgParamVal); if (s32Error) PRINT_ER("Error in setting WIPHY PARAMS\n"); @@ -1678,7 +1678,7 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev, if (!s32Error) { PRINT_D(CFG80211_DBG, "Setting pmkid in the host interface\n"); - s32Error = host_int_set_pmkid_info(priv->hWILCWFIDrv, &priv->pmkid_list); + s32Error = wilc_set_pmkid_info(priv->hWILCWFIDrv, &priv->pmkid_list); } return s32Error; } @@ -2101,7 +2101,7 @@ static int remain_on_channel(struct wiphy *wiphy, priv->strRemainOnChanParams.u32ListenDuration = duration; priv->strRemainOnChanParams.u32ListenSessionID++; - s32Error = host_int_remain_on_channel(priv->hWILCWFIDrv + s32Error = wilc_remain_on_channel(priv->hWILCWFIDrv , priv->strRemainOnChanParams.u32ListenSessionID , duration , chan->hw_value @@ -2136,7 +2136,7 @@ static int cancel_remain_on_channel(struct wiphy *wiphy, PRINT_D(CFG80211_DBG, "Cancel remain on channel\n"); - s32Error = host_int_ListenStateExpired(priv->hWILCWFIDrv, priv->strRemainOnChanParams.u32ListenSessionID); + s32Error = wilc_listen_state_expired(priv->hWILCWFIDrv, priv->strRemainOnChanParams.u32ListenSessionID); return s32Error; } /** @@ -2149,7 +2149,7 @@ static int cancel_remain_on_channel(struct wiphy *wiphy, * @date 01 JUL 2012 * @version */ -extern bool bEnablePS; +extern bool wilc_enable_ps; static int mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, struct cfg80211_mgmt_tx_params *params, @@ -2196,7 +2196,7 @@ static int mgmt_tx(struct wiphy *wiphy, if (ieee80211_is_probe_resp(mgmt->frame_control)) { PRINT_D(GENERIC_DBG, "TX: Probe Response\n"); PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value); - host_int_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value); + wilc_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value); /*Save the current channel after we tune to it*/ curr_channel = chan->hw_value; } else if (ieee80211_is_action(mgmt->frame_control)) { @@ -2211,7 +2211,7 @@ static int mgmt_tx(struct wiphy *wiphy, if (buf[ACTION_SUBTYPE_ID] != PUBLIC_ACT_VENDORSPEC || buf[P2P_PUB_ACTION_SUBTYPE] != GO_NEG_CONF) { PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value); - host_int_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value); + wilc_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value); /*Save the current channel after we tune to it*/ curr_channel = chan->hw_value; } @@ -2383,7 +2383,7 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev, PRINT_D(GENERIC_DBG, "Return since mac is closed\n"); return; } - host_int_frame_register(priv->hWILCWFIDrv, frame_type, reg); + wilc_frame_register(priv->hWILCWFIDrv, frame_type, reg); } @@ -2434,7 +2434,7 @@ static int dump_station(struct wiphy *wiphy, struct net_device *dev, sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); - host_int_get_rssi(priv->hWILCWFIDrv, &(sinfo->signal)); + wilc_get_rssi(priv->hWILCWFIDrv, &(sinfo->signal)); return 0; @@ -2466,8 +2466,8 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, return -EIO; } - if (bEnablePS) - host_int_set_power_mgmt(priv->hWILCWFIDrv, enabled, timeout); + if (wilc_enable_ps) + wilc_set_power_mgmt(priv->hWILCWFIDrv, enabled, timeout); return 0; @@ -2507,17 +2507,17 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, bWilc_ie = false; - g_obtainingIP = false; - del_timer(&hDuringIpTimer); + wilc_optaining_ip = false; + del_timer(&wilc_during_ip_timer); PRINT_D(GENERIC_DBG, "Changing virtual interface, enable scan\n"); /*Set WILC_CHANGING_VIR_IF register to disallow adding futrue keys to CE H/W*/ if (g_ptk_keys_saved && g_gtk_keys_saved) { - set_machw_change_vir_if(dev, true); + wilc_set_machw_change_vir_if(dev, true); } switch (type) { case NL80211_IFTYPE_STATION: - connecting = 0; + wilc_connecting = 0; PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_STATION\n"); /* send delba over wlan interface */ @@ -2534,30 +2534,30 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, nic->iftype = STATION_MODE; if (wl->initialized) { - host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, - wl->vif[0].bssid, TID); + wilc_del_all_rx_ba_session(priv->hWILCWFIDrv, + wl->vif[0].bssid, TID); /* ensure that the message Q is empty */ - host_int_wait_msg_queue_idle(); + wilc_wait_msg_queue_idle(); /*Eliminate host interface blocking state*/ up(&wl->cfg_event); wilc1000_wlan_deinit(dev); wilc1000_wlan_init(dev, nic); - g_wilc_initialized = 1; + wilc_initialized = 1; nic->iftype = interface_type; /*Setting interface 1 drv handler and mac address in newly downloaded FW*/ - host_int_set_wfi_drv_handler(wl->vif[0].hif_drv); - host_int_set_MacAddress(wl->vif[0].hif_drv, + wilc_set_wfi_drv_handler(wl->vif[0].hif_drv); + wilc_set_mac_address(wl->vif[0].hif_drv, wl->vif[0].src_addr); - host_int_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE); + wilc_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE); /*Add saved WEP keys, if any*/ if (g_wep_keys_saved) { - host_int_set_wep_default_key(wl->vif[0].hif_drv, + wilc_set_wep_default_keyid(wl->vif[0].hif_drv, g_key_wep_params.key_idx); - host_int_add_wep_key_bss_sta(wl->vif[0].hif_drv, + wilc_add_wep_key_bss_sta(wl->vif[0].hif_drv, g_key_wep_params.key, g_key_wep_params.key_len, g_key_wep_params.key_idx); @@ -2565,7 +2565,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, /*No matter the driver handler passed here, it will be overwriiten*/ /*in Handle_FlushConnect() with gu8FlushedJoinReqDrvHandler*/ - host_int_flush_join_req(priv->hWILCWFIDrv); + wilc_flush_join_req(priv->hWILCWFIDrv); /*Add saved PTK and GTK keys, if any*/ if (g_ptk_keys_saved && g_gtk_keys_saved) { @@ -2594,25 +2594,25 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, for (i = 0; i < num_reg_frame; i++) { PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type, nic->g_struct_frame_reg[i].reg); - host_int_frame_register(priv->hWILCWFIDrv, + wilc_frame_register(priv->hWILCWFIDrv, nic->g_struct_frame_reg[i].frame_type, nic->g_struct_frame_reg[i].reg); } } - bEnablePS = true; - host_int_set_power_mgmt(priv->hWILCWFIDrv, 1, 0); + wilc_enable_ps = true; + wilc_set_power_mgmt(priv->hWILCWFIDrv, 1, 0); } break; case NL80211_IFTYPE_P2P_CLIENT: - bEnablePS = false; - host_int_set_power_mgmt(priv->hWILCWFIDrv, 0, 0); - connecting = 0; + wilc_enable_ps = false; + wilc_set_power_mgmt(priv->hWILCWFIDrv, 0, 0); + wilc_connecting = 0; PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_P2P_CLIENT\n"); - host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, - wl->vif[0].bssid, TID); + wilc_del_all_rx_ba_session(priv->hWILCWFIDrv, + wl->vif[0].bssid, TID); dev->ieee80211_ptr->iftype = type; priv->wdev->iftype = type; @@ -2624,30 +2624,30 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, if (wl->initialized) { /* ensure that the message Q is empty */ - host_int_wait_msg_queue_idle(); + wilc_wait_msg_queue_idle(); wilc1000_wlan_deinit(dev); wilc1000_wlan_init(dev, nic); - g_wilc_initialized = 1; + wilc_initialized = 1; - host_int_set_wfi_drv_handler(wl->vif[0].hif_drv); - host_int_set_MacAddress(wl->vif[0].hif_drv, + wilc_set_wfi_drv_handler(wl->vif[0].hif_drv); + wilc_set_mac_address(wl->vif[0].hif_drv, wl->vif[0].src_addr); - host_int_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE); + wilc_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE); /*Add saved WEP keys, if any*/ if (g_wep_keys_saved) { - host_int_set_wep_default_key(wl->vif[0].hif_drv, - g_key_wep_params.key_idx); - host_int_add_wep_key_bss_sta(wl->vif[0].hif_drv, - g_key_wep_params.key, - g_key_wep_params.key_len, - g_key_wep_params.key_idx); + wilc_set_wep_default_keyid(wl->vif[0].hif_drv, + g_key_wep_params.key_idx); + wilc_add_wep_key_bss_sta(wl->vif[0].hif_drv, + g_key_wep_params.key, + g_key_wep_params.key_len, + g_key_wep_params.key_idx); } /*No matter the driver handler passed here, it will be overwriiten*/ /*in Handle_FlushConnect() with gu8FlushedJoinReqDrvHandler*/ - host_int_flush_join_req(priv->hWILCWFIDrv); + wilc_flush_join_req(priv->hWILCWFIDrv); /*Add saved PTK and GTK keys, if any*/ if (g_ptk_keys_saved && g_gtk_keys_saved) { @@ -2674,13 +2674,13 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, /*Refresh scan, to refresh the scan results to the wpa_supplicant. Set MachHw to false to enable further key installments*/ refresh_scan(priv, 1, true); - set_machw_change_vir_if(dev, false); + wilc_set_machw_change_vir_if(dev, false); if (wl->initialized) { for (i = 0; i < num_reg_frame; i++) { PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type, nic->g_struct_frame_reg[i].reg); - host_int_frame_register(priv->hWILCWFIDrv, + wilc_frame_register(priv->hWILCWFIDrv, nic->g_struct_frame_reg[i].frame_type, nic->g_struct_frame_reg[i].reg); } @@ -2689,7 +2689,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, break; case NL80211_IFTYPE_AP: - bEnablePS = false; + wilc_enable_ps = false; PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_AP %d\n", type); dev->ieee80211_ptr->iftype = type; priv->wdev->iftype = type; @@ -2697,17 +2697,17 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, PRINT_D(CORECONFIG_DBG, "priv->hWILCWFIDrv[%p]\n", priv->hWILCWFIDrv); PRINT_D(HOSTAPD_DBG, "Downloading AP firmware\n"); - linux_wlan_get_firmware(dev); + wilc_wlan_get_firmware(dev); /*If wilc is running, then close-open to actually get new firmware running (serves P2P)*/ if (wl->initialized) { nic->iftype = AP_MODE; - mac_close(dev); - mac_open(dev); + wilc_mac_close(dev); + wilc_mac_open(dev); for (i = 0; i < num_reg_frame; i++) { PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type, nic->g_struct_frame_reg[i].reg); - host_int_frame_register(priv->hWILCWFIDrv, + wilc_frame_register(priv->hWILCWFIDrv, nic->g_struct_frame_reg[i].frame_type, nic->g_struct_frame_reg[i].reg); } @@ -2717,16 +2717,16 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, case NL80211_IFTYPE_P2P_GO: PRINT_D(GENERIC_DBG, "start duringIP timer\n"); - g_obtainingIP = true; - mod_timer(&hDuringIpTimer, jiffies + msecs_to_jiffies(duringIP_TIME)); - host_int_set_power_mgmt(priv->hWILCWFIDrv, 0, 0); + wilc_optaining_ip = true; + mod_timer(&wilc_during_ip_timer, jiffies + msecs_to_jiffies(duringIP_TIME)); + wilc_set_power_mgmt(priv->hWILCWFIDrv, 0, 0); /*Delete block ack has to be the latest config packet*/ /*sent before downloading new FW. This is because it blocks on*/ /*hWaitResponse semaphore, which allows previous config*/ /*packets to actually take action on old FW*/ - host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, - wl->vif[0].bssid, TID); - bEnablePS = false; + wilc_del_all_rx_ba_session(priv->hWILCWFIDrv, + wl->vif[0].bssid, TID); + wilc_enable_ps = false; PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_GO\n"); dev->ieee80211_ptr->iftype = type; priv->wdev->iftype = type; @@ -2739,23 +2739,23 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, nic->iftype = GO_MODE; /* ensure that the message Q is empty */ - host_int_wait_msg_queue_idle(); + wilc_wait_msg_queue_idle(); wilc1000_wlan_deinit(dev); wilc1000_wlan_init(dev, nic); - g_wilc_initialized = 1; + wilc_initialized = 1; /*Setting interface 1 drv handler and mac address in newly downloaded FW*/ - host_int_set_wfi_drv_handler(wl->vif[0].hif_drv); - host_int_set_MacAddress(wl->vif[0].hif_drv, - wl->vif[0].src_addr); - host_int_set_operation_mode(priv->hWILCWFIDrv, AP_MODE); + wilc_set_wfi_drv_handler(wl->vif[0].hif_drv); + wilc_set_mac_address(wl->vif[0].hif_drv, + wl->vif[0].src_addr); + wilc_set_operation_mode(priv->hWILCWFIDrv, AP_MODE); /*Add saved WEP keys, if any*/ if (g_wep_keys_saved) { - host_int_set_wep_default_key(wl->vif[0].hif_drv, - g_key_wep_params.key_idx); - host_int_add_wep_key_bss_sta(wl->vif[0].hif_drv, + wilc_set_wep_default_keyid(wl->vif[0].hif_drv, + g_key_wep_params.key_idx); + wilc_add_wep_key_bss_sta(wl->vif[0].hif_drv, g_key_wep_params.key, g_key_wep_params.key_len, g_key_wep_params.key_idx); @@ -2763,7 +2763,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, /*No matter the driver handler passed here, it will be overwriiten*/ /*in Handle_FlushConnect() with gu8FlushedJoinReqDrvHandler*/ - host_int_flush_join_req(priv->hWILCWFIDrv); + wilc_flush_join_req(priv->hWILCWFIDrv); /*Add saved PTK and GTK keys, if any*/ if (g_ptk_keys_saved && g_gtk_keys_saved) { @@ -2794,7 +2794,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, for (i = 0; i < num_reg_frame; i++) { PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type, nic->g_struct_frame_reg[i].reg); - host_int_frame_register(priv->hWILCWFIDrv, + wilc_frame_register(priv->hWILCWFIDrv, nic->g_struct_frame_reg[i].frame_type, nic->g_struct_frame_reg[i].reg); } @@ -2857,9 +2857,9 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev, if (s32Error != 0) PRINT_ER("Error in setting channel\n"); - linux_wlan_set_bssid(dev, wl->vif[0].src_addr); + wilc_wlan_set_bssid(dev, wl->vif[0].src_addr); - s32Error = host_int_add_beacon(priv->hWILCWFIDrv, + s32Error = wilc_add_beacon(priv->hWILCWFIDrv, settings->beacon_interval, settings->dtim_period, beacon->head_len, (u8 *)beacon->head, @@ -2890,7 +2890,7 @@ static int change_beacon(struct wiphy *wiphy, struct net_device *dev, PRINT_D(HOSTAPD_DBG, "Setting beacon\n"); - s32Error = host_int_add_beacon(priv->hWILCWFIDrv, + s32Error = wilc_add_beacon(priv->hWILCWFIDrv, 0, 0, beacon->head_len, (u8 *)beacon->head, @@ -2921,9 +2921,9 @@ static int stop_ap(struct wiphy *wiphy, struct net_device *dev) PRINT_D(HOSTAPD_DBG, "Deleting beacon\n"); - linux_wlan_set_bssid(dev, NullBssid); + wilc_wlan_set_bssid(dev, NullBssid); - s32Error = host_int_del_beacon(priv->hWILCWFIDrv); + s32Error = wilc_del_beacon(priv->hWILCWFIDrv); if (s32Error) PRINT_ER("Host delete beacon fail\n"); @@ -3003,7 +3003,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n", strStaParams.flags_set); - s32Error = host_int_add_station(priv->hWILCWFIDrv, &strStaParams); + s32Error = wilc_add_station(priv->hWILCWFIDrv, &strStaParams); if (s32Error) PRINT_ER("Host add station fail\n"); } @@ -3040,12 +3040,12 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev, if (mac == NULL) { PRINT_D(HOSTAPD_DBG, "All associated stations\n"); - s32Error = host_int_del_allstation(priv->hWILCWFIDrv, priv->assoc_stainfo.au8Sta_AssociatedBss); + s32Error = wilc_del_allstation(priv->hWILCWFIDrv, priv->assoc_stainfo.au8Sta_AssociatedBss); } else { PRINT_D(HOSTAPD_DBG, "With mac address: %x%x%x%x%x%x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); } - s32Error = host_int_del_station(priv->hWILCWFIDrv, mac); + s32Error = wilc_del_station(priv->hWILCWFIDrv, mac); if (s32Error) PRINT_ER("Host delete station fail\n"); @@ -3127,7 +3127,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n", strStaParams.flags_set); - s32Error = host_int_edit_station(priv->hWILCWFIDrv, &strStaParams); + s32Error = wilc_edit_station(priv->hWILCWFIDrv, &strStaParams); if (s32Error) PRINT_ER("Host edit station fail\n"); } @@ -3387,7 +3387,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net) wdev->wiphy->interface_modes, wdev->iftype); #ifdef WILC_SDIO - set_wiphy_dev(wdev->wiphy, &local_sdio_func->dev); + set_wiphy_dev(wdev->wiphy, &wilc_sdio_func->dev); #endif /*Register wiphy structure*/ @@ -3424,7 +3424,7 @@ int wilc_init_host_int(struct net_device *net) priv = wdev_priv(net->ieee80211_ptr); if (op_ifcs == 0) { setup_timer(&hAgingTimer, remove_network_from_shadow, 0); - setup_timer(&hDuringIpTimer, clear_duringIP, 0); + setup_timer(&wilc_during_ip_timer, clear_duringIP, 0); } op_ifcs++; if (s32Error < 0) { @@ -3437,7 +3437,7 @@ int wilc_init_host_int(struct net_device *net) priv->bInP2PlistenState = false; sema_init(&(priv->hSemScanReq), 1); - s32Error = host_int_init(net, &priv->hWILCWFIDrv); + s32Error = wilc_init(net, &priv->hWILCWFIDrv); if (s32Error) PRINT_ER("Error while initializing hostinterface\n"); @@ -3467,13 +3467,13 @@ int wilc_deinit_host_int(struct net_device *net) op_ifcs--; - s32Error = host_int_deinit(priv->hWILCWFIDrv); + s32Error = wilc_deinit(priv->hWILCWFIDrv); /* Clear the Shadow scan */ clear_shadow_scan(priv); if (op_ifcs == 0) { PRINT_D(CORECONFIG_DBG, "destroy during ip\n"); - del_timer_sync(&hDuringIpTimer); + del_timer_sync(&wilc_during_ip_timer); } if (s32Error) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h index 9f9a9aeb3655..5262b2513fa8 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h @@ -103,6 +103,6 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev, #define TCP_ACK_FILTER_LINK_SPEED_THRESH 54 #define DEFAULT_LINK_SPEED 72 -void enable_tcp_ack_filter(bool value); +void wilc_enable_tcp_ack_filter(bool value); #endif diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 54ed72336775..2a0a3b166a7c 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -206,7 +206,7 @@ struct WILC_WFI_mon_priv { struct net_device *real_ndev; }; -extern struct wilc *g_linux_wlan; +extern struct wilc *wilc_dev; extern struct net_device *WILC_WFI_devs[]; void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset); void linux_wlan_mac_indicate(struct wilc *wilc, int flag); @@ -217,7 +217,7 @@ void wl_wlan_cleanup(struct wilc *wilc); int wilc_netdev_init(struct wilc **wilc); void wilc1000_wlan_deinit(struct net_device *dev); void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size); -u16 set_machw_change_vir_if(struct net_device *dev, bool value); -int linux_wlan_get_firmware(struct net_device *dev); -int linux_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid); +u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value); +int wilc_wlan_get_firmware(struct net_device *dev); +int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid); #endif diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 5c8c59257f58..a797c61e8061 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -3,9 +3,9 @@ #include "wilc_wlan_cfg.h" #ifdef WILC_SDIO -extern struct wilc_hif_func hif_sdio; +extern struct wilc_hif_func wilc_hif_sdio; #else -extern struct wilc_hif_func hif_spi; +extern struct wilc_hif_func wilc_hif_spi; #endif u32 wilc_get_chipid(u8 update); @@ -64,7 +64,7 @@ static CHIP_PS_STATE_T chip_ps_state = CHIP_WAKEDUP; static inline void acquire_bus(BUS_ACQUIRE_T acquire) { - mutex_lock(&g_linux_wlan->hif_cs); + mutex_lock(&wilc_dev->hif_cs); #ifndef WILC_OPTIMIZE_SLEEP_INT if (chip_ps_state != CHIP_WAKEDUP) #endif @@ -80,7 +80,7 @@ static inline void release_bus(BUS_RELEASE_T release) if (release == RELEASE_ALLOW_SLEEP) chip_allow_sleep(); #endif - mutex_unlock(&g_linux_wlan->hif_cs); + mutex_unlock(&wilc_dev->hif_cs); } #ifdef TCP_ACK_FILTER @@ -169,11 +169,11 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe) { wilc_wlan_dev_t *p = &g_wlan; unsigned long flags; - if (linux_wlan_lock_timeout(&g_linux_wlan->txq_add_to_head_cs, + if (linux_wlan_lock_timeout(&wilc_dev->txq_add_to_head_cs, CFG_PKTS_TIMEOUT)) return -1; - spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags); + spin_lock_irqsave(&wilc_dev->txq_spinlock, flags); if (!p->txq_head) { tqe->next = NULL; @@ -189,9 +189,9 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe) p->txq_entries += 1; PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", p->txq_entries); - spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags); - up(&g_linux_wlan->txq_add_to_head_cs); - up(&g_linux_wlan->txq_event); + spin_unlock_irqrestore(&wilc_dev->txq_spinlock, flags); + up(&wilc_dev->txq_add_to_head_cs); + up(&wilc_dev->txq_event); PRINT_D(TX_DBG, "Wake up the txq_handler\n"); return 0; @@ -266,9 +266,9 @@ static inline int remove_TCP_related(void) wilc_wlan_dev_t *p = &g_wlan; unsigned long flags; - spin_lock_irqsave(&g_linux_wlan->txq_spinlock, flags); + spin_lock_irqsave(&wilc_dev->txq_spinlock, flags); - spin_unlock_irqrestore(&g_linux_wlan->txq_spinlock, flags); + spin_unlock_irqrestore(&wilc_dev->txq_spinlock, flags); return 0; } @@ -393,7 +393,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) static bool enabled = false; -void enable_tcp_ack_filter(bool value) +void wilc_enable_tcp_ack_filter(bool value) { enabled = value; } @@ -413,7 +413,7 @@ static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 buffer_size) PRINT_D(TX_DBG, "Adding config packet ...\n"); if (p->quit) { PRINT_D(TX_DBG, "Return due to clear function\n"); - up(&g_linux_wlan->cfg_event); + up(&wilc_dev->cfg_event); return 0; } @@ -684,7 +684,7 @@ static inline void chip_wakeup(void) chip_ps_state = CHIP_WAKEDUP; } #endif -void chip_sleep_manually(void) +void wilc_chip_sleep_manually(void) { if (chip_ps_state != CHIP_WAKEDUP) return; @@ -1520,7 +1520,7 @@ int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, if (wilc_wlan_cfg_commit(WILC_CFG_SET, drv_handler)) ret_size = 0; - if (linux_wlan_lock_timeout(&g_linux_wlan->cfg_event, + if (linux_wlan_lock_timeout(&wilc_dev->cfg_event, CFG_PKTS_TIMEOUT)) { PRINT_D(TX_DBG, "Set Timed Out\n"); ret_size = 0; @@ -1556,7 +1556,7 @@ int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drv_handler) if (wilc_wlan_cfg_commit(WILC_CFG_QUERY, drv_handler)) ret_size = 0; - if (linux_wlan_lock_timeout(&g_linux_wlan->cfg_event, + if (linux_wlan_lock_timeout(&wilc_dev->cfg_event, CFG_PKTS_TIMEOUT)) { PRINT_D(TX_DBG, "Get Timed Out\n"); ret_size = 0; @@ -1670,18 +1670,18 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) sizeof(wilc_wlan_io_func_t)); #ifdef WILC_SDIO - if (!hif_sdio.hif_init(wilc, wilc_debug)) { + if (!wilc_hif_sdio.hif_init(wilc, wilc_debug)) { ret = -EIO; goto _fail_; } - memcpy((void *)&g_wlan.hif_func, &hif_sdio, + memcpy((void *)&g_wlan.hif_func, &wilc_hif_sdio, sizeof(struct wilc_hif_func)); #else - if (!hif_spi.hif_init(wilc, wilc_debug)) { + if (!wilc_hif_spi.hif_init(wilc, wilc_debug)) { ret = -EIO; goto _fail_; } - memcpy((void *)&g_wlan.hif_func, &hif_spi, + memcpy((void *)&g_wlan.hif_func, &wilc_hif_spi, sizeof(struct wilc_hif_func)); #endif @@ -1733,7 +1733,7 @@ _fail_: return ret; } -u16 set_machw_change_vir_if(struct net_device *dev, bool value) +u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value) { u16 ret; u32 reg; diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 64fd019595ce..6cb6abe26096 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -290,5 +290,5 @@ int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drv_handler); int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size); int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, u32 buffer_size, wilc_tx_complete_func_t func); -void chip_sleep_manually(void); +void wilc_chip_sleep_manually(void); #endif diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c index e23796392e9c..274052f36400 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.c +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c @@ -532,17 +532,17 @@ int wilc_wlan_cfg_indicate_rx(u8 *frame, int size, struct wilc_cfg_rsp *rsp) rsp->seq_no = msg_id; /*call host interface info parse as well*/ PRINT_INFO(RX_DBG, "Info message received\n"); - GnrlAsyncInfoReceived(frame - 4, size + 4); + wilc_gnrl_async_info_received(frame - 4, size + 4); break; case 'N': - NetworkInfoReceived(frame - 4, size + 4); + wilc_network_info_received(frame - 4, size + 4); rsp->type = 0; break; case 'S': PRINT_INFO(RX_DBG, "Scan Notification Received\n"); - host_int_ScanCompleteReceived(frame - 4, size + 4); + wilc_scan_complete_received(frame - 4, size + 4); break; default: From 491880eb47a693bb194096eec094b2166d2b2354 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 16 Nov 2015 15:04:55 +0100 Subject: [PATCH 536/843] staging/wilc1000: move extern declarations to headers 'extern' declarations belong into a header file rather than a .c file, to ensure that the definition matches the declaration. This moves all declarations into a header file that seems most appropriate for it. Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 9 +------- drivers/staging/wilc1000/host_interface.h | 9 ++++++++ drivers/staging/wilc1000/linux_mon.c | 3 --- drivers/staging/wilc1000/linux_wlan.c | 9 -------- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +----- .../staging/wilc1000/wilc_wfi_cfgoperations.h | 1 - drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 ++ drivers/staging/wilc1000/wilc_wlan.c | 8 +------ drivers/staging/wilc1000/wilc_wlan.h | 21 +++++++++++++++++++ 9 files changed, 35 insertions(+), 33 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 228a2fefe714..d968483c6f00 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4,17 +4,12 @@ #include #include "host_interface.h" #include "coreconfigurator.h" +#include "wilc_wlan.h" #include "wilc_wlan_if.h" #include "wilc_msgqueue.h" #include #include "wilc_wfi_netdevice.h" -extern u8 wilc_connecting; - -extern struct timer_list wilc_during_ip_timer; - -extern u8 wilc_initialized; - #define HOST_IF_MSG_SCAN 0 #define HOST_IF_MSG_CONNECT 1 #define HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO 2 @@ -271,8 +266,6 @@ static struct host_if_drv *join_req_drv; static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo); -extern int wilc_wlan_get_num_conn_ifcs(void); - static int add_handler_in_list(struct host_if_drv *handler) { int i; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index d0b85a53c29e..efeb9e233589 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -394,4 +394,13 @@ void wilc_free_join_params(void *pJoinParams); s32 wilc_get_statistics(struct host_if_drv *hWFIDrv, struct rf_info *pstrStatistics); void wilc_resolve_disconnect_aberration(struct host_if_drv *hif_drv); + +extern bool wilc_optaining_ip; +extern u8 wilc_connected_SSID[6]; +extern u8 wilc_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; + +extern int wilc_connecting; +extern u8 wilc_initialized; +extern struct timer_list wilc_during_ip_timer; + #endif diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c index f0a458764ff2..e550027645b7 100644 --- a/drivers/staging/wilc1000/linux_mon.c +++ b/drivers/staging/wilc1000/linux_mon.c @@ -26,9 +26,6 @@ struct wilc_wfi_radiotap_cb_hdr { static struct net_device *wilc_wfi_mon; /* global monitor netdev */ -extern int wilc_mac_xmit(struct sk_buff *skb, struct net_device *dev); - - static u8 srcAdd[6]; static u8 bssid[6]; static u8 broadcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index d3d07fc30e23..f1e70b225deb 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -37,10 +37,6 @@ #define _linux_wlan_device_detection() {} #define _linux_wlan_device_removal() {} -extern bool wilc_optaining_ip; -extern u8 wilc_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; -extern struct timer_list wilc_during_ip_timer; - static int linux_wlan_device_power(int on_off) { PRINT_D(INIT_DBG, "linux_wlan_device_power.. (%d)\n", on_off); @@ -81,14 +77,9 @@ static struct semaphore close_exit_sync; static int wlan_deinit_locks(struct net_device *dev); static void wlan_deinitialize_threads(struct net_device *dev); -extern void WILC_WFI_monitor_rx(u8 *buff, u32 size); -extern void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size); static void linux_wlan_tx_complete(void *priv, int status); static int mac_init_fn(struct net_device *ndev); -int wilc_mac_xmit(struct sk_buff *skb, struct net_device *dev); -int wilc_mac_open(struct net_device *ndev); -int wilc_mac_close(struct net_device *ndev); static struct net_device_stats *mac_stats(struct net_device *dev); static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd); static void wilc_set_multicast_list(struct net_device *dev); diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index f8fd7a895d44..49b82b4a0688 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -14,6 +14,7 @@ #ifdef WILC_SDIO #include "linux_wlan_sdio.h" #endif +#include "host_interface.h" #include #define IS_MANAGMEMENT 0x100 @@ -29,10 +30,8 @@ static u32 u32LastScannedNtwrksCountShadow; struct timer_list wilc_during_ip_timer; static struct timer_list hAgingTimer; static u8 op_ifcs; -extern u8 wilc_connected_SSID[6]; u8 wilc_initialized = 1; -extern bool wilc_optaining_ip; #define CHAN2G(_channel, _freq, _flags) { \ .band = IEEE80211_BAND_2GHZ, \ @@ -2149,7 +2148,6 @@ static int cancel_remain_on_channel(struct wiphy *wiphy, * @date 01 JUL 2012 * @version */ -extern bool wilc_enable_ps; static int mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, struct cfg80211_mgmt_tx_params *params, @@ -2484,8 +2482,6 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, * @date 01 MAR 2012 * @version 1.0 */ -int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic); - static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, enum nl80211_iftype type, u32 *flags, struct vif_params *params) { diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h index 5262b2513fa8..ae2aaea508db 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h @@ -103,6 +103,5 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev, #define TCP_ACK_FILTER_LINK_SPEED_THRESH 54 #define DEFAULT_LINK_SPEED 72 -void wilc_enable_tcp_ack_filter(bool value); #endif diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 2a0a3b166a7c..3358fe3bcd0a 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -206,6 +206,8 @@ struct WILC_WFI_mon_priv { struct net_device *real_ndev; }; +int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic); + extern struct wilc *wilc_dev; extern struct net_device *WILC_WFI_devs[]; void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset); diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index a797c61e8061..f7359f79ff8d 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1,14 +1,8 @@ #include "wilc_wlan_if.h" +#include "wilc_wlan.h" #include "wilc_wfi_netdevice.h" #include "wilc_wlan_cfg.h" -#ifdef WILC_SDIO -extern struct wilc_hif_func wilc_hif_sdio; -#else -extern struct wilc_hif_func wilc_hif_spi; -#endif -u32 wilc_get_chipid(u8 update); - typedef struct { int quit; wilc_wlan_io_func_t io_func; diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 6cb6abe26096..326d71bf91df 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -1,7 +1,10 @@ #ifndef WILC_WLAN_H #define WILC_WLAN_H +#include + #define ISWILC1000(id) ((id & 0xfffff000) == 0x100000 ? 1 : 0) + /******************************************** * * Mac eth header length @@ -255,6 +258,9 @@ struct wilc_hif_func { void (*hif_set_default_bus_speed)(void); }; +extern struct wilc_hif_func wilc_hif_spi; +extern struct wilc_hif_func wilc_hif_sdio; + /******************************************** * * Configuration Structure @@ -276,6 +282,8 @@ struct wilc_cfg_rsp { u32 seq_no; }; +struct wilc; + int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size); int wilc_wlan_start(void); int wilc_wlan_stop(void); @@ -291,4 +299,17 @@ int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size); int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, u32 buffer_size, wilc_tx_complete_func_t func); void wilc_chip_sleep_manually(void); + +void wilc_enable_tcp_ack_filter(bool value); +int wilc_wlan_get_num_conn_ifcs(void); +int wilc_mac_xmit(struct sk_buff *skb, struct net_device *dev); + +int wilc_mac_open(struct net_device *ndev); +int wilc_mac_close(struct net_device *ndev); + +int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *pBSSID); +void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size); + +extern bool wilc_enable_ps; + #endif From b4d04c15e17156f18a57576d9e958792add30a6a Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 16 Nov 2015 15:04:56 +0100 Subject: [PATCH 537/843] staging/wilc1000: use NO_SECURITY instead of NO_ENCRYPT The linux_wlan.c file uses a set of enums from wilc_wlan_if.h, with the exception of the NO_ENCRYPT that comes from wilc_wfi_cfgoperations.h. The two sets of enums clearly have the same intention but are defined a bit different. To prepare to clean up the ones in wilc_wfi_cfgoperations.h, this first changes over the only other user. Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index f1e70b225deb..040caa0d0d0b 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -643,7 +643,7 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni if (!wilc_wlan_cfg_set(0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0)) goto _fail_; - c_val[0] = NO_ENCRYPT; + c_val[0] = NO_SECURITY; /* NO_ENCRYPT, 0x79 */ if (!wilc_wlan_cfg_set(0, WID_11I_MODE, c_val, 1, 0, 0)) goto _fail_; From 15162fbc78a74a5910e84ad310934aab6b84be02 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 16 Nov 2015 15:04:57 +0100 Subject: [PATCH 538/843] staging/wilc1000: avoid static definitions in header The wilc_wfi_cfgoperations.h header defines the ieee80211_txrx_stypes and cipher_suites variables that are only used in wilc_wfi_cfgoperations.c and should not be shared in a header file. This moves over all that data into the .c file, and also moves all the macro definitions from the file that are also not needed here. Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 84 +++++++++++++++++++ .../staging/wilc1000/wilc_wfi_cfgoperations.h | 83 ------------------ 2 files changed, 84 insertions(+), 83 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 49b82b4a0688..46c3f578a6fd 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -17,6 +17,90 @@ #include "host_interface.h" #include +/* The following macros describe the bitfield map used by the firmware to determine its 11i mode */ +#define NO_ENCRYPT 0 +#define ENCRYPT_ENABLED BIT(0) +#define WEP BIT(1) +#define WEP_EXTENDED BIT(2) +#define WPA BIT(3) +#define WPA2 BIT(4) +#define AES BIT(5) +#define TKIP BIT(6) + +/*Public action frame index IDs*/ +#define FRAME_TYPE_ID 0 +#define ACTION_CAT_ID 24 +#define ACTION_SUBTYPE_ID 25 +#define P2P_PUB_ACTION_SUBTYPE 30 + +/*Public action frame Attribute IDs*/ +#define ACTION_FRAME 0xd0 +#define GO_INTENT_ATTR_ID 0x04 +#define CHANLIST_ATTR_ID 0x0b +#define OPERCHAN_ATTR_ID 0x11 +#define PUB_ACTION_ATTR_ID 0x04 +#define P2PELEM_ATTR_ID 0xdd + +/*Public action subtype values*/ +#define GO_NEG_REQ 0x00 +#define GO_NEG_RSP 0x01 +#define GO_NEG_CONF 0x02 +#define P2P_INV_REQ 0x03 +#define P2P_INV_RSP 0x04 +#define PUBLIC_ACT_VENDORSPEC 0x09 +#define GAS_INTIAL_REQ 0x0a +#define GAS_INTIAL_RSP 0x0b + +#define INVALID_CHANNEL 0 + +#define nl80211_SCAN_RESULT_EXPIRE (3 * HZ) +#define SCAN_RESULT_EXPIRE (40 * HZ) + +static const u32 cipher_suites[] = { + WLAN_CIPHER_SUITE_WEP40, + WLAN_CIPHER_SUITE_WEP104, + WLAN_CIPHER_SUITE_TKIP, + WLAN_CIPHER_SUITE_CCMP, + WLAN_CIPHER_SUITE_AES_CMAC, +}; + +static const struct ieee80211_txrx_stypes + wilc_wfi_cfg80211_mgmt_types[NUM_NL80211_IFTYPES] = { + [NL80211_IFTYPE_STATION] = { + .tx = 0xffff, + .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | + BIT(IEEE80211_STYPE_PROBE_REQ >> 4) + }, + [NL80211_IFTYPE_AP] = { + .tx = 0xffff, + .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | + BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | + BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | + BIT(IEEE80211_STYPE_DISASSOC >> 4) | + BIT(IEEE80211_STYPE_AUTH >> 4) | + BIT(IEEE80211_STYPE_DEAUTH >> 4) | + BIT(IEEE80211_STYPE_ACTION >> 4) + }, + [NL80211_IFTYPE_P2P_CLIENT] = { + .tx = 0xffff, + .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | + BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | + BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | + BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | + BIT(IEEE80211_STYPE_DISASSOC >> 4) | + BIT(IEEE80211_STYPE_AUTH >> 4) | + BIT(IEEE80211_STYPE_DEAUTH >> 4) + } +}; + +/* Time to stay on the channel */ +#define WILC_WFI_DWELL_PASSIVE 100 +#define WILC_WFI_DWELL_ACTIVE 40 + +#define TCP_ACK_FILTER_LINK_SPEED_THRESH 54 +#define DEFAULT_LINK_SPEED 72 + + #define IS_MANAGMEMENT 0x100 #define IS_MANAGMEMENT_CALLBACK 0x080 #define IS_MGMT_STATUS_SUCCES 0x040 diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h index ae2aaea508db..158d98c0eb87 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h @@ -10,86 +10,6 @@ #define NM_WFI_CFGOPERATIONS #include "wilc_wfi_netdevice.h" -/* The following macros describe the bitfield map used by the firmware to determine its 11i mode */ -#define NO_ENCRYPT 0 -#define ENCRYPT_ENABLED BIT(0) -#define WEP BIT(1) -#define WEP_EXTENDED BIT(2) -#define WPA BIT(3) -#define WPA2 BIT(4) -#define AES BIT(5) -#define TKIP BIT(6) - -/*Public action frame index IDs*/ -#define FRAME_TYPE_ID 0 -#define ACTION_CAT_ID 24 -#define ACTION_SUBTYPE_ID 25 -#define P2P_PUB_ACTION_SUBTYPE 30 - -/*Public action frame Attribute IDs*/ -#define ACTION_FRAME 0xd0 -#define GO_INTENT_ATTR_ID 0x04 -#define CHANLIST_ATTR_ID 0x0b -#define OPERCHAN_ATTR_ID 0x11 -#define PUB_ACTION_ATTR_ID 0x04 -#define P2PELEM_ATTR_ID 0xdd - -/*Public action subtype values*/ -#define GO_NEG_REQ 0x00 -#define GO_NEG_RSP 0x01 -#define GO_NEG_CONF 0x02 -#define P2P_INV_REQ 0x03 -#define P2P_INV_RSP 0x04 -#define PUBLIC_ACT_VENDORSPEC 0x09 -#define GAS_INTIAL_REQ 0x0a -#define GAS_INTIAL_RSP 0x0b - -#define INVALID_CHANNEL 0 - -#define nl80211_SCAN_RESULT_EXPIRE (3 * HZ) -#define SCAN_RESULT_EXPIRE (40 * HZ) - -static const u32 cipher_suites[] = { - WLAN_CIPHER_SUITE_WEP40, - WLAN_CIPHER_SUITE_WEP104, - WLAN_CIPHER_SUITE_TKIP, - WLAN_CIPHER_SUITE_CCMP, - WLAN_CIPHER_SUITE_AES_CMAC, -}; - -static const struct ieee80211_txrx_stypes - wilc_wfi_cfg80211_mgmt_types[NUM_NL80211_IFTYPES] = { - [NL80211_IFTYPE_STATION] = { - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) - }, - [NL80211_IFTYPE_AP] = { - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | - BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | - BIT(IEEE80211_STYPE_DISASSOC >> 4) | - BIT(IEEE80211_STYPE_AUTH >> 4) | - BIT(IEEE80211_STYPE_DEAUTH >> 4) | - BIT(IEEE80211_STYPE_ACTION >> 4) - }, - [NL80211_IFTYPE_P2P_CLIENT] = { - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | - BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | - BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | - BIT(IEEE80211_STYPE_DISASSOC >> 4) | - BIT(IEEE80211_STYPE_AUTH >> 4) | - BIT(IEEE80211_STYPE_DEAUTH >> 4) - } -}; - -/* Time to stay on the channel */ -#define WILC_WFI_DWELL_PASSIVE 100 -#define WILC_WFI_DWELL_ACTIVE 40 - struct wireless_dev *wilc_create_wiphy(struct net_device *net); void wilc_free_wiphy(struct net_device *net); int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed); @@ -101,7 +21,4 @@ struct net_device *WILC_WFI_init_mon_interface(const char *name, struct net_devi void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev, u16 frame_type, bool reg); -#define TCP_ACK_FILTER_LINK_SPEED_THRESH 54 -#define DEFAULT_LINK_SPEED 72 - #endif From 25ad41cb25142a8b50164ce7b4b9565173f3d48f Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 16 Nov 2015 15:04:58 +0100 Subject: [PATCH 539/843] staging/wilc1000: remove linux_wlan_{device_power,device_detection} The driver provides an interface for custom power management and detection that is meant to be filled by people customizing the driver. The default implementation of this is empty, and we don't actually want people to have to modify the source code. If anybody needs this, they need to describe the respective hardware specifics using device tree or platform data and make the driver handle this is a more general way. This removes the empty stubs. Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 40 --------------------------- 1 file changed, 40 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 040caa0d0d0b..6e1ef99fc856 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -31,40 +31,6 @@ #include "linux_wlan_spi.h" #endif - #define _linux_wlan_device_power_on() {} - #define _linux_wlan_device_power_off() {} - - #define _linux_wlan_device_detection() {} - #define _linux_wlan_device_removal() {} - -static int linux_wlan_device_power(int on_off) -{ - PRINT_D(INIT_DBG, "linux_wlan_device_power.. (%d)\n", on_off); - - if (on_off) { - _linux_wlan_device_power_on(); - } else { - _linux_wlan_device_power_off(); - } - - return 0; -} - -static int linux_wlan_device_detection(int on_off) -{ - PRINT_D(INIT_DBG, "linux_wlan_device_detection.. (%d)\n", on_off); - -#ifdef WILC_SDIO - if (on_off) { - _linux_wlan_device_detection(); - } else { - _linux_wlan_device_removal(); - } -#endif - - return 0; -} - static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr); static struct notifier_block g_dev_notifier = { @@ -1476,8 +1442,6 @@ void wl_wlan_cleanup(struct wilc *wilc) #if defined(WILC_DEBUGFS) wilc_debugfs_remove(); #endif - linux_wlan_device_detection(0); - linux_wlan_device_power(0); } int wilc_netdev_init(struct wilc **wilc) @@ -1579,10 +1543,6 @@ static int __init init_wilc_driver(void) printk("IN INIT FUNCTION\n"); printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n"); - linux_wlan_device_power(1); - msleep(100); - linux_wlan_device_detection(1); - #ifdef WILC_SDIO { int ret; From 4bd7baf04de9ce5f8117da30d5ee2368f3c41b3e Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 16 Nov 2015 15:04:59 +0100 Subject: [PATCH 540/843] staging/wilc1000: move wilc_wlan_inp_t into struct wilc wilc_wlan_inp_t is an unnecessary indirection and requires linux_wlan.c to have knowledge of the specific sdio and spi front-ends. This removes the structure and places io_type directly inside the struct wilc. Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 21 ++++++------------- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 + drivers/staging/wilc1000/wilc_wlan.c | 19 ++++++++--------- drivers/staging/wilc1000/wilc_wlan_if.h | 11 +--------- 4 files changed, 17 insertions(+), 35 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 6e1ef99fc856..0747a0eefe92 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -839,17 +839,6 @@ static int wlan_deinit_locks(struct net_device *dev) return 0; } -static void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic) -{ - PRINT_D(INIT_DBG, "Linux to Wlan services ...\n"); - -#ifdef WILC_SDIO - nwi->io_func.io_type = HIF_SDIO; -#else - nwi->io_func.io_type = HIF_SPI; -#endif -} - static int wlan_initialize_threads(struct net_device *dev) { perInterface_wlan_t *nic; @@ -893,7 +882,6 @@ static void wlan_deinitialize_threads(struct net_device *dev) int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) { - wilc_wlan_inp_t nwi; perInterface_wlan_t *nic = p_nic; int ret = 0; struct wilc *wl = nic->wilc; @@ -904,9 +892,12 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) wlan_init_locks(dev); - linux_to_wlan(&nwi, wl); - - ret = wilc_wlan_init(dev, &nwi); +#ifdef WILC_SDIO + wl->io_type = HIF_SDIO; +#else + wl->io_type = HIF_SPI; +#endif + ret = wilc_wlan_init(dev); if (ret < 0) { PRINT_ER("Initializing WILC_Wlan FAILED\n"); ret = -EIO; diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 3358fe3bcd0a..0c608d73a22e 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -156,6 +156,7 @@ struct wilc_vif { }; struct wilc { + int io_type; int mac_status; bool initialized; #if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index f7359f79ff8d..2958689a13c6 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -5,7 +5,7 @@ typedef struct { int quit; - wilc_wlan_io_func_t io_func; + int io_type; struct wilc_hif_func hif_func; int cfg_frame_in_use; struct wilc_cfg_frame cfg_frame; @@ -576,7 +576,7 @@ static inline void chip_wakeup(void) u32 reg, clk_status_reg, trials = 0; u32 sleep_time; - if ((g_wlan.io_func.io_type & 0x1) == HIF_SPI) { + if ((g_wlan.io_type & 0x1) == HIF_SPI) { do { g_wlan.hif_func.hif_read_reg(1, ®); g_wlan.hif_func.hif_write_reg(1, reg | BIT(1)); @@ -590,7 +590,7 @@ static inline void chip_wakeup(void) } while ((wilc_get_chipid(true) == 0) && ((++trials % 3) == 0)); } while (wilc_get_chipid(true) == 0); - } else if ((g_wlan.io_func.io_type & 0x1) == HIF_SDIO) { + } else if ((g_wlan.io_type & 0x1) == HIF_SDIO) { g_wlan.hif_func.hif_read_reg(0xf0, ®); do { g_wlan.hif_func.hif_write_reg(0xf0, reg | BIT(0)); @@ -636,12 +636,12 @@ static inline void chip_wakeup(void) u32 reg, trials = 0; do { - if ((g_wlan.io_func.io_type & 0x1) == HIF_SPI) { + if ((g_wlan.io_type & 0x1) == HIF_SPI) { g_wlan.hif_func.hif_read_reg(1, ®); g_wlan.hif_func.hif_write_reg(1, reg & ~BIT(1)); g_wlan.hif_func.hif_write_reg(1, reg | BIT(1)); g_wlan.hif_func.hif_write_reg(1, reg & ~BIT(1)); - } else if ((g_wlan.io_func.io_type & 0x1) == HIF_SDIO) { + } else if ((g_wlan.io_type & 0x1) == HIF_SDIO) { g_wlan.hif_func.hif_read_reg(0xf0, ®); g_wlan.hif_func.hif_write_reg(0xf0, reg & ~BIT(0)); g_wlan.hif_func.hif_write_reg(0xf0, reg | BIT(0)); @@ -1252,10 +1252,10 @@ int wilc_wlan_start(void) int ret; u32 chipid; - if (p->io_func.io_type == HIF_SDIO) { + if (p->io_type == HIF_SDIO) { reg = 0; reg |= BIT(3); - } else if (p->io_func.io_type == HIF_SPI) { + } else if (p->io_type == HIF_SPI) { reg = 1; } acquire_bus(ACQUIRE_ONLY); @@ -1649,7 +1649,7 @@ _fail_: return chipid; } -int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) +int wilc_wlan_init(struct net_device *dev) { int ret = 0; perInterface_wlan_t *nic = netdev_priv(dev); @@ -1660,8 +1660,7 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) PRINT_D(INIT_DBG, "Initializing WILC_Wlan ...\n"); memset((void *)&g_wlan, 0, sizeof(wilc_wlan_dev_t)); - memcpy((void *)&g_wlan.io_func, (void *)&inp->io_func, - sizeof(wilc_wlan_io_func_t)); + g_wlan.io_type = wilc->io_type; #ifdef WILC_SDIO if (!wilc_hif_sdio.hif_init(wilc, wilc_debug)) { diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index 5980ece49daa..2f465f4fb063 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -72,10 +72,6 @@ typedef struct { u32 block_size; } sdio_cmd53_t; -typedef struct { - int io_type; -} wilc_wlan_io_func_t; - #define WILC_MAC_INDICATE_STATUS 0x1 #define WILC_MAC_STATUS_INIT -1 #define WILC_MAC_STATUS_READY 0 @@ -83,10 +79,6 @@ typedef struct { #define WILC_MAC_INDICATE_SCAN 0x2 -typedef struct { - wilc_wlan_io_func_t io_func; -} wilc_wlan_inp_t; - struct tx_complete_data { int size; void *buff; @@ -917,8 +909,7 @@ typedef enum { WID_MAX = 0xFFFF } WID_T; -int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp); - +int wilc_wlan_init(struct net_device *dev); void wilc_bus_set_max_speed(void); void wilc_bus_set_default_speed(void); u32 wilc_get_chipid(u8 update); From 857c7b00d2400b2f8a825b4710e9c3d2ebef4aa1 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 16 Nov 2015 15:05:00 +0100 Subject: [PATCH 541/843] staging/wilc1000: move init/exit functions to driver files The driver interfaces are in linux_wlan_sdio.c and linux_wlan_spi.c, so this is where the init and exit functions should be. Splitting this up enables further cleanups, including eventually allowing both modules to be built together. Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 51 +------------------ drivers/staging/wilc1000/linux_wlan_common.h | 10 ++++ drivers/staging/wilc1000/linux_wlan_sdio.c | 16 +++++- drivers/staging/wilc1000/linux_wlan_sdio.h | 6 +-- drivers/staging/wilc1000/linux_wlan_spi.c | 23 ++++++++- drivers/staging/wilc1000/linux_wlan_spi.h | 3 +- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +- 7 files changed, 52 insertions(+), 59 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 0747a0eefe92..876bcfb3b546 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1398,7 +1398,7 @@ void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size) WILC_WFI_p2p_rx(wilc->vif[1].ndev, buff, size); } -void wl_wlan_cleanup(struct wilc *wilc) +void wilc_netdev_cleanup(struct wilc *wilc) { int i = 0; perInterface_wlan_t *nic[NUM_CONCURRENT_IFC]; @@ -1517,52 +1517,3 @@ int wilc_netdev_init(struct wilc **wilc) return 0; } - -static int __init init_wilc_driver(void) -{ -#ifdef WILC_SPI - struct wilc *wilc; -#endif - -#if defined(WILC_DEBUGFS) - if (wilc_debugfs_init() < 0) { - PRINT_D(GENERIC_DBG, "fail to create debugfs for wilc driver\n"); - return -1; - } -#endif - - printk("IN INIT FUNCTION\n"); - printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n"); - -#ifdef WILC_SDIO - { - int ret; - - ret = sdio_register_driver(&wilc_bus); - if (ret < 0) - PRINT_D(INIT_DBG, "init_wilc_driver: Failed register sdio driver\n"); - - return ret; - } -#else - PRINT_D(INIT_DBG, "Initializing netdev\n"); - if (wilc_netdev_init(&wilc)) - PRINT_ER("Couldn't initialize netdev\n"); - return 0; -#endif -} -late_initcall(init_wilc_driver); - -static void __exit exit_wilc_driver(void) -{ -#ifndef WILC_SDIO - PRINT_D(INIT_DBG, "SPI unregister...\n"); - spi_unregister_driver(&wilc_bus); -#else - PRINT_D(INIT_DBG, "SDIO unregister...\n"); - sdio_unregister_driver(&wilc_bus); -#endif -} -module_exit(exit_wilc_driver); - -MODULE_LICENSE("GPL"); diff --git a/drivers/staging/wilc1000/linux_wlan_common.h b/drivers/staging/wilc1000/linux_wlan_common.h index b8dfc4a5e5cb..f2ea8280b8f8 100644 --- a/drivers/staging/wilc1000/linux_wlan_common.h +++ b/drivers/staging/wilc1000/linux_wlan_common.h @@ -121,6 +121,16 @@ extern atomic_t WILC_DEBUG_LEVEL; printk("ERR [%s: %d]", __func__, __LINE__); \ printk(__VA_ARGS__); \ } while (0) + +static inline int wilc_debugfs_init(void) +{ + return 0; +} + +static inline void wilc_debugfs_remove(void) +{ +} + #endif #define FN_IN /* PRINT_D(">>> \n") */ diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index 0b01873faf79..06fd0e600c2a 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -146,11 +146,11 @@ static void linux_sdio_remove(struct sdio_func *func) struct wilc_sdio *wl_sdio; wl_sdio = sdio_get_drvdata(func); - wl_wlan_cleanup(wl_sdio->wilc); + wilc_netdev_cleanup(wl_sdio->wilc); kfree(wl_sdio); } -struct sdio_driver wilc_bus = { +static struct sdio_driver wilc_bus = { .name = SDIO_MODALIAS, .id_table = wilc_sdio_ids, .probe = linux_sdio_probe, @@ -237,4 +237,16 @@ int wilc_sdio_set_default_speed(void) } +static int __init init_wilc_sdio_driver(void) +{ + return sdio_register_driver(&wilc_bus); +} +late_initcall(init_wilc_sdio_driver); +static void __exit exit_wilc_sdio_driver(void) +{ + sdio_unregister_driver(&wilc_bus); +} +module_exit(exit_wilc_sdio_driver); + +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h b/drivers/staging/wilc1000/linux_wlan_sdio.h index 49cce2c43410..3e1618526e78 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.h +++ b/drivers/staging/wilc1000/linux_wlan_sdio.h @@ -1,11 +1,11 @@ -extern struct sdio_func *wilc_sdio_func; -extern struct sdio_driver wilc_bus; - #include +extern struct sdio_func *wilc_sdio_func; + int wilc_sdio_init(void); int wilc_sdio_cmd52(sdio_cmd52_t *cmd); int wilc_sdio_cmd53(sdio_cmd53_t *cmd); + int wilc_sdio_enable_interrupt(void); void wilc_sdio_disable_interrupt(void); int wilc_sdio_set_max_speed(void); diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index 790128f6d034..f279a434c4c2 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -11,6 +11,7 @@ #include "linux_wlan_common.h" #include "linux_wlan_spi.h" +#include "wilc_wfi_netdevice.h" #define USE_SPI_DMA 0 /* johnny add */ @@ -68,7 +69,7 @@ static const struct of_device_id wilc1000_of_match[] = { MODULE_DEVICE_TABLE(of, wilc1000_of_match); #endif -struct spi_driver wilc_bus __refdata = { +static struct spi_driver wilc_bus __refdata = { .driver = { .name = MODALIAS, #ifdef CONFIG_OF @@ -393,3 +394,23 @@ int wilc_spi_set_max_speed(void) PRINT_INFO(BUS_DBG, "@@@@@@@@@@@@ change SPI speed to %d @@@@@@@@@\n", SPEED); return 1; } + +static struct wilc *wilc; + +static int __init init_wilc_spi_driver(void) +{ + wilc_debugfs_init(); + return wilc_netdev_init(&wilc); +} +late_initcall(init_wilc_spi_driver); + +static void __exit exit_wilc_spi_driver(void) +{ + if (wilc) + wilc_netdev_cleanup(wilc); + spi_unregister_driver(&wilc_bus); + wilc_debugfs_remove(); +} +module_exit(exit_wilc_spi_driver); + +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h b/drivers/staging/wilc1000/linux_wlan_spi.h index aecb522ff56d..f434f79913ab 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.h +++ b/drivers/staging/wilc1000/linux_wlan_spi.h @@ -2,12 +2,11 @@ #define LINUX_WLAN_SPI_H #include -extern struct spi_device *wilc_spi_dev; -extern struct spi_driver wilc_bus; int wilc_spi_init(void); int wilc_spi_write(u8 *b, u32 len); int wilc_spi_read(u8 *rb, u32 rlen); int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen); int wilc_spi_set_max_speed(void); + #endif diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 0c608d73a22e..9adac5c781ee 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -216,7 +216,7 @@ void linux_wlan_mac_indicate(struct wilc *wilc, int flag); void linux_wlan_rx_complete(void); void linux_wlan_dbg(u8 *buff); int linux_wlan_lock_timeout(void *vp, u32 timeout); -void wl_wlan_cleanup(struct wilc *wilc); +void wilc_netdev_cleanup(struct wilc *wilc); int wilc_netdev_init(struct wilc **wilc); void wilc1000_wlan_deinit(struct net_device *dev); void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size); From b03314e22571783488828f7f38fa708cbd3a1888 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 16 Nov 2015 15:05:01 +0100 Subject: [PATCH 542/843] staging/wilc1000: unify device pointer struct wilc has two pointers to store the device, one for sdio_func and one for spi_device. By changing the pointer to a 'struct device', we can simplify the logic and avoid a few #ifdefs. Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 25 ++------------ drivers/staging/wilc1000/linux_wlan_sdio.c | 33 ++++--------------- drivers/staging/wilc1000/linux_wlan_spi.c | 22 +++++++++++-- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 6 +--- 4 files changed, 30 insertions(+), 56 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 876bcfb3b546..faad01f6f2d1 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -453,19 +453,11 @@ int wilc_wlan_get_firmware(struct net_device *dev) goto _fail_; } -#ifdef WILC_SDIO - if (request_firmware(&wilc_firmware, firmware, &wilc->wilc_sdio_func->dev) != 0) { + if (request_firmware(&wilc_firmware, firmware, wilc->dev) != 0) { PRINT_ER("%s - firmare not available\n", firmware); ret = -1; goto _fail_; } -#else - if (request_firmware(&wilc_firmware, firmware, &wilc->wilc_spidev->dev) != 0) { - PRINT_ER("%s - firmare not available\n", firmware); - ret = -1; - goto _fail_; - } -#endif wilc->firmware = wilc_firmware; _fail_: @@ -1015,12 +1007,11 @@ int wilc_mac_open(struct net_device *ndev) nic = netdev_priv(ndev); wl = nic->wilc; -#ifdef WILC_SPI - if (!wl || !wl->wilc_spidev) { + if (!wl|| !wl->dev) { netdev_err(ndev, "wilc1000: SPI device not ready\n"); return -ENODEV; } -#endif + nic = netdev_priv(ndev); priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy); PRINT_D(INIT_DBG, "MAC OPEN[%p]\n", ndev); @@ -1505,15 +1496,5 @@ int wilc_netdev_init(struct wilc **wilc) nic->mac_opened = 0; } - #ifndef WILC_SDIO - if (!wilc_spi_init()) { - PRINT_ER("Can't initialize SPI\n"); - return -1; - } - wilc_dev->wilc_spidev = wilc_spi_dev; - #else - wilc_dev->wilc_sdio_func = wilc_sdio_func; - #endif - return 0; } diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index 06fd0e600c2a..8df69b2aff2d 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -21,13 +21,7 @@ #define MAX_SPEED (6 * 1000000) /* Max 50M */ #endif -struct wilc_sdio { - struct sdio_func *func; - struct wilc *wilc; -}; - struct sdio_func *wilc_sdio_func; - static unsigned int sdio_default_speed; #define SDIO_VENDOR_ID_WILC 0x0296 @@ -42,12 +36,8 @@ static const struct sdio_device_id wilc_sdio_ids[] = { #ifndef WILC_SDIO_IRQ_GPIO static void wilc_sdio_interrupt(struct sdio_func *func) { - struct wilc_sdio *wl_sdio; - - wl_sdio = sdio_get_drvdata(func); - sdio_release_host(func); - wilc_handle_isr(wl_sdio->wilc); + wilc_handle_isr(sdio_get_drvdata(func)); sdio_claim_host(func); } #endif @@ -55,7 +45,7 @@ static void wilc_sdio_interrupt(struct sdio_func *func) int wilc_sdio_cmd52(sdio_cmd52_t *cmd) { - struct sdio_func *func = wilc_dev->wilc_sdio_func; + struct sdio_func *func = container_of(wilc_dev->dev, struct sdio_func, dev); int ret; u8 data; @@ -87,7 +77,7 @@ int wilc_sdio_cmd52(sdio_cmd52_t *cmd) int wilc_sdio_cmd53(sdio_cmd53_t *cmd) { - struct sdio_func *func = wilc_dev->wilc_sdio_func; + struct sdio_func *func = container_of(wilc_dev->dev, struct sdio_func, dev); int size, ret; sdio_claim_host(func); @@ -118,24 +108,17 @@ int wilc_sdio_cmd53(sdio_cmd53_t *cmd) static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) { - struct wilc_sdio *wl_sdio; struct wilc *wilc; - PRINT_D(INIT_DBG, "probe function\n"); - wl_sdio = kzalloc(sizeof(struct wilc_sdio), GFP_KERNEL); - if (!wl_sdio) - return -ENOMEM; PRINT_D(INIT_DBG, "Initializing netdev\n"); wilc_sdio_func = func; if (wilc_netdev_init(&wilc)) { PRINT_ER("Couldn't initialize netdev\n"); - kfree(wl_sdio); return -1; } - wl_sdio->func = func; - wl_sdio->wilc = wilc; - sdio_set_drvdata(func, wl_sdio); + sdio_set_drvdata(func, wilc); + wilc->dev = &func->dev; printk("Driver Initializing success\n"); return 0; @@ -143,11 +126,7 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id static void linux_sdio_remove(struct sdio_func *func) { - struct wilc_sdio *wl_sdio; - - wl_sdio = sdio_get_drvdata(func); - wilc_netdev_cleanup(wl_sdio->wilc); - kfree(wl_sdio); + wilc_netdev_cleanup(sdio_get_drvdata(func)); } static struct sdio_driver wilc_bus = { diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index f279a434c4c2..29dd9d4e5ff0 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -9,9 +9,10 @@ #include #include +#include "wilc_wfi_netdevice.h" #include "linux_wlan_common.h" #include "linux_wlan_spi.h" -#include "wilc_wfi_netdevice.h" +#include "wilc_wlan_if.h" #define USE_SPI_DMA 0 /* johnny add */ @@ -399,8 +400,25 @@ static struct wilc *wilc; static int __init init_wilc_spi_driver(void) { + int ret; + wilc_debugfs_init(); - return wilc_netdev_init(&wilc); + + ret = wilc_netdev_init(&wilc); + if (ret) { + wilc_debugfs_remove(); + return ret; + } + + if (!wilc_spi_init() || !wilc_spi_dev) { + PRINT_ER("Can't initialize SPI\n"); + wilc_netdev_cleanup(wilc); + wilc_debugfs_remove(); + return -ENXIO; + } + wilc_dev->dev = &wilc_spi_dev->dev; + + return ret; } late_initcall(init_wilc_spi_driver); diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 9adac5c781ee..a099f2877b6e 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -185,11 +185,7 @@ struct wilc { const struct firmware *firmware; -#ifdef WILC_SDIO - struct sdio_func *wilc_sdio_func; -#else - struct spi_device *wilc_spidev; -#endif + struct device *dev; }; typedef struct { From 6703992896cc95f0bc7c9ccece1fcb3c7e8a2f87 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 16 Nov 2015 15:05:02 +0100 Subject: [PATCH 543/843] staging/wilc1000: pass io_type to wilc_netdev_init In order to avoid some of the #ifdefs, this passes the io_type and device pointer as an argument to wilc_netdev_init. Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 18 ++++-------------- drivers/staging/wilc1000/linux_wlan_sdio.c | 4 ++-- drivers/staging/wilc1000/linux_wlan_spi.c | 4 ++-- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +- 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index faad01f6f2d1..b1707147aa7d 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -25,11 +25,7 @@ #include -#ifdef WILC_SDIO #include "linux_wlan_sdio.h" -#else -#include "linux_wlan_spi.h" -#endif static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr); @@ -884,11 +880,6 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) wlan_init_locks(dev); -#ifdef WILC_SDIO - wl->io_type = HIF_SDIO; -#else - wl->io_type = HIF_SPI; -#endif ret = wilc_wlan_init(dev); if (ret < 0) { PRINT_ER("Initializing WILC_Wlan FAILED\n"); @@ -1426,7 +1417,7 @@ void wilc_netdev_cleanup(struct wilc *wilc) #endif } -int wilc_netdev_init(struct wilc **wilc) +int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type) { int i; perInterface_wlan_t *nic; @@ -1439,7 +1430,7 @@ int wilc_netdev_init(struct wilc **wilc) return -ENOMEM; *wilc = wilc_dev; - + wilc_dev->io_type = io_type; register_inetaddr_notifier(&g_dev_notifier); for (i = 0; i < NUM_CONCURRENT_IFC; i++) { @@ -1468,9 +1459,8 @@ int wilc_netdev_init(struct wilc **wilc) struct wireless_dev *wdev; wdev = wilc_create_wiphy(ndev); - #ifdef WILC_SDIO - SET_NETDEV_DEV(ndev, &wilc_sdio_func->dev); - #endif + if (dev) + SET_NETDEV_DEV(ndev, dev); if (!wdev) { PRINT_ER("Can't register WILC Wiphy\n"); diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index 8df69b2aff2d..d2843b949a1b 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -1,4 +1,5 @@ #include "wilc_wfi_netdevice.h" +#include "linux_wlan_sdio.h" #include #include @@ -113,7 +114,7 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id PRINT_D(INIT_DBG, "Initializing netdev\n"); wilc_sdio_func = func; - if (wilc_netdev_init(&wilc)) { + if (wilc_netdev_init(&wilc, &func->dev, HIF_SDIO)) { PRINT_ER("Couldn't initialize netdev\n"); return -1; } @@ -215,7 +216,6 @@ int wilc_sdio_set_default_speed(void) return linux_sdio_set_speed(sdio_default_speed); } - static int __init init_wilc_sdio_driver(void) { return sdio_register_driver(&wilc_bus); diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index 29dd9d4e5ff0..a459c502a8a8 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -9,9 +9,9 @@ #include #include +#include "linux_wlan_spi.h" #include "wilc_wfi_netdevice.h" #include "linux_wlan_common.h" -#include "linux_wlan_spi.h" #include "wilc_wlan_if.h" #define USE_SPI_DMA 0 /* johnny add */ @@ -404,7 +404,7 @@ static int __init init_wilc_spi_driver(void) wilc_debugfs_init(); - ret = wilc_netdev_init(&wilc); + ret = wilc_netdev_init(&wilc, NULL, HIF_SPI); if (ret) { wilc_debugfs_remove(); return ret; diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index a099f2877b6e..eae9ce175351 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -213,7 +213,7 @@ void linux_wlan_rx_complete(void); void linux_wlan_dbg(u8 *buff); int linux_wlan_lock_timeout(void *vp, u32 timeout); void wilc_netdev_cleanup(struct wilc *wilc); -int wilc_netdev_init(struct wilc **wilc); +int wilc_netdev_init(struct wilc **wilc, struct device *, int io_type); void wilc1000_wlan_deinit(struct net_device *dev); void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size); u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value); From 2e7d5377f684ea1b337a4182f5f025b300d024ff Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 16 Nov 2015 15:05:03 +0100 Subject: [PATCH 544/843] staging/wilc1000: use device pointer for phy creation wilc_create_wiphy tries to get a pointer to a device from the global wilc_sdio_func variable. This is a layering violation and we can use the wilc_dev->dev pointer instead. Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 2 +- drivers/staging/wilc1000/linux_wlan_sdio.c | 2 +- drivers/staging/wilc1000/linux_wlan_sdio.h | 2 -- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 9 ++------- drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 2 +- 5 files changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index b1707147aa7d..08c3be8728b2 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1457,7 +1457,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type) { struct wireless_dev *wdev; - wdev = wilc_create_wiphy(ndev); + wdev = wilc_create_wiphy(ndev, dev); if (dev) SET_NETDEV_DEV(ndev, dev); diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index d2843b949a1b..874a859cad21 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -22,7 +22,7 @@ #define MAX_SPEED (6 * 1000000) /* Max 50M */ #endif -struct sdio_func *wilc_sdio_func; +static struct sdio_func *wilc_sdio_func; static unsigned int sdio_default_speed; #define SDIO_VENDOR_ID_WILC 0x0296 diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h b/drivers/staging/wilc1000/linux_wlan_sdio.h index 3e1618526e78..df733c25e770 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.h +++ b/drivers/staging/wilc1000/linux_wlan_sdio.h @@ -1,7 +1,5 @@ #include -extern struct sdio_func *wilc_sdio_func; - int wilc_sdio_init(void); int wilc_sdio_cmd52(sdio_cmd52_t *cmd); int wilc_sdio_cmd53(sdio_cmd53_t *cmd); diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 46c3f578a6fd..cc279c654e53 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -11,9 +11,6 @@ */ #include "wilc_wfi_cfgoperations.h" -#ifdef WILC_SDIO -#include "linux_wlan_sdio.h" -#endif #include "host_interface.h" #include @@ -3414,7 +3411,7 @@ _fail_: * @date 01 MAR 2012 * @version 1.0 */ -struct wireless_dev *wilc_create_wiphy(struct net_device *net) +struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *dev) { struct wilc_priv *priv; struct wireless_dev *wdev; @@ -3466,9 +3463,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net) wdev->wiphy->max_scan_ssids, wdev->wiphy->max_scan_ie_len, wdev->wiphy->signal_type, wdev->wiphy->interface_modes, wdev->iftype); - #ifdef WILC_SDIO - set_wiphy_dev(wdev->wiphy, &wilc_sdio_func->dev); - #endif + set_wiphy_dev(wdev->wiphy, dev); /*Register wiphy structure*/ s32Error = wiphy_register(wdev->wiphy); diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h index 158d98c0eb87..ab53d9d59081 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h @@ -10,7 +10,7 @@ #define NM_WFI_CFGOPERATIONS #include "wilc_wfi_netdevice.h" -struct wireless_dev *wilc_create_wiphy(struct net_device *net); +struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *dev); void wilc_free_wiphy(struct net_device *net); int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed); int wilc_deinit_host_int(struct net_device *net); From c4d139cb8d7dbe67cfbaefa70230d144dbada34c Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 16 Nov 2015 15:05:04 +0100 Subject: [PATCH 545/843] staging/wilc1000: get rid of WILC_SDIO_IRQ_GPIO Whether the SDIO function uses an internal or external interrupt should not be a compiletime decision but be determined at runtime. This changes the code to pass a GPIO number from the init code as early as possible, and leaves just one #ifdef WILC_SDIO_IRQ_GPIO to preserve the previous behavior. All other locations that check for the interrupt method are turned into runtime checks based on the gpio number (>=0) or the interrupt number (>0). Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/Makefile | 1 - drivers/staging/wilc1000/linux_wlan.c | 67 +++++------ drivers/staging/wilc1000/linux_wlan_sdio.c | 18 +-- drivers/staging/wilc1000/linux_wlan_spi.c | 2 +- drivers/staging/wilc1000/wilc_sdio.c | 105 ++++++++---------- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 7 +- drivers/staging/wilc1000/wilc_wlan.c | 8 +- 7 files changed, 91 insertions(+), 117 deletions(-) diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile index 9696f69bda48..fe480c76c521 100644 --- a/drivers/staging/wilc1000/Makefile +++ b/drivers/staging/wilc1000/Makefile @@ -1,7 +1,6 @@ obj-$(CONFIG_WILC1000) += wilc1000.o ccflags-$(CONFIG_WILC1000_SDIO) += -DWILC_SDIO -DCOMPLEMENT_BOOT -ccflags-$(CONFIG_WILC1000_HW_OOB_INTR) += -DWILC_SDIO_IRQ_GPIO ccflags-$(CONFIG_WILC1000_SPI) += -DWILC_SPI ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \ diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 08c3be8728b2..e81e90678d0f 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -161,7 +161,6 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event return NOTIFY_DONE; } -#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO) static irqreturn_t isr_uh_routine(int irq, void *user_data) { perInterface_wlan_t *nic; @@ -207,9 +206,9 @@ static int init_irq(struct net_device *dev) nic = netdev_priv(dev); wl = nic->wilc; - if ((gpio_request(GPIO_NUM, "WILC_INTR") == 0) && - (gpio_direction_input(GPIO_NUM) == 0)) { - wl->dev_irq_num = gpio_to_irq(GPIO_NUM); + if ((gpio_request(wl->gpio, "WILC_INTR") == 0) && + (gpio_direction_input(wl->gpio) == 0)) { + wl->dev_irq_num = gpio_to_irq(wl->gpio); } else { ret = -1; PRINT_ER("could not obtain gpio for WILC_INTR\n"); @@ -220,16 +219,16 @@ static int init_irq(struct net_device *dev) isr_bh_routine, IRQF_TRIGGER_LOW | IRQF_ONESHOT, "WILC_IRQ", dev) < 0) { - PRINT_ER("Failed to request IRQ for GPIO: %d\n", GPIO_NUM); + PRINT_ER("Failed to request IRQ for GPIO: %d\n", wl->gpio); + gpio_free(wl->gpio); ret = -1; } else { PRINT_D(INIT_DBG, "IRQ request succeeded IRQ-NUM= %d on GPIO: %d\n", - wl->dev_irq_num, GPIO_NUM); + wl->dev_irq_num, wl->gpio); } return ret; } -#endif static void deinit_irq(struct net_device *dev) { @@ -239,13 +238,11 @@ static void deinit_irq(struct net_device *dev) nic = netdev_priv(dev); wilc = nic->wilc; -#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO) - if (&wilc->dev_irq_num != 0) { + /* Deintialize IRQ */ + if (wilc->dev_irq_num) { free_irq(wilc->dev_irq_num, wilc); - - gpio_free(GPIO_NUM); + gpio_free(wilc->gpio); } -#endif } void linux_wlan_dbg(u8 *buff) @@ -742,11 +739,11 @@ void wilc1000_wlan_deinit(struct net_device *dev) #endif PRINT_D(INIT_DBG, "Disabling IRQ\n"); -#ifdef WILC_SDIO - mutex_lock(&wl->hif_cs); - wilc_sdio_disable_interrupt(); - mutex_unlock(&wl->hif_cs); -#endif + if (!wl->dev_irq_num) { + mutex_lock(&wl->hif_cs); + wilc_sdio_disable_interrupt(); + mutex_unlock(&wl->hif_cs); + } if (&wl->txq_event) up(&wl->txq_event); @@ -760,14 +757,14 @@ void wilc1000_wlan_deinit(struct net_device *dev) PRINT_D(INIT_DBG, "Deinitializing WILC Wlan\n"); wilc_wlan_cleanup(dev); -#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO) - #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31) - PRINT_D(INIT_DBG, "Disabling IRQ 2\n"); +#if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31) + if (!wl->dev_irq_num) { + PRINT_D(INIT_DBG, "Disabling IRQ 2\n"); - mutex_lock(&wl->hif_cs); - wilc_sdio_disable_interrupt(); - mutex_unlock(&wl->hif_cs); - #endif + mutex_lock(&wl->hif_cs); + wilc_sdio_disable_interrupt(); + mutex_unlock(&wl->hif_cs); + } #endif PRINT_D(INIT_DBG, "Deinitializing Locks\n"); @@ -887,13 +884,11 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) goto _fail_locks_; } -#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO) - if (init_irq(dev)) { + if (wl->gpio >= 0 && init_irq(dev)) { PRINT_ER("couldn't initialize IRQ\n"); ret = -EIO; goto _fail_locks_; } -#endif ret = wlan_initialize_threads(dev); if (ret < 0) { @@ -902,13 +897,11 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) goto _fail_wilc_wlan_; } -#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO) - if (wilc_sdio_enable_interrupt()) { + if (!wl->dev_irq_num && wilc_sdio_enable_interrupt()) { PRINT_ER("couldn't initialize IRQ\n"); ret = -EIO; goto _fail_irq_init_; } -#endif if (wilc_wlan_get_firmware(dev)) { PRINT_ER("Can't get firmware\n"); @@ -957,14 +950,12 @@ _fail_fw_start_: wilc_wlan_stop(); _fail_irq_enable_: -#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO) - wilc_sdio_disable_interrupt(); + if (!wl->dev_irq_num) + wilc_sdio_disable_interrupt(); _fail_irq_init_: -#endif -#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO) - deinit_irq(dev); + if (wl->dev_irq_num) + deinit_irq(dev); -#endif wlan_deinitialize_threads(dev); _fail_wilc_wlan_: wilc_wlan_cleanup(dev); @@ -1417,7 +1408,7 @@ void wilc_netdev_cleanup(struct wilc *wilc) #endif } -int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type) +int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, int gpio) { int i; perInterface_wlan_t *nic; @@ -1431,6 +1422,8 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type) *wilc = wilc_dev; wilc_dev->io_type = io_type; + wilc_dev->gpio = gpio; + register_inetaddr_notifier(&g_dev_notifier); for (i = 0; i < NUM_CONCURRENT_IFC; i++) { diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index 874a859cad21..732b0d66366b 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -6,6 +6,7 @@ #include #include #include +#include @@ -34,15 +35,12 @@ static const struct sdio_device_id wilc_sdio_ids[] = { }; -#ifndef WILC_SDIO_IRQ_GPIO static void wilc_sdio_interrupt(struct sdio_func *func) { sdio_release_host(func); wilc_handle_isr(sdio_get_drvdata(func)); sdio_claim_host(func); } -#endif - int wilc_sdio_cmd52(sdio_cmd52_t *cmd) { @@ -110,11 +108,18 @@ int wilc_sdio_cmd53(sdio_cmd53_t *cmd) static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) { struct wilc *wilc; + int gpio; + gpio = -1; + if (IS_ENABLED(CONFIG_WILC1000_HW_OOB_INTR)) { + gpio = of_get_gpio(func->dev.of_node, 0); + if (gpio < 0) + gpio = GPIO_NUM; + } PRINT_D(INIT_DBG, "Initializing netdev\n"); wilc_sdio_func = func; - if (wilc_netdev_init(&wilc, &func->dev, HIF_SDIO)) { + if (wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, gpio)) { PRINT_ER("Couldn't initialize netdev\n"); return -1; } @@ -140,7 +145,6 @@ static struct sdio_driver wilc_bus = { int wilc_sdio_enable_interrupt(void) { int ret = 0; -#ifndef WILC_SDIO_IRQ_GPIO sdio_claim_host(wilc_sdio_func); ret = sdio_claim_irq(wilc_sdio_func, wilc_sdio_interrupt); @@ -150,14 +154,11 @@ int wilc_sdio_enable_interrupt(void) PRINT_ER("can't claim sdio_irq, err(%d)\n", ret); ret = -EIO; } -#endif return ret; } void wilc_sdio_disable_interrupt(void) { - -#ifndef WILC_SDIO_IRQ_GPIO int ret; PRINT_D(INIT_DBG, "wilc_sdio_disable_interrupt IN\n"); @@ -170,7 +171,6 @@ void wilc_sdio_disable_interrupt(void) sdio_release_host(wilc_sdio_func); PRINT_D(INIT_DBG, "wilc_sdio_disable_interrupt OUT\n"); -#endif } static int linux_sdio_set_speed(int speed) diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index a459c502a8a8..f4dda4a6fa7b 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -404,7 +404,7 @@ static int __init init_wilc_spi_driver(void) wilc_debugfs_init(); - ret = wilc_netdev_init(&wilc, NULL, HIF_SPI); + ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, GPIO_NUM); if (ret) { wilc_debugfs_remove(); return ret; diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index 7fca3b23b485..8441fcccccc4 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -16,6 +16,7 @@ #define WILC_SDIO_BLOCK_SIZE 512 typedef struct { + bool irq_gpio; u32 block_size; wilc_debug_func dPrint; int nint; @@ -25,10 +26,8 @@ typedef struct { static wilc_sdio_t g_sdio; -#ifdef WILC_SDIO_IRQ_GPIO static int sdio_write_reg(u32 addr, u32 data); static int sdio_read_reg(u32 addr, u32 *data); -#endif /******************************************** * @@ -131,29 +130,29 @@ _fail_: static int sdio_clear_int(void) { -#ifndef WILC_SDIO_IRQ_GPIO - /* u32 sts; */ - sdio_cmd52_t cmd; + if (!g_sdio.irq_gpio) { + /* u32 sts; */ + sdio_cmd52_t cmd; - cmd.read_write = 0; - cmd.function = 1; - cmd.raw = 0; - cmd.address = 0x4; - cmd.data = 0; - wilc_sdio_cmd52(&cmd); + cmd.read_write = 0; + cmd.function = 1; + cmd.raw = 0; + cmd.address = 0x4; + cmd.data = 0; + wilc_sdio_cmd52(&cmd); - return cmd.data; -#else - u32 reg; + return cmd.data; + } else { + u32 reg; - if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, ®)) { - g_sdio.dPrint(N_ERR, "[wilc spi]: Failed read reg (%08x)...\n", WILC_HOST_RX_CTRL_0); - return 0; + if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, ®)) { + g_sdio.dPrint(N_ERR, "[wilc spi]: Failed read reg (%08x)...\n", WILC_HOST_RX_CTRL_0); + return 0; + } + reg &= ~0x1; + sdio_write_reg(WILC_HOST_RX_CTRL_0, reg); + return 1; } - reg &= ~0x1; - sdio_write_reg(WILC_HOST_RX_CTRL_0, reg); - return 1; -#endif } @@ -455,8 +454,7 @@ static int sdio_sync(void) return 0; } -#ifdef WILC_SDIO_IRQ_GPIO - { + if (g_sdio.irq_gpio) { u32 reg; int ret; @@ -490,7 +488,6 @@ static int sdio_sync(void) return 0; } } -#endif return 1; } @@ -504,6 +501,7 @@ static int sdio_init(struct wilc *wilc, wilc_debug_func func) memset(&g_sdio, 0, sizeof(wilc_sdio_t)); g_sdio.dPrint = func; + g_sdio.irq_gpio = (wilc->dev_irq_num); if (!wilc_sdio_init()) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed io init bus...\n"); @@ -662,36 +660,33 @@ static int sdio_read_int(u32 *int_status) /** * Read IRQ flags **/ -#ifndef WILC_SDIO_IRQ_GPIO - cmd.function = 1; - cmd.address = 0x04; - cmd.data = 0; - wilc_sdio_cmd52(&cmd); - - if (cmd.data & BIT(0)) - tmp |= INT_0; - if (cmd.data & BIT(2)) - tmp |= INT_1; - if (cmd.data & BIT(3)) - tmp |= INT_2; - if (cmd.data & BIT(4)) - tmp |= INT_3; - if (cmd.data & BIT(5)) - tmp |= INT_4; - if (cmd.data & BIT(6)) - tmp |= INT_5; - { + if (!g_sdio.irq_gpio) { int i; + cmd.function = 1; + cmd.address = 0x04; + cmd.data = 0; + wilc_sdio_cmd52(&cmd); + + if (cmd.data & BIT(0)) + tmp |= INT_0; + if (cmd.data & BIT(2)) + tmp |= INT_1; + if (cmd.data & BIT(3)) + tmp |= INT_2; + if (cmd.data & BIT(4)) + tmp |= INT_3; + if (cmd.data & BIT(5)) + tmp |= INT_4; + if (cmd.data & BIT(6)) + tmp |= INT_5; for (i = g_sdio.nint; i < MAX_NUM_INT; i++) { if ((tmp >> (IRG_FLAGS_OFFSET + i)) & 0x1) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Unexpected interrupt (1) : tmp=%x, data=%x\n", tmp, cmd.data); break; } } - } -#else - { + } else { u32 irq_flags; cmd.read_write = 0; @@ -704,8 +699,6 @@ static int sdio_read_int(u32 *int_status) tmp |= ((irq_flags >> 0) << IRG_FLAGS_OFFSET); } -#endif - *int_status = tmp; return 1; @@ -718,16 +711,14 @@ static int sdio_clear_int_ext(u32 val) if (g_sdio.has_thrpt_enh3) { u32 reg; -#ifdef WILC_SDIO_IRQ_GPIO - { + if (g_sdio.irq_gpio) { u32 flags; flags = val & (BIT(MAX_NUN_INT_THRPT_ENH2) - 1); reg = flags; + } else { + reg = 0; } -#else - reg = 0; -#endif /* select VMM table 0 */ if ((val & SEL_VMM_TBL0) == SEL_VMM_TBL0) reg |= BIT(5); @@ -754,8 +745,7 @@ static int sdio_clear_int_ext(u32 val) } } else { -#ifdef WILC_SDIO_IRQ_GPIO - { + if (g_sdio.irq_gpio) { /* see below. has_thrpt_enh2 uses register 0xf8 to clear interrupts. */ /* Cannot clear multiple interrupts. Must clear each interrupt individually */ u32 flags; @@ -795,7 +785,6 @@ static int sdio_clear_int_ext(u32 val) } } } -#endif /* WILC_SDIO_IRQ_GPIO */ { u32 vmm_ctl; @@ -862,8 +851,7 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */) return 0; } -#ifdef WILC_SDIO_IRQ_GPIO - { + if (g_sdio.irq_gpio) { u32 reg; int ret, i; @@ -915,7 +903,6 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */) } } } -#endif /* WILC_SDIO_IRQ_GPIO */ return 1; } diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index eae9ce175351..92f4cb71608d 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -158,10 +158,9 @@ struct wilc_vif { struct wilc { int io_type; int mac_status; + int gpio; bool initialized; - #if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO) - unsigned short dev_irq_num; - #endif + int dev_irq_num; int close; u8 vif_num; struct wilc_vif vif[NUM_CONCURRENT_IFC]; @@ -213,7 +212,7 @@ void linux_wlan_rx_complete(void); void linux_wlan_dbg(u8 *buff); int linux_wlan_lock_timeout(void *vp, u32 timeout); void wilc_netdev_cleanup(struct wilc *wilc); -int wilc_netdev_init(struct wilc **wilc, struct device *, int io_type); +int wilc_netdev_init(struct wilc **wilc, struct device *, int io_type, int gpio); void wilc1000_wlan_deinit(struct net_device *dev); void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size); u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value); diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 2958689a13c6..3d53550149fb 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1174,9 +1174,6 @@ void wilc_handle_isr(void *wilc) wilc_sleeptimer_isr_ext(int_status); if (!(int_status & (ALL_INT_EXT))) { -#ifdef WILC_SDIO - PRINT_D(TX_DBG, ">> UNKNOWN_INTERRUPT - 0x%08x\n", int_status); -#endif wilc_unknown_isr_ext(); } release_bus(RELEASE_ALLOW_SLEEP); @@ -1267,9 +1264,8 @@ int wilc_wlan_start(void) return ret; } reg = 0; -#ifdef WILC_SDIO_IRQ_GPIO - reg |= WILC_HAVE_SDIO_IRQ_GPIO; -#endif + if (p->io_type == HIF_SDIO && wilc_dev->dev_irq_num) + reg |= WILC_HAVE_SDIO_IRQ_GPIO; #ifdef WILC_DISABLE_PMU #else From 7d37a4a1b48ff6c365f6fd3d74ebe043cb8cb8a7 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 16 Nov 2015 15:05:05 +0100 Subject: [PATCH 546/843] staging/wilc1000: pass hif operations through initialization The wilc_hif_spi and wilc_hif_sdio structures are part of the bus specific code, and the generic code should have no knowledge of their addresses. This changes the code to reference them only from the bus specific initialization code, which we can then use to split up the driver into separate modules. Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 4 ++- drivers/staging/wilc1000/linux_wlan_sdio.c | 3 +- drivers/staging/wilc1000/linux_wlan_spi.c | 2 +- drivers/staging/wilc1000/wilc_sdio.c | 35 +++++++++---------- drivers/staging/wilc1000/wilc_spi.c | 34 +++++++++--------- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 4 ++- drivers/staging/wilc1000/wilc_wlan.c | 15 ++------ drivers/staging/wilc1000/wilc_wlan.h | 4 +-- 8 files changed, 47 insertions(+), 54 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index e81e90678d0f..2fb1d97bded1 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1408,7 +1408,8 @@ void wilc_netdev_cleanup(struct wilc *wilc) #endif } -int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, int gpio) +int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, + int gpio, const struct wilc_hif_func *ops) { int i; perInterface_wlan_t *nic; @@ -1423,6 +1424,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, int gp *wilc = wilc_dev; wilc_dev->io_type = io_type; wilc_dev->gpio = gpio; + wilc_dev->ops = ops; register_inetaddr_notifier(&g_dev_notifier); diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index 732b0d66366b..f4250fda6cf1 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -119,7 +119,8 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id PRINT_D(INIT_DBG, "Initializing netdev\n"); wilc_sdio_func = func; - if (wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, gpio)) { + if (wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, gpio, + &wilc_hif_sdio)) { PRINT_ER("Couldn't initialize netdev\n"); return -1; } diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index f4dda4a6fa7b..a7a52593156a 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -404,7 +404,7 @@ static int __init init_wilc_spi_driver(void) wilc_debugfs_init(); - ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, GPIO_NUM); + ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, GPIO_NUM, &wilc_hif_spi); if (ret) { wilc_debugfs_remove(); return ret; diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index 8441fcccccc4..006aae4679cb 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -912,23 +912,22 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */) * ********************************************/ -struct wilc_hif_func wilc_hif_sdio = { - sdio_init, - sdio_deinit, - sdio_read_reg, - sdio_write_reg, - sdio_read, - sdio_write, - sdio_sync, - sdio_clear_int, - sdio_read_int, - sdio_clear_int_ext, - sdio_read_size, - sdio_write, - sdio_read, - sdio_sync_ext, - - sdio_set_max_speed, - sdio_set_default_speed, +const struct wilc_hif_func wilc_hif_sdio = { + .hif_init = sdio_init, + .hif_deinit = sdio_deinit, + .hif_read_reg = sdio_read_reg, + .hif_write_reg = sdio_write_reg, + .hif_block_rx = sdio_read, + .hif_block_tx = sdio_write, + .hif_sync = sdio_sync, + .hif_clear_int = sdio_clear_int, + .hif_read_int = sdio_read_int, + .hif_clear_int_ext = sdio_clear_int_ext, + .hif_read_size = sdio_read_size, + .hif_block_tx_ext = sdio_write, + .hif_block_rx_ext = sdio_read, + .hif_sync_ext = sdio_sync_ext, + .hif_set_max_bus_speed = sdio_set_max_speed, + .hif_set_default_bus_speed = sdio_set_default_speed, }; diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index dc9cdf5e4065..39dd75665ba7 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -1021,21 +1021,21 @@ static int wilc_spi_sync_ext(int nint /* how mant interrupts to enable. */) * Global spi HIF function table * ********************************************/ -struct wilc_hif_func wilc_hif_spi = { - _wilc_spi_init, - _wilc_spi_deinit, - wilc_spi_read_reg, - wilc_spi_write_reg, - _wilc_spi_read, - _wilc_spi_write, - wilc_spi_sync, - wilc_spi_clear_int, - wilc_spi_read_int, - wilc_spi_clear_int_ext, - wilc_spi_read_size, - _wilc_spi_write, - _wilc_spi_read, - wilc_spi_sync_ext, - wilc_spi_max_bus_speed, - wilc_spi_default_bus_speed, +const struct wilc_hif_func wilc_hif_spi = { + .hif_init = _wilc_spi_init, + .hif_deinit = _wilc_spi_deinit, + .hif_read_reg = wilc_spi_read_reg, + .hif_write_reg = wilc_spi_write_reg, + .hif_block_rx = _wilc_spi_read, + .hif_block_tx = _wilc_spi_write, + .hif_sync = wilc_spi_sync, + .hif_clear_int = wilc_spi_clear_int, + .hif_read_int = wilc_spi_read_int, + .hif_clear_int_ext = wilc_spi_clear_int_ext, + .hif_read_size = wilc_spi_read_size, + .hif_block_tx_ext = _wilc_spi_write, + .hif_block_rx_ext = _wilc_spi_read, + .hif_sync_ext = wilc_spi_sync_ext, + .hif_set_max_bus_speed = wilc_spi_max_bus_speed, + .hif_set_default_bus_speed = wilc_spi_default_bus_speed, }; diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 92f4cb71608d..761bc3f59138 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -156,6 +156,7 @@ struct wilc_vif { }; struct wilc { + const struct wilc_hif_func *ops; int io_type; int mac_status; int gpio; @@ -212,7 +213,8 @@ void linux_wlan_rx_complete(void); void linux_wlan_dbg(u8 *buff); int linux_wlan_lock_timeout(void *vp, u32 timeout); void wilc_netdev_cleanup(struct wilc *wilc); -int wilc_netdev_init(struct wilc **wilc, struct device *, int io_type, int gpio); +int wilc_netdev_init(struct wilc **wilc, struct device *, int io_type, int gpio, + const struct wilc_hif_func *ops); void wilc1000_wlan_deinit(struct net_device *dev); void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size); u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value); diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 3d53550149fb..5e37ec65d3bb 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1657,22 +1657,11 @@ int wilc_wlan_init(struct net_device *dev) memset((void *)&g_wlan, 0, sizeof(wilc_wlan_dev_t)); g_wlan.io_type = wilc->io_type; - -#ifdef WILC_SDIO - if (!wilc_hif_sdio.hif_init(wilc, wilc_debug)) { + g_wlan.hif_func = *wilc->ops; + if (!g_wlan.hif_func.hif_init(wilc, wilc_debug)) { ret = -EIO; goto _fail_; } - memcpy((void *)&g_wlan.hif_func, &wilc_hif_sdio, - sizeof(struct wilc_hif_func)); -#else - if (!wilc_hif_spi.hif_init(wilc, wilc_debug)) { - ret = -EIO; - goto _fail_; - } - memcpy((void *)&g_wlan.hif_func, &wilc_hif_spi, - sizeof(struct wilc_hif_func)); -#endif if (!wilc_wlan_cfg_init(wilc_debug)) { ret = -ENOBUFS; diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 326d71bf91df..c0a5a955b1d4 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -258,8 +258,8 @@ struct wilc_hif_func { void (*hif_set_default_bus_speed)(void); }; -extern struct wilc_hif_func wilc_hif_spi; -extern struct wilc_hif_func wilc_hif_sdio; +extern const struct wilc_hif_func wilc_hif_spi; +extern const struct wilc_hif_func wilc_hif_sdio; /******************************************** * From 5547c1f09c070f74978f3cb6c74556b3c5d5d09c Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 16 Nov 2015 15:05:06 +0100 Subject: [PATCH 547/843] staging/wilc1000: turn enable_irq/disable_irq into callbacks As a preparation for turning the SDIO side of wilc1000 into a separate module, this removes the last direct caller from the core module into the sdio specific portion. All calls to wilc_sdio_enable_interrupt() and wilc_sdio_disable_interrupt() now go through a function pointer in wilc_hif_func. We also change arguments slightly to pass the device, as we are already touching those lines and the change will be needed later to remove the global variables. Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 22 +++++++++++++--------- drivers/staging/wilc1000/linux_wlan_sdio.c | 21 +++++++++++---------- drivers/staging/wilc1000/linux_wlan_sdio.h | 4 ++-- drivers/staging/wilc1000/wilc_sdio.c | 2 ++ drivers/staging/wilc1000/wilc_wlan.h | 2 ++ 5 files changed, 30 insertions(+), 21 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 2fb1d97bded1..1b6e1eec2446 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -25,8 +25,6 @@ #include -#include "linux_wlan_sdio.h" - static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr); static struct notifier_block g_dev_notifier = { @@ -739,9 +737,10 @@ void wilc1000_wlan_deinit(struct net_device *dev) #endif PRINT_D(INIT_DBG, "Disabling IRQ\n"); - if (!wl->dev_irq_num) { + if (!wl->dev_irq_num && + wl->ops->disable_interrupt) { mutex_lock(&wl->hif_cs); - wilc_sdio_disable_interrupt(); + wl->ops->disable_interrupt(wl); mutex_unlock(&wl->hif_cs); } if (&wl->txq_event) @@ -758,11 +757,13 @@ void wilc1000_wlan_deinit(struct net_device *dev) PRINT_D(INIT_DBG, "Deinitializing WILC Wlan\n"); wilc_wlan_cleanup(dev); #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31) - if (!wl->dev_irq_num) { + if (!wl->dev_irq_num && + wl->ops->disable_interrupt) { + PRINT_D(INIT_DBG, "Disabling IRQ 2\n"); mutex_lock(&wl->hif_cs); - wilc_sdio_disable_interrupt(); + wl->ops->disable_interrupt(wl); mutex_unlock(&wl->hif_cs); } #endif @@ -897,7 +898,9 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) goto _fail_wilc_wlan_; } - if (!wl->dev_irq_num && wilc_sdio_enable_interrupt()) { + if (!wl->dev_irq_num && + wl->ops->enable_interrupt && + wl->ops->enable_interrupt(wl)) { PRINT_ER("couldn't initialize IRQ\n"); ret = -EIO; goto _fail_irq_init_; @@ -950,8 +953,9 @@ _fail_fw_start_: wilc_wlan_stop(); _fail_irq_enable_: - if (!wl->dev_irq_num) - wilc_sdio_disable_interrupt(); + if (!wl->dev_irq_num && + wl->ops->disable_interrupt) + wl->ops->disable_interrupt(wl); _fail_irq_init_: if (wl->dev_irq_num) deinit_irq(dev); diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index f4250fda6cf1..9072de43bcd9 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -1,5 +1,4 @@ #include "wilc_wfi_netdevice.h" -#include "linux_wlan_sdio.h" #include #include @@ -8,7 +7,7 @@ #include #include - +#include "linux_wlan_sdio.h" #define SDIO_MODALIAS "wilc1000_sdio" @@ -143,13 +142,14 @@ static struct sdio_driver wilc_bus = { .remove = linux_sdio_remove, }; -int wilc_sdio_enable_interrupt(void) +int wilc_sdio_enable_interrupt(struct wilc *dev) { + struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev); int ret = 0; - sdio_claim_host(wilc_sdio_func); - ret = sdio_claim_irq(wilc_sdio_func, wilc_sdio_interrupt); - sdio_release_host(wilc_sdio_func); + sdio_claim_host(func); + ret = sdio_claim_irq(func, wilc_sdio_interrupt); + sdio_release_host(func); if (ret < 0) { PRINT_ER("can't claim sdio_irq, err(%d)\n", ret); @@ -158,18 +158,19 @@ int wilc_sdio_enable_interrupt(void) return ret; } -void wilc_sdio_disable_interrupt(void) +void wilc_sdio_disable_interrupt(struct wilc *dev) { + struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev); int ret; PRINT_D(INIT_DBG, "wilc_sdio_disable_interrupt IN\n"); - sdio_claim_host(wilc_sdio_func); - ret = sdio_release_irq(wilc_sdio_func); + sdio_claim_host(func); + ret = sdio_release_irq(func); if (ret < 0) { PRINT_ER("can't release sdio_irq, err(%d)\n", ret); } - sdio_release_host(wilc_sdio_func); + sdio_release_host(func); PRINT_D(INIT_DBG, "wilc_sdio_disable_interrupt OUT\n"); } diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h b/drivers/staging/wilc1000/linux_wlan_sdio.h index df733c25e770..d7b213a7b18d 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.h +++ b/drivers/staging/wilc1000/linux_wlan_sdio.h @@ -4,8 +4,8 @@ int wilc_sdio_init(void); int wilc_sdio_cmd52(sdio_cmd52_t *cmd); int wilc_sdio_cmd53(sdio_cmd53_t *cmd); -int wilc_sdio_enable_interrupt(void); -void wilc_sdio_disable_interrupt(void); +int wilc_sdio_enable_interrupt(struct wilc *); +void wilc_sdio_disable_interrupt(struct wilc *); int wilc_sdio_set_max_speed(void); int wilc_sdio_set_default_speed(void); diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index 006aae4679cb..f550ce059c15 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -929,5 +929,7 @@ const struct wilc_hif_func wilc_hif_sdio = { .hif_sync_ext = sdio_sync_ext, .hif_set_max_bus_speed = sdio_set_max_speed, .hif_set_default_bus_speed = sdio_set_default_speed, + .enable_interrupt = wilc_sdio_enable_interrupt, + .disable_interrupt = wilc_sdio_disable_interrupt, }; diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index c0a5a955b1d4..44a590f80def 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -256,6 +256,8 @@ struct wilc_hif_func { int (*hif_sync_ext)(int); void (*hif_set_max_bus_speed)(void); void (*hif_set_default_bus_speed)(void); + int (*enable_interrupt)(struct wilc *nic); + void (*disable_interrupt)(struct wilc *nic); }; extern const struct wilc_hif_func wilc_hif_spi; From e28e84d29395278860626bb967286f0e21fe3263 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 16 Nov 2015 15:05:07 +0100 Subject: [PATCH 548/843] staging/wilc1000: remove WILC_SDIO/WILC_SPI macros The last remaining user of WILC_SDIO macro checks for the correct time to wait in an interrupt for the PLL to settle. We can replace this with a runtime check and remove both WILC_SDIO and WILC_SPI, as we no longer need conditional compilation based on the hardware type. Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/Makefile | 3 +-- drivers/staging/wilc1000/wilc_wlan.c | 5 ++++- drivers/staging/wilc1000/wilc_wlan.h | 7 ++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile index fe480c76c521..dcba27bd3bce 100644 --- a/drivers/staging/wilc1000/Makefile +++ b/drivers/staging/wilc1000/Makefile @@ -1,7 +1,6 @@ obj-$(CONFIG_WILC1000) += wilc1000.o -ccflags-$(CONFIG_WILC1000_SDIO) += -DWILC_SDIO -DCOMPLEMENT_BOOT -ccflags-$(CONFIG_WILC1000_SPI) += -DWILC_SPI +ccflags-$(CONFIG_WILC1000_SDIO) += -DCOMPLEMENT_BOOT ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \ -DAP_FIRMWARE=\"atmel/wilc1000_ap_fw.bin\" \ diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 5e37ec65d3bb..f72f976906cc 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1067,7 +1067,10 @@ static void wilc_pllupdate_isr_ext(u32 int_stats) g_wlan.hif_func.hif_clear_int_ext(PLL_INT_CLR); - mdelay(WILC_PLL_TO); + if (g_wlan.io_type == HIF_SDIO) + mdelay(WILC_PLL_TO_SDIO); + else + mdelay(WILC_PLL_TO_SPI); while (!(ISWILC1000(wilc_get_chipid(true)) && --trials)) { PRINT_D(TX_DBG, "PLL update retrying\n"); diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 44a590f80def..90ef650e722d 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -134,11 +134,8 @@ #define WILC_CFG_RSP_STATUS 2 #define WILC_CFG_RSP_SCAN 3 -#ifdef WILC_SDIO -#define WILC_PLL_TO 4 -#else -#define WILC_PLL_TO 2 -#endif +#define WILC_PLL_TO_SDIO 4 +#define WILC_PLL_TO_SPI 2 #define ABORT_INT BIT(31) /*******************************************/ From 750ffe9bdc9605193178c9b20147f83c6f52d3ef Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 16 Nov 2015 15:05:08 +0100 Subject: [PATCH 549/843] staging/wilc1000: split out bus specific modules The SPI and SDIO specific code is now separate enough that we just need to restructure the Makefile and Kconfig logic a bit and export a couple of symbols from the common module to have separate bus glue drivers. Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/Kconfig | 72 +++++++++++-------------- drivers/staging/wilc1000/Makefile | 7 ++- drivers/staging/wilc1000/linux_wlan.c | 4 ++ drivers/staging/wilc1000/wilc_debugfs.c | 2 + drivers/staging/wilc1000/wilc_wlan.c | 1 + 5 files changed, 43 insertions(+), 43 deletions(-) diff --git a/drivers/staging/wilc1000/Kconfig b/drivers/staging/wilc1000/Kconfig index ee51b4278088..2923122346ef 100644 --- a/drivers/staging/wilc1000/Kconfig +++ b/drivers/staging/wilc1000/Kconfig @@ -1,16 +1,39 @@ -config WILC1000_DRIVER - bool "WILC1000 support (WiFi only)" - depends on CFG80211 && WEXT_CORE && INET +config WILC1000 + tristate + select WIRELESS_EXT ---help--- This module only support IEEE 802.11n WiFi. -if WILC1000_DRIVER +config WILC1000_SDIO + tristate "Atmel WILC1000 SDIO (WiFi only)" + depends on CFG80211 && INET && MMC + select WILC1000 + ---help--- + This module adds support for the SDIO interface of adapters using + WILC1000 chipset. The Atmel WILC1000 SDIO is a full speed interface. + It meets SDIO card specification version 2.0. The interface supports + the 1-bit/4-bit SD transfer mode at the clock range of 0-50 MHz. + The host can use this interface to read and write from any register + within the chip as well as configure the WILC1000 for data DMA. + To use this interface, pin9 (SDIO_SPI_CFG) must be grounded. Select + this if your platform is using the SDIO bus. -config WILC1000 - tristate +config WILC1000_SPI + tristate "Atmel WILC1000 SPI (WiFi only)" + depends on CFG80211 && INET && SPI + select WILC1000 + ---help--- + This module adds support for the SPI interface of adapters using + WILC1000 chipset. The Atmel WILC1000 has a Serial Peripheral + Interface (SPI) that operates as a SPI slave. This SPI interface can + be used for control and for serial I/O of 802.11 data. The SPI is a + full-duplex slave synchronous serial interface that is available + immediately following reset when pin 9 (SDIO_SPI_CFG) is tied to + VDDIO. Select this if your platform is using the SPI bus. choice - prompt "Memory Allocation" + prompt "WILC1000 Memory Allocation" + depends on WILC1000 default WILC1000_PREALLOCATE_AT_LOADING_DRIVER config WILC1000_PREALLOCATE_AT_LOADING_DRIVER @@ -29,40 +52,9 @@ config WILC1000_DYNAMICALLY_ALLOCATE_MEMROY when it is required. endchoice -choice - prompt "Bus Type" - default WILC1000_SDIO - -config WILC1000_SDIO - bool "SDIO support" - depends on MMC - select WILC1000 - ---help--- - This module adds support for the SDIO interface of adapters using - WILC1000 chipset. The Atmel WILC1000 SDIO is a full speed interface. - It meets SDIO card specification version 2.0. The interface supports - the 1-bit/4-bit SD transfer mode at the clock range of 0-50 MHz. - The host can use this interface to read and write from any register - within the chip as well as configure the WILC1000 for data DMA. - To use this interface, pin9 (SDIO_SPI_CFG) must be grounded. Select - this if your platform is using the SDIO bus. - -config WILC1000_SPI - depends on SPI - select WILC1000 - bool "SPI support" - ---help--- - This module adds support for the SPI interface of adapters using - WILC1000 chipset. The Atmel WILC1000 has a Serial Peripheral - Interface (SPI) that operates as a SPI slave. This SPI interface can - be used for control and for serial I/O of 802.11 data. The SPI is a - full-duplex slave synchronous serial interface that is available - immediately following reset when pin 9 (SDIO_SPI_CFG) is tied to - VDDIO. Select this if your platform is using the SPI bus. -endchoice config WILC1000_HW_OOB_INTR - bool "Use out of band interrupt" + bool "WILC1000 out of band interrupt" depends on WILC1000_SDIO default n ---help--- @@ -71,5 +63,3 @@ config WILC1000_HW_OOB_INTR mechanism for SDIO host controllers that don't support SDIO interrupt. Select this option If the SDIO host controller in your platform doesn't support SDIO time devision interrupt. - -endif diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile index dcba27bd3bce..198d536da57c 100644 --- a/drivers/staging/wilc1000/Makefile +++ b/drivers/staging/wilc1000/Makefile @@ -21,5 +21,8 @@ wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \ wilc_wlan_cfg.o wilc_debugfs.o \ wilc_wlan.o -wilc1000-$(CONFIG_WILC1000_SDIO) += linux_wlan_sdio.o wilc_sdio.o -wilc1000-$(CONFIG_WILC1000_SPI) += linux_wlan_spi.o wilc_spi.o +obj-$(CONFIG_WILC1000_SDIO) += wilc1000-sdio.o +wilc1000-sdio-objs += linux_wlan_sdio.o wilc_sdio.o + +obj-$(CONFIG_WILC1000_SPI) += wilc1000-spi.o +wilc1000-spi-objs += linux_wlan_spi.o wilc_spi.o diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 1b6e1eec2446..0d6c22ca7920 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -44,6 +44,8 @@ static struct net_device_stats *mac_stats(struct net_device *dev); static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd); static void wilc_set_multicast_list(struct net_device *dev); struct wilc *wilc_dev; +EXPORT_SYMBOL_GPL(wilc_dev); + bool wilc_enable_ps = true; static const struct net_device_ops wilc_netdev_ops = { @@ -1411,6 +1413,7 @@ void wilc_netdev_cleanup(struct wilc *wilc) wilc_debugfs_remove(); #endif } +EXPORT_SYMBOL_GPL(wilc_netdev_cleanup); int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, int gpio, const struct wilc_hif_func *ops) @@ -1487,3 +1490,4 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, return 0; } +EXPORT_SYMBOL_GPL(wilc_netdev_init); diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c index d70f96f475b8..158a1df17195 100644 --- a/drivers/staging/wilc1000/wilc_debugfs.c +++ b/drivers/staging/wilc1000/wilc_debugfs.c @@ -27,7 +27,9 @@ static struct dentry *wilc_dir; #define DBG_REGION_ALL (GENERIC_DBG | HOSTAPD_DBG | HOSTINF_DBG | CORECONFIG_DBG | CFG80211_DBG | INT_DBG | TX_DBG | RX_DBG | LOCK_DBG | INIT_DBG | BUS_DBG | MEM_DBG) #define DBG_LEVEL_ALL (DEBUG | INFO | WRN | ERR) atomic_t WILC_REGION = ATOMIC_INIT(INIT_DBG | GENERIC_DBG | CFG80211_DBG | FIRM_DBG | HOSTAPD_DBG); +EXPORT_SYMBOL_GPL(WILC_REGION); atomic_t WILC_DEBUG_LEVEL = ATOMIC_INIT(ERR); +EXPORT_SYMBOL_GPL(WILC_DEBUG_LEVEL); /* * -------------------------------------------------------------------------------- diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index f72f976906cc..a71901c22653 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1181,6 +1181,7 @@ void wilc_handle_isr(void *wilc) } release_bus(RELEASE_ALLOW_SLEEP); } +EXPORT_SYMBOL_GPL(wilc_handle_isr); int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size) { From c94f05ee6bb5b5fabe730f0a2656643bc43862ed Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 16 Nov 2015 15:05:09 +0100 Subject: [PATCH 550/843] staging/wilc1000: use more regular probing So far, my patches tried to do equivalent conversions of the existing code. This one goes beyond that by restructuring how the devices get probed. In particular, the spi driver no longer creates the netdev until the device is probed, and I've removed the global wilc_sdio_func and wilc_spi_dev variables in favor of retrieving them from the wilc_dev variable that will eventually get passed through all functions instead of using a global. Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 6 +- drivers/staging/wilc1000/linux_wlan_common.h | 12 -- drivers/staging/wilc1000/linux_wlan_sdio.c | 30 ++--- drivers/staging/wilc1000/linux_wlan_spi.c | 126 +++++++------------ drivers/staging/wilc1000/wilc_debugfs.c | 6 +- 5 files changed, 60 insertions(+), 120 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 0d6c22ca7920..c3b521e085f2 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1408,10 +1408,6 @@ void wilc_netdev_cleanup(struct wilc *wilc) } kfree(wilc); - -#if defined(WILC_DEBUGFS) - wilc_debugfs_remove(); -#endif } EXPORT_SYMBOL_GPL(wilc_netdev_cleanup); @@ -1491,3 +1487,5 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, return 0; } EXPORT_SYMBOL_GPL(wilc_netdev_init); + +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/wilc1000/linux_wlan_common.h b/drivers/staging/wilc1000/linux_wlan_common.h index f2ea8280b8f8..72b524a98cba 100644 --- a/drivers/staging/wilc1000/linux_wlan_common.h +++ b/drivers/staging/wilc1000/linux_wlan_common.h @@ -38,9 +38,6 @@ enum debug_region { #define FIRM_DBG (1 << Firmware_debug) #if defined (WILC_DEBUGFS) -int wilc_debugfs_init(void); -void wilc_debugfs_remove(void); - extern atomic_t WILC_REGION; extern atomic_t WILC_DEBUG_LEVEL; @@ -122,15 +119,6 @@ extern atomic_t WILC_DEBUG_LEVEL; printk(__VA_ARGS__); \ } while (0) -static inline int wilc_debugfs_init(void) -{ - return 0; -} - -static inline void wilc_debugfs_remove(void) -{ -} - #endif #define FN_IN /* PRINT_D(">>> \n") */ diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index 9072de43bcd9..1f366b5f0d2d 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -135,12 +135,14 @@ static void linux_sdio_remove(struct sdio_func *func) wilc_netdev_cleanup(sdio_get_drvdata(func)); } -static struct sdio_driver wilc_bus = { +static struct sdio_driver wilc1000_sdio_driver = { .name = SDIO_MODALIAS, .id_table = wilc_sdio_ids, .probe = linux_sdio_probe, .remove = linux_sdio_remove, }; +module_driver(wilc1000_sdio_driver, sdio_register_driver, sdio_unregister_driver); +MODULE_LICENSE("GPL"); int wilc_sdio_enable_interrupt(struct wilc *dev) { @@ -178,14 +180,15 @@ void wilc_sdio_disable_interrupt(struct wilc *dev) static int linux_sdio_set_speed(int speed) { struct mmc_ios ios; + struct sdio_func *func = container_of(wilc_dev->dev, struct sdio_func, dev); - sdio_claim_host(wilc_sdio_func); + sdio_claim_host(func); - memcpy((void *)&ios, (void *)&wilc_sdio_func->card->host->ios, sizeof(struct mmc_ios)); - wilc_sdio_func->card->host->ios.clock = speed; + memcpy((void *)&ios, (void *)&func->card->host->ios, sizeof(struct mmc_ios)); + func->card->host->ios.clock = speed; ios.clock = speed; - wilc_sdio_func->card->host->ops->set_ios(wilc_sdio_func->card->host, &ios); - sdio_release_host(wilc_sdio_func); + func->card->host->ops->set_ios(func->card->host, &ios); + sdio_release_host(func); PRINT_INFO(INIT_DBG, "@@@@@@@@@@@@ change SDIO speed to %d @@@@@@@@@\n", speed); return 1; @@ -193,7 +196,8 @@ static int linux_sdio_set_speed(int speed) static int linux_sdio_get_speed(void) { - return wilc_sdio_func->card->host->ios.clock; + struct sdio_func *func = container_of(wilc_dev->dev, struct sdio_func, dev); + return func->card->host->ios.clock; } int wilc_sdio_init(void) @@ -218,16 +222,4 @@ int wilc_sdio_set_default_speed(void) return linux_sdio_set_speed(sdio_default_speed); } -static int __init init_wilc_sdio_driver(void) -{ - return sdio_register_driver(&wilc_bus); -} -late_initcall(init_wilc_sdio_driver); - -static void __exit exit_wilc_sdio_driver(void) -{ - sdio_unregister_driver(&wilc_bus); -} -module_exit(exit_wilc_sdio_driver); - MODULE_LICENSE("GPL"); diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index a7a52593156a..1d8922d6eb6a 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "linux_wlan_spi.h" #include "wilc_wfi_netdevice.h" @@ -43,59 +44,53 @@ static u32 SPEED = MIN_SPEED; -struct spi_device *wilc_spi_dev; +static const struct wilc1000_ops wilc1000_spi_ops; -static int __init wilc_bus_probe(struct spi_device *spi) +static int wilc_bus_probe(struct spi_device *spi) { + int ret, gpio; + struct wilc *wilc; - PRINT_D(BUS_DBG, "spiModalias: %s\n", spi->modalias); - PRINT_D(BUS_DBG, "spiMax-Speed: %d\n", spi->max_speed_hz); - wilc_spi_dev = spi; + gpio = of_get_gpio(spi->dev.of_node, 0); + if (gpio < 0) + gpio = GPIO_NUM; - printk("Driver Initializing success\n"); - return 0; -} + ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, GPIO_NUM, &wilc_hif_spi); + if (ret) + return ret; -static int __exit wilc_bus_remove(struct spi_device *spi) -{ + spi_set_drvdata(spi, wilc); + wilc->dev = &spi->dev; return 0; } -#ifdef CONFIG_OF +static int wilc_bus_remove(struct spi_device *spi) +{ + wilc_netdev_cleanup(spi_get_drvdata(spi)); + return 0; +} + static const struct of_device_id wilc1000_of_match[] = { { .compatible = "atmel,wilc_spi", }, {} }; MODULE_DEVICE_TABLE(of, wilc1000_of_match); -#endif -static struct spi_driver wilc_bus __refdata = { +struct spi_driver wilc1000_spi_driver = { .driver = { .name = MODALIAS, -#ifdef CONFIG_OF .of_match_table = wilc1000_of_match, -#endif }, .probe = wilc_bus_probe, - .remove = __exit_p(wilc_bus_remove), + .remove = wilc_bus_remove, }; +module_spi_driver(wilc1000_spi_driver); +MODULE_LICENSE("GPL"); int wilc_spi_init(void) { - int ret = 1; - static int called; - - - if (called == 0) { - called++; - ret = spi_register_driver(&wilc_bus); - } - - /* change return value to match WILC interface */ - (ret < 0) ? (ret = 0) : (ret = 1); - - return ret; + return 1; } #if defined(PLAT_WMS8304) @@ -106,6 +101,7 @@ int wilc_spi_init(void) int wilc_spi_write(u8 *b, u32 len) { + struct spi_device *spi = to_spi_device(wilc_dev->dev); int ret; if (len > 0 && b != NULL) { @@ -132,11 +128,11 @@ int wilc_spi_write(u8 *b, u32 len) memset(&msg, 0, sizeof(msg)); spi_message_init(&msg); - msg.spi = wilc_spi_dev; + msg.spi = spi; msg.is_dma_mapped = USE_SPI_DMA; spi_message_add_tail(&tr, &msg); - ret = spi_sync(wilc_spi_dev, &msg); + ret = spi_sync(spi, &msg); if (ret < 0) { PRINT_ER("SPI transaction failed\n"); } @@ -157,11 +153,11 @@ int wilc_spi_write(u8 *b, u32 len) memset(&msg, 0, sizeof(msg)); spi_message_init(&msg); - msg.spi = wilc_spi_dev; + msg.spi = spi; msg.is_dma_mapped = USE_SPI_DMA; /* rachel */ spi_message_add_tail(&tr, &msg); - ret = spi_sync(wilc_spi_dev, &msg); + ret = spi_sync(spi, &msg); if (ret < 0) { PRINT_ER("SPI transaction failed\n"); } @@ -183,7 +179,7 @@ int wilc_spi_write(u8 *b, u32 len) #else int wilc_spi_write(u8 *b, u32 len) { - + struct spi_device *spi = to_spi_device(wilc_dev->dev); int ret; struct spi_message msg; @@ -204,12 +200,12 @@ int wilc_spi_write(u8 *b, u32 len) memset(&msg, 0, sizeof(msg)); spi_message_init(&msg); /* [[johnny add */ - msg.spi = wilc_spi_dev; + msg.spi = spi; msg.is_dma_mapped = USE_SPI_DMA; /* ]] */ spi_message_add_tail(&tr, &msg); - ret = spi_sync(wilc_spi_dev, &msg); + ret = spi_sync(spi, &msg); if (ret < 0) { PRINT_ER("SPI transaction failed\n"); } @@ -234,6 +230,7 @@ int wilc_spi_write(u8 *b, u32 len) int wilc_spi_read(u8 *rb, u32 rlen) { + struct spi_device *spi = to_spi_device(wilc_dev->dev); int ret; if (rlen > 0) { @@ -260,11 +257,11 @@ int wilc_spi_read(u8 *rb, u32 rlen) memset(&msg, 0, sizeof(msg)); spi_message_init(&msg); - msg.spi = wilc_spi_dev; + msg.spi = spi; msg.is_dma_mapped = USE_SPI_DMA; spi_message_add_tail(&tr, &msg); - ret = spi_sync(wilc_spi_dev, &msg); + ret = spi_sync(spi, &msg); if (ret < 0) { PRINT_ER("SPI transaction failed\n"); } @@ -284,11 +281,11 @@ int wilc_spi_read(u8 *rb, u32 rlen) memset(&msg, 0, sizeof(msg)); spi_message_init(&msg); - msg.spi = wilc_spi_dev; + msg.spi = spi; msg.is_dma_mapped = USE_SPI_DMA; /* rachel */ spi_message_add_tail(&tr, &msg); - ret = spi_sync(wilc_spi_dev, &msg); + ret = spi_sync(spi, &msg); if (ret < 0) { PRINT_ER("SPI transaction failed\n"); } @@ -308,7 +305,7 @@ int wilc_spi_read(u8 *rb, u32 rlen) #else int wilc_spi_read(u8 *rb, u32 rlen) { - + struct spi_device *spi = to_spi_device(wilc_dev->dev); int ret; if (rlen > 0) { @@ -329,12 +326,12 @@ int wilc_spi_read(u8 *rb, u32 rlen) memset(&msg, 0, sizeof(msg)); spi_message_init(&msg); /* [[ johnny add */ - msg.spi = wilc_spi_dev; + msg.spi = spi; msg.is_dma_mapped = USE_SPI_DMA; /* ]] */ spi_message_add_tail(&tr, &msg); - ret = spi_sync(wilc_spi_dev, &msg); + ret = spi_sync(spi, &msg); if (ret < 0) { PRINT_ER("SPI transaction failed\n"); } @@ -353,7 +350,7 @@ int wilc_spi_read(u8 *rb, u32 rlen) int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen) { - + struct spi_device *spi = to_spi_device(wilc_dev->dev); int ret; if (rlen > 0) { @@ -370,11 +367,11 @@ int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen) memset(&msg, 0, sizeof(msg)); spi_message_init(&msg); - msg.spi = wilc_spi_dev; + msg.spi = spi; msg.is_dma_mapped = USE_SPI_DMA; spi_message_add_tail(&tr, &msg); - ret = spi_sync(wilc_spi_dev, &msg); + ret = spi_sync(spi, &msg); if (ret < 0) { PRINT_ER("SPI transaction failed\n"); } @@ -395,40 +392,3 @@ int wilc_spi_set_max_speed(void) PRINT_INFO(BUS_DBG, "@@@@@@@@@@@@ change SPI speed to %d @@@@@@@@@\n", SPEED); return 1; } - -static struct wilc *wilc; - -static int __init init_wilc_spi_driver(void) -{ - int ret; - - wilc_debugfs_init(); - - ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, GPIO_NUM, &wilc_hif_spi); - if (ret) { - wilc_debugfs_remove(); - return ret; - } - - if (!wilc_spi_init() || !wilc_spi_dev) { - PRINT_ER("Can't initialize SPI\n"); - wilc_netdev_cleanup(wilc); - wilc_debugfs_remove(); - return -ENXIO; - } - wilc_dev->dev = &wilc_spi_dev->dev; - - return ret; -} -late_initcall(init_wilc_spi_driver); - -static void __exit exit_wilc_spi_driver(void) -{ - if (wilc) - wilc_netdev_cleanup(wilc); - spi_unregister_driver(&wilc_bus); - wilc_debugfs_remove(); -} -module_exit(exit_wilc_spi_driver); - -MODULE_LICENSE("GPL"); diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c index 158a1df17195..27c653a0cdf9 100644 --- a/drivers/staging/wilc1000/wilc_debugfs.c +++ b/drivers/staging/wilc1000/wilc_debugfs.c @@ -138,7 +138,7 @@ static struct wilc_debugfs_info_t debugfs_info[] = { { "wilc_debug_region", 0666, (INIT_DBG | GENERIC_DBG | CFG80211_DBG), FOPS(NULL, wilc_debug_region_read, wilc_debug_region_write, NULL), }, }; -int wilc_debugfs_init(void) +static int __init wilc_debugfs_init(void) { int i; @@ -173,11 +173,13 @@ int wilc_debugfs_init(void) } return 0; } +module_init(wilc_debugfs_init); -void wilc_debugfs_remove(void) +static void __exit wilc_debugfs_remove(void) { debugfs_remove_recursive(wilc_dir); } +module_exit(wilc_debugfs_remove); #endif From 562ed3f1f78a87746f128c313a5f92083ecb9408 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 16 Nov 2015 15:05:10 +0100 Subject: [PATCH 551/843] staging/wilc1000: pass struct wilc to most linux_wlan.c functions We want to get rid of all global variables in this driver, and instead pass device structures from one function to another. This changes the linux_wlan.c and wilc_wlan.c to do this for the most part. There are a few exceptions where these functions are themselves called from another part of the driver that does not have an instance pointer at hand. Changing those would be a follow-up step. There are a few other globals that will have to get moved into struct wilc at a later point. Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 2 +- drivers/staging/wilc1000/linux_wlan.c | 55 ++++--- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 12 +- drivers/staging/wilc1000/wilc_wlan.c | 145 +++++++++--------- drivers/staging/wilc1000/wilc_wlan.h | 10 +- 5 files changed, 119 insertions(+), 105 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index d968483c6f00..640cb6bdf523 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2905,7 +2905,7 @@ static int hostIFthread(void *pvArg) del_timer(&hif_drv->scan_timer); PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); - if (!wilc_wlan_get_num_conn_ifcs()) + if (!wilc_wlan_get_num_conn_ifcs(wilc_dev)) wilc_chip_sleep_manually(); Handle_ScanDone(msg.drv, SCAN_EVENT_DONE); diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index c3b521e085f2..89b5aca2115c 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -245,13 +245,14 @@ static void deinit_irq(struct net_device *dev) } } -void linux_wlan_dbg(u8 *buff) +void wilc_dbg(struct wilc *wilc, u8 *buff) { PRINT_D(INIT_DBG, "%d\n", *buff); } -int linux_wlan_lock_timeout(void *vp, u32 timeout) +int wilc_lock_timeout(struct wilc *nic, void *vp, u32 timeout) { + /* FIXME: replace with mutex_lock or wait_for_completion */ int error = -1; PRINT_D(LOCK_DBG, "Locking %p\n", vp); @@ -263,7 +264,7 @@ int linux_wlan_lock_timeout(void *vp, u32 timeout) return error; } -void linux_wlan_mac_indicate(struct wilc *wilc, int flag) +void wilc_mac_indicate(struct wilc *wilc, int flag) { int status; @@ -328,14 +329,14 @@ int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid) return ret; } -int wilc_wlan_get_num_conn_ifcs(void) +int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc) { u8 i = 0; u8 null_bssid[6] = {0}; u8 ret_val = 0; - for (i = 0; i < wilc_dev->vif_num; i++) - if (memcmp(wilc_dev->vif[i].bssid, null_bssid, 6)) + for (i = 0; i < wilc->vif_num; i++) + if (memcmp(wilc->vif[i].bssid, null_bssid, 6)) ret_val++; return ret_val; @@ -411,7 +412,7 @@ static int linux_wlan_txq_task(void *vp) return 0; } -void linux_wlan_rx_complete(void) +void wilc_rx_complete(struct wilc *nic) { PRINT_D(RX_DBG, "RX completed\n"); } @@ -468,14 +469,14 @@ static int linux_wlan_start_firmware(struct net_device *dev) wilc = nic->wilc; PRINT_D(INIT_DBG, "Starting Firmware ...\n"); - ret = wilc_wlan_start(); + ret = wilc_wlan_start(wilc); if (ret < 0) { PRINT_ER("Failed to start Firmware\n"); return ret; } PRINT_D(INIT_DBG, "Waiting for Firmware to get ready ...\n"); - ret = linux_wlan_lock_timeout(&wilc->sync_event, 5000); + ret = wilc_lock_timeout(wilc, &wilc->sync_event, 5000); if (ret) { PRINT_D(INIT_DBG, "Firmware start timed out"); return ret; @@ -485,7 +486,7 @@ static int linux_wlan_start_firmware(struct net_device *dev) return 0; } -static int linux_wlan_firmware_download(struct net_device *dev) +static int wilc1000_firmware_download(struct net_device *dev) { perInterface_wlan_t *nic; struct wilc *wilc; @@ -499,7 +500,7 @@ static int linux_wlan_firmware_download(struct net_device *dev) return -ENOBUFS; } PRINT_D(INIT_DBG, "Downloading Firmware ...\n"); - ret = wilc_wlan_firmware_download(wilc->firmware->data, + ret = wilc_wlan_firmware_download(wilc, wilc->firmware->data, wilc->firmware->size); if (ret < 0) return ret; @@ -754,7 +755,7 @@ void wilc1000_wlan_deinit(struct net_device *dev) PRINT_D(INIT_DBG, "Deinitializing IRQ\n"); deinit_irq(dev); - wilc_wlan_stop(); + wilc_wlan_stop(wl); PRINT_D(INIT_DBG, "Deinitializing WILC Wlan\n"); wilc_wlan_cleanup(dev); @@ -914,7 +915,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) goto _fail_irq_enable_; } - ret = linux_wlan_firmware_download(dev); + ret = wilc1000_firmware_download(dev); if (ret < 0) { PRINT_ER("Failed to download firmware\n"); ret = -EIO; @@ -952,7 +953,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) return 0; _fail_fw_start_: - wilc_wlan_stop(); + wilc_wlan_stop(wl); _fail_irq_enable_: if (!wl->dev_irq_num && @@ -985,6 +986,7 @@ static int mac_init_fn(struct net_device *ndev) int wilc_mac_open(struct net_device *ndev) { perInterface_wlan_t *nic; + struct wilc *wilc; unsigned char mac_add[ETH_ALEN] = {0}; int ret = 0; @@ -1001,6 +1003,7 @@ int wilc_mac_open(struct net_device *ndev) } nic = netdev_priv(ndev); + wilc = nic->wilc; priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy); PRINT_D(INIT_DBG, "MAC OPEN[%p]\n", ndev); @@ -1314,7 +1317,7 @@ done: return ret; } -void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset) +void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset) { unsigned int frame_len = 0; int stats; @@ -1393,7 +1396,7 @@ void wilc_netdev_cleanup(struct wilc *wilc) release_firmware(wilc->firmware); if (wilc && (wilc->vif[0].ndev || wilc->vif[1].ndev)) { - linux_wlan_lock_timeout(&close_exit_sync, 12 * 1000); + wilc_lock_timeout(wilc, &close_exit_sync, 12 * 1000); for (i = 0; i < NUM_CONCURRENT_IFC; i++) if (wilc->vif[i].ndev) @@ -1417,17 +1420,18 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, int i; perInterface_wlan_t *nic; struct net_device *ndev; + struct wilc *wl; sema_init(&close_exit_sync, 0); - wilc_dev = kzalloc(sizeof(*wilc_dev), GFP_KERNEL); - if (!wilc_dev) + wl = kzalloc(sizeof(*wilc_dev), GFP_KERNEL); + if (!wl) return -ENOMEM; - *wilc = wilc_dev; - wilc_dev->io_type = io_type; - wilc_dev->gpio = gpio; - wilc_dev->ops = ops; + *wilc = wl; + wl->io_type = io_type; + wl->gpio = gpio; + wl->ops = ops; register_inetaddr_notifier(&g_dev_notifier); @@ -1446,11 +1450,11 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, else strcpy(ndev->name, "p2p%d"); - nic->u8IfIdx = wilc_dev->vif_num; + nic->u8IfIdx = wl->vif_num; nic->wilc_netdev = ndev; nic->wilc = *wilc; - wilc_dev->vif[wilc_dev->vif_num].ndev = ndev; - wilc_dev->vif_num++; + wl->vif[wl->vif_num].ndev = ndev; + wl->vif_num++; ndev->netdev_ops = &wilc_netdev_ops; { @@ -1483,6 +1487,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, nic->iftype = STATION_MODE; nic->mac_opened = 0; } + wilc_dev = *wilc = wl; return 0; } diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 761bc3f59138..6ec6d6a2868c 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -207,11 +207,12 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic); extern struct wilc *wilc_dev; extern struct net_device *WILC_WFI_devs[]; -void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset); -void linux_wlan_mac_indicate(struct wilc *wilc, int flag); -void linux_wlan_rx_complete(void); -void linux_wlan_dbg(u8 *buff); -int linux_wlan_lock_timeout(void *vp, u32 timeout); +void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset); +void wilc_mac_indicate(struct wilc *wilc, int flag); +void wilc_rx_complete(struct wilc *wilc); +void wilc_dbg(struct wilc *, u8 *buff); + +int wilc_lock_timeout(struct wilc *wilc, void *, u32 timeout); void wilc_netdev_cleanup(struct wilc *wilc); int wilc_netdev_init(struct wilc **wilc, struct device *, int io_type, int gpio, const struct wilc_hif_func *ops); @@ -220,4 +221,5 @@ void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size); u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value); int wilc_wlan_get_firmware(struct net_device *dev); int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid); + #endif diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index a71901c22653..df8503f83a12 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -40,6 +40,7 @@ static inline void chip_allow_sleep(void); static inline void chip_wakeup(void); static u32 dbgflag = N_INIT | N_ERR | N_INTR | N_TXQ | N_RXQ; +/* FIXME: replace with dev_debug() */ static void wilc_debug(u32 flag, char *fmt, ...) { char buf[256]; @@ -50,15 +51,15 @@ static void wilc_debug(u32 flag, char *fmt, ...) vsprintf(buf, fmt, args); va_end(args); - linux_wlan_dbg(buf); + wilc_dbg(wilc_dev, buf); } } static CHIP_PS_STATE_T chip_ps_state = CHIP_WAKEDUP; -static inline void acquire_bus(BUS_ACQUIRE_T acquire) +static inline void acquire_bus(struct wilc *wilc, BUS_ACQUIRE_T acquire) { - mutex_lock(&wilc_dev->hif_cs); + mutex_lock(&wilc->hif_cs); #ifndef WILC_OPTIMIZE_SLEEP_INT if (chip_ps_state != CHIP_WAKEDUP) #endif @@ -68,13 +69,13 @@ static inline void acquire_bus(BUS_ACQUIRE_T acquire) } } -static inline void release_bus(BUS_RELEASE_T release) +static inline void release_bus(struct wilc *wilc, BUS_RELEASE_T release) { #ifdef WILC_OPTIMIZE_SLEEP_INT if (release == RELEASE_ALLOW_SLEEP) chip_allow_sleep(); #endif - mutex_unlock(&wilc_dev->hif_cs); + mutex_unlock(&wilc->hif_cs); } #ifdef TCP_ACK_FILTER @@ -159,15 +160,15 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev, up(&wilc->txq_event); } -static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe) +static int wilc_wlan_txq_add_to_head(struct wilc *wilc, struct txq_entry_t *tqe) { wilc_wlan_dev_t *p = &g_wlan; unsigned long flags; - if (linux_wlan_lock_timeout(&wilc_dev->txq_add_to_head_cs, + if (wilc_lock_timeout(wilc, &wilc->txq_add_to_head_cs, CFG_PKTS_TIMEOUT)) return -1; - spin_lock_irqsave(&wilc_dev->txq_spinlock, flags); + spin_lock_irqsave(&wilc->txq_spinlock, flags); if (!p->txq_head) { tqe->next = NULL; @@ -183,9 +184,9 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe) p->txq_entries += 1; PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", p->txq_entries); - spin_unlock_irqrestore(&wilc_dev->txq_spinlock, flags); - up(&wilc_dev->txq_add_to_head_cs); - up(&wilc_dev->txq_event); + spin_unlock_irqrestore(&wilc->txq_spinlock, flags); + up(&wilc->txq_add_to_head_cs); + up(&wilc->txq_event); PRINT_D(TX_DBG, "Wake up the txq_handler\n"); return 0; @@ -255,14 +256,14 @@ static inline int add_tcp_pending_ack(u32 ack, u32 session_index, } return 0; } -static inline int remove_TCP_related(void) +static inline int remove_TCP_related(struct wilc *wilc) { wilc_wlan_dev_t *p = &g_wlan; unsigned long flags; - spin_lock_irqsave(&wilc_dev->txq_spinlock, flags); + spin_lock_irqsave(&wilc->txq_spinlock, flags); - spin_unlock_irqrestore(&wilc_dev->txq_spinlock, flags); + spin_unlock_irqrestore(&wilc->txq_spinlock, flags); return 0; } @@ -281,7 +282,6 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe) nic = netdev_priv(dev); wilc = nic->wilc; - spin_lock_irqsave(&wilc->txq_spinlock, flags); eth_hdr_ptr = &buffer[0]; h_proto = ntohs(*((unsigned short *)ð_hdr_ptr[12])); @@ -377,7 +377,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) spin_unlock_irqrestore(&wilc->txq_spinlock, p->txq_spinlock_flags); while (dropped > 0) { - linux_wlan_lock_timeout(&wilc->txq_event, 1); + wilc_lock_timeout(wilc, &wilc->txq_event, 1); dropped--; } @@ -399,7 +399,7 @@ static bool is_tcp_ack_filter_enabled(void) } #endif -static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 buffer_size) +static int wilc_wlan_txq_add_cfg_pkt(struct wilc *wilc, u8 *buffer, u32 buffer_size) { wilc_wlan_dev_t *p = &g_wlan; struct txq_entry_t *tqe; @@ -407,7 +407,7 @@ static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 buffer_size) PRINT_D(TX_DBG, "Adding config packet ...\n"); if (p->quit) { PRINT_D(TX_DBG, "Return due to clear function\n"); - up(&wilc_dev->cfg_event); + up(&wilc->cfg_event); return 0; } @@ -427,7 +427,7 @@ static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 buffer_size) #endif PRINT_D(TX_DBG, "Adding the config packet at the Queue tail\n"); - if (wilc_wlan_txq_add_to_head(tqe)) + if (wilc_wlan_txq_add_to_head(wilc, tqe)) return 0; return 1; } @@ -682,7 +682,7 @@ void wilc_chip_sleep_manually(void) { if (chip_ps_state != CHIP_WAKEDUP) return; - acquire_bus(ACQUIRE_ONLY); + acquire_bus(wilc_dev, ACQUIRE_ONLY); #ifdef WILC_OPTIMIZE_SLEEP_INT chip_allow_sleep(); @@ -690,7 +690,7 @@ void wilc_chip_sleep_manually(void) g_wlan.hif_func.hif_write_reg(0x10a8, 1); chip_ps_state = CHIP_SLEEPING_MANUAL; - release_bus(RELEASE_ONLY); + release_bus(wilc_dev, RELEASE_ONLY); } int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) @@ -718,7 +718,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) if (p->quit) break; - linux_wlan_lock_timeout(&wilc->txq_add_to_head_cs, + wilc_lock_timeout(wilc, &wilc->txq_add_to_head_cs, CFG_PKTS_TIMEOUT); #ifdef TCP_ACK_FILTER wilc_wlan_txq_filter_dup_tcp_ack(dev); @@ -775,7 +775,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) PRINT_D(TX_DBG, "Mark the last entry in VMM table - number of previous entries = %d\n", i); vmm_table[i] = 0x0; } - acquire_bus(ACQUIRE_AND_WAKEUP); + acquire_bus(wilc, ACQUIRE_AND_WAKEUP); counter = 0; do { ret = p->hif_func.hif_read_reg(WILC_HOST_TX_CTRL, ®); @@ -796,9 +796,9 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) break; } PRINT_WRN(GENERIC_DBG, "[wilc txq]: warn, vmm table not clear yet, wait...\n"); - release_bus(RELEASE_ALLOW_SLEEP); + release_bus(wilc, RELEASE_ALLOW_SLEEP); usleep_range(3000, 3000); - acquire_bus(ACQUIRE_AND_WAKEUP); + acquire_bus(wilc, ACQUIRE_AND_WAKEUP); } } while (!p->quit); @@ -829,9 +829,9 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) entries = ((reg >> 3) & 0x3f); break; } else { - release_bus(RELEASE_ALLOW_SLEEP); + release_bus(wilc, RELEASE_ALLOW_SLEEP); usleep_range(3000, 3000); - acquire_bus(ACQUIRE_AND_WAKEUP); + acquire_bus(wilc, ACQUIRE_AND_WAKEUP); PRINT_WRN(GENERIC_DBG, "Can't get VMM entery - reg = %2x\n", reg); } } while (--timeout); @@ -871,7 +871,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) goto _end_; } - release_bus(RELEASE_ALLOW_SLEEP); + release_bus(wilc, RELEASE_ALLOW_SLEEP); offset = 0; i = 0; @@ -926,7 +926,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) } } while (--entries); - acquire_bus(ACQUIRE_AND_WAKEUP); + acquire_bus(wilc, ACQUIRE_AND_WAKEUP); ret = p->hif_func.hif_clear_int_ext(ENABLE_TX_VMM); if (!ret) { @@ -942,7 +942,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) _end_: - release_bus(RELEASE_ALLOW_SLEEP); + release_bus(wilc, RELEASE_ALLOW_SLEEP); if (ret != 1) break; } while (0); @@ -1016,7 +1016,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) } else { if (!is_cfg_packet) { if (pkt_len > 0) { - frmw_to_linux(wilc, + wilc_frmw_to_linux(wilc, &buffer[offset], pkt_len, pkt_offset); @@ -1031,10 +1031,10 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) if (p->cfg_seq_no == rsp.seq_no) up(&wilc->cfg_event); } else if (rsp.type == WILC_CFG_RSP_STATUS) { - linux_wlan_mac_indicate(wilc, WILC_MAC_INDICATE_STATUS); + wilc_mac_indicate(wilc, WILC_MAC_INDICATE_STATUS); } else if (rsp.type == WILC_CFG_RSP_SCAN) { - linux_wlan_mac_indicate(wilc, WILC_MAC_INDICATE_SCAN); + wilc_mac_indicate(wilc, WILC_MAC_INDICATE_SCAN); } } } @@ -1048,7 +1048,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) kfree(rqe); if (has_packet) - linux_wlan_rx_complete(); + wilc_rx_complete(wilc); } while (1); @@ -1157,11 +1157,11 @@ _end_: wilc_wlan_handle_rxq(wilc); } -void wilc_handle_isr(void *wilc) +void wilc_handle_isr(struct wilc *wilc) { u32 int_status; - acquire_bus(ACQUIRE_AND_WAKEUP); + acquire_bus(wilc, ACQUIRE_AND_WAKEUP); g_wlan.hif_func.hif_read_int(&int_status); if (int_status & PLL_INT_EXT) @@ -1179,11 +1179,11 @@ void wilc_handle_isr(void *wilc) if (!(int_status & (ALL_INT_EXT))) { wilc_unknown_isr_ext(); } - release_bus(RELEASE_ALLOW_SLEEP); + release_bus(wilc, RELEASE_ALLOW_SLEEP); } EXPORT_SYMBOL_GPL(wilc_handle_isr); -int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size) +int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 buffer_size) { wilc_wlan_dev_t *p = &g_wlan; u32 offset; @@ -1210,7 +1210,7 @@ int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size) addr = BYTE_SWAP(addr); size = BYTE_SWAP(size); #endif - acquire_bus(ACQUIRE_ONLY); + acquire_bus(wilc, ACQUIRE_ONLY); offset += 8; while (((int)size) && (offset < buffer_size)) { if (size <= blksz) @@ -1227,7 +1227,7 @@ int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size) offset += size2; size -= size2; } - release_bus(RELEASE_ONLY); + release_bus(wilc, RELEASE_ONLY); if (!ret) { ret = -EIO; @@ -1246,7 +1246,7 @@ _fail_1: return (ret < 0) ? ret : 0; } -int wilc_wlan_start(void) +int wilc_wlan_start(struct wilc *wilc) { wilc_wlan_dev_t *p = &g_wlan; u32 reg = 0; @@ -1259,16 +1259,16 @@ int wilc_wlan_start(void) } else if (p->io_type == HIF_SPI) { reg = 1; } - acquire_bus(ACQUIRE_ONLY); + acquire_bus(wilc, ACQUIRE_ONLY); ret = p->hif_func.hif_write_reg(WILC_VMM_CORE_CFG, reg); if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail write reg vmm_core_cfg...\n"); - release_bus(RELEASE_ONLY); + release_bus(wilc, RELEASE_ONLY); ret = -EIO; return ret; } reg = 0; - if (p->io_type == HIF_SDIO && wilc_dev->dev_irq_num) + if (p->io_type == HIF_SDIO && wilc->dev_irq_num) reg |= WILC_HAVE_SDIO_IRQ_GPIO; #ifdef WILC_DISABLE_PMU @@ -1297,7 +1297,7 @@ int wilc_wlan_start(void) ret = p->hif_func.hif_write_reg(WILC_GP_REG_1, reg); if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail write WILC_GP_REG_1 ...\n"); - release_bus(RELEASE_ONLY); + release_bus(wilc, RELEASE_ONLY); ret = -EIO; return ret; } @@ -1307,7 +1307,7 @@ int wilc_wlan_start(void) ret = p->hif_func.hif_read_reg(0x1000, &chipid); if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail read reg 0x1000 ...\n"); - release_bus(RELEASE_ONLY); + release_bus(wilc, RELEASE_ONLY); ret = -EIO; return ret; } @@ -1322,32 +1322,32 @@ int wilc_wlan_start(void) reg |= BIT(10); ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg); p->hif_func.hif_read_reg(WILC_GLB_RESET_0, ®); - release_bus(RELEASE_ONLY); + release_bus(wilc, RELEASE_ONLY); return (ret < 0) ? ret : 0; } -void wilc_wlan_global_reset(void) +void wilc_wlan_global_reset(struct wilc *wilc) { wilc_wlan_dev_t *p = &g_wlan; - acquire_bus(ACQUIRE_AND_WAKEUP); + acquire_bus(wilc, ACQUIRE_AND_WAKEUP); p->hif_func.hif_write_reg(WILC_GLB_RESET_0, 0x0); - release_bus(RELEASE_ONLY); + release_bus(wilc, RELEASE_ONLY); } -int wilc_wlan_stop(void) +int wilc_wlan_stop(struct wilc *wilc) { wilc_wlan_dev_t *p = &g_wlan; u32 reg = 0; int ret; u8 timeout = 10; - acquire_bus(ACQUIRE_AND_WAKEUP); + acquire_bus(wilc, ACQUIRE_AND_WAKEUP); ret = p->hif_func.hif_read_reg(WILC_GLB_RESET_0, ®); if (!ret) { PRINT_ER("Error while reading reg\n"); - release_bus(RELEASE_ALLOW_SLEEP); + release_bus(wilc, RELEASE_ALLOW_SLEEP); return ret; } @@ -1355,7 +1355,7 @@ int wilc_wlan_stop(void) ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg); if (!ret) { PRINT_ER("Error while writing reg\n"); - release_bus(RELEASE_ALLOW_SLEEP); + release_bus(wilc, RELEASE_ALLOW_SLEEP); return ret; } @@ -1363,7 +1363,7 @@ int wilc_wlan_stop(void) ret = p->hif_func.hif_read_reg(WILC_GLB_RESET_0, ®); if (!ret) { PRINT_ER("Error while reading reg\n"); - release_bus(RELEASE_ALLOW_SLEEP); + release_bus(wilc, RELEASE_ALLOW_SLEEP); return ret; } PRINT_D(GENERIC_DBG, "Read RESET Reg %x : Retry%d\n", @@ -1381,7 +1381,7 @@ int wilc_wlan_stop(void) ret = p->hif_func.hif_read_reg(WILC_GLB_RESET_0, ®); if (!ret) { PRINT_ER("Error while reading reg\n"); - release_bus(RELEASE_ALLOW_SLEEP); + release_bus(wilc, RELEASE_ALLOW_SLEEP); return ret; } PRINT_D(GENERIC_DBG, "Read RESET Reg %x : Retry%d\n", @@ -1398,7 +1398,7 @@ int wilc_wlan_stop(void) ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg); - release_bus(RELEASE_ALLOW_SLEEP); + release_bus(wilc, RELEASE_ALLOW_SLEEP); return ret; } @@ -1442,24 +1442,24 @@ void wilc_wlan_cleanup(struct net_device *dev) #endif kfree(p->tx_buffer); - acquire_bus(ACQUIRE_AND_WAKEUP); + acquire_bus(wilc, ACQUIRE_AND_WAKEUP); ret = p->hif_func.hif_read_reg(WILC_GP_REG_0, ®); if (!ret) { PRINT_ER("Error while reading reg\n"); - release_bus(RELEASE_ALLOW_SLEEP); + release_bus(wilc, RELEASE_ALLOW_SLEEP); } PRINT_ER("Writing ABORT reg\n"); ret = p->hif_func.hif_write_reg(WILC_GP_REG_0, (reg | ABORT_INT)); if (!ret) { PRINT_ER("Error while writing reg\n"); - release_bus(RELEASE_ALLOW_SLEEP); + release_bus(wilc, RELEASE_ALLOW_SLEEP); } - release_bus(RELEASE_ALLOW_SLEEP); + release_bus(wilc, RELEASE_ALLOW_SLEEP); p->hif_func.hif_deinit(NULL); } -static int wilc_wlan_cfg_commit(int type, u32 drv_handler) +static int wilc_wlan_cfg_commit(struct wilc *wilc, int type, u32 drv_handler) { wilc_wlan_dev_t *p = &g_wlan; struct wilc_cfg_frame *cfg = &p->cfg_frame; @@ -1480,7 +1480,7 @@ static int wilc_wlan_cfg_commit(int type, u32 drv_handler) cfg->wid_header[7] = (u8)(driver_handler >> 24); p->cfg_seq_no = seq_no; - if (!wilc_wlan_txq_add_cfg_pkt(&cfg->wid_header[0], total_len)) + if (!wilc_wlan_txq_add_cfg_pkt(wilc, &cfg->wid_header[0], total_len)) return -1; return 0; @@ -1490,6 +1490,7 @@ int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, int commit, u32 drv_handler) { wilc_wlan_dev_t *p = &g_wlan; + struct wilc *wilc = wilc_dev; u32 offset; int ret_size; @@ -1511,10 +1512,10 @@ int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, PRINT_D(RX_DBG, "Processing cfg_set()\n"); p->cfg_frame_in_use = 1; - if (wilc_wlan_cfg_commit(WILC_CFG_SET, drv_handler)) + if (wilc_wlan_cfg_commit(wilc, WILC_CFG_SET, drv_handler)) ret_size = 0; - if (linux_wlan_lock_timeout(&wilc_dev->cfg_event, + if (wilc_lock_timeout(wilc, &wilc->cfg_event, CFG_PKTS_TIMEOUT)) { PRINT_D(TX_DBG, "Set Timed Out\n"); ret_size = 0; @@ -1530,6 +1531,7 @@ int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drv_handler) { wilc_wlan_dev_t *p = &g_wlan; + struct wilc *wilc = wilc_dev; u32 offset; int ret_size; @@ -1547,10 +1549,10 @@ int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drv_handler) if (commit) { p->cfg_frame_in_use = 1; - if (wilc_wlan_cfg_commit(WILC_CFG_QUERY, drv_handler)) + if (wilc_wlan_cfg_commit(wilc, WILC_CFG_QUERY, drv_handler)) ret_size = 0; - if (linux_wlan_lock_timeout(&wilc_dev->cfg_event, + if (wilc_lock_timeout(wilc, &wilc->cfg_event, CFG_PKTS_TIMEOUT)) { PRINT_D(TX_DBG, "Get Timed Out\n"); ret_size = 0; @@ -1587,8 +1589,13 @@ static u32 init_chip(struct net_device *dev) { u32 chipid; u32 reg, ret = 0; + perInterface_wlan_t *nic; + struct wilc *wilc; - acquire_bus(ACQUIRE_ONLY); + nic = netdev_priv(dev); + wilc = nic->wilc; + + acquire_bus(wilc, ACQUIRE_ONLY); chipid = wilc_get_chipid(true); @@ -1611,7 +1618,7 @@ static u32 init_chip(struct net_device *dev) } } - release_bus(RELEASE_ONLY); + release_bus(wilc, RELEASE_ONLY); return ret; } diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 90ef650e722d..20bca44bc8ba 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -283,13 +283,13 @@ struct wilc_cfg_rsp { struct wilc; -int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size); -int wilc_wlan_start(void); -int wilc_wlan_stop(void); +int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 buffer_size); +int wilc_wlan_start(struct wilc *); +int wilc_wlan_stop(struct wilc *); int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, u32 buffer_size, wilc_tx_complete_func_t func); int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count); -void wilc_handle_isr(void *wilc); +void wilc_handle_isr(struct wilc *wilc); void wilc_wlan_cleanup(struct net_device *dev); int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, int commit, u32 drv_handler); @@ -300,7 +300,7 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, void wilc_chip_sleep_manually(void); void wilc_enable_tcp_ack_filter(bool value); -int wilc_wlan_get_num_conn_ifcs(void); +int wilc_wlan_get_num_conn_ifcs(struct wilc *); int wilc_mac_xmit(struct sk_buff *skb, struct net_device *dev); int wilc_mac_open(struct net_device *ndev); From 49645e5c87fbb51f0608218f78325996ce8401f8 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Wed, 18 Nov 2015 15:11:22 +0900 Subject: [PATCH 552/843] staging: wilc1000: remove sdio speed control codes This patch removes spi speed control related functions and variable. We cannot get exact clock what we need in this way and it can causes some problem in host side by setting the clock, so remove the codes. Speed control codes in spi also will removed in next patch, so it's ok to remove functions in linux_wlan.c and wilc_wlan.c which also not used anymore. The Following functions and varialbe are removed. MAX_SPEED, sdio_default_speed wilc_bus_set_default_speed wilc_bus_set_max_speed linux_sdio_set_speed linux_sdio_get_speed wilc_sdio_set_max_speed wilc_sdio_set_default_speed Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 8 ---- drivers/staging/wilc1000/linux_wlan_sdio.c | 52 ---------------------- drivers/staging/wilc1000/linux_wlan_sdio.h | 3 -- drivers/staging/wilc1000/wilc_sdio.c | 12 ----- drivers/staging/wilc1000/wilc_wlan.c | 10 ----- 5 files changed, 85 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 89b5aca2115c..ab17110fb17e 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -733,12 +733,6 @@ void wilc1000_wlan_deinit(struct net_device *dev) if (wl->initialized) { netdev_info(dev, "Deinitializing wilc1000...\n"); -#if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31) - PRINT_D(INIT_DBG, "skip wilc_bus_set_default_speed\n"); -#else - wilc_bus_set_default_speed(); -#endif - PRINT_D(INIT_DBG, "Disabling IRQ\n"); if (!wl->dev_irq_num && wl->ops->disable_interrupt) { @@ -929,8 +923,6 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) goto _fail_irq_enable_; } - wilc_bus_set_max_speed(); - if (wilc_wlan_cfg_get(1, WID_FIRMWARE_VERSION, 1, 0)) { int size; char Firmware_ver[20]; diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index 1f366b5f0d2d..761cb3ddd132 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -11,19 +11,7 @@ #define SDIO_MODALIAS "wilc1000_sdio" -#if defined(CUSTOMER_PLATFORM) -/* TODO : User have to stable bus clock as user's environment. */ - #ifdef MAX_BUS_SPEED - #define MAX_SPEED MAX_BUS_SPEED - #else - #define MAX_SPEED 50000000 - #endif -#else - #define MAX_SPEED (6 * 1000000) /* Max 50M */ -#endif - static struct sdio_func *wilc_sdio_func; -static unsigned int sdio_default_speed; #define SDIO_VENDOR_ID_WILC 0x0296 #define SDIO_DEVICE_ID_WILC 0x5347 @@ -177,49 +165,9 @@ void wilc_sdio_disable_interrupt(struct wilc *dev) PRINT_D(INIT_DBG, "wilc_sdio_disable_interrupt OUT\n"); } -static int linux_sdio_set_speed(int speed) -{ - struct mmc_ios ios; - struct sdio_func *func = container_of(wilc_dev->dev, struct sdio_func, dev); - - sdio_claim_host(func); - - memcpy((void *)&ios, (void *)&func->card->host->ios, sizeof(struct mmc_ios)); - func->card->host->ios.clock = speed; - ios.clock = speed; - func->card->host->ops->set_ios(func->card->host, &ios); - sdio_release_host(func); - PRINT_INFO(INIT_DBG, "@@@@@@@@@@@@ change SDIO speed to %d @@@@@@@@@\n", speed); - - return 1; -} - -static int linux_sdio_get_speed(void) -{ - struct sdio_func *func = container_of(wilc_dev->dev, struct sdio_func, dev); - return func->card->host->ios.clock; -} - int wilc_sdio_init(void) { - - /** - * TODO : - **/ - - - sdio_default_speed = linux_sdio_get_speed(); return 1; } -int wilc_sdio_set_max_speed(void) -{ - return linux_sdio_set_speed(MAX_SPEED); -} - -int wilc_sdio_set_default_speed(void) -{ - return linux_sdio_set_speed(sdio_default_speed); -} - MODULE_LICENSE("GPL"); diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h b/drivers/staging/wilc1000/linux_wlan_sdio.h index d7b213a7b18d..dbe911a9ae3d 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.h +++ b/drivers/staging/wilc1000/linux_wlan_sdio.h @@ -6,6 +6,3 @@ int wilc_sdio_cmd53(sdio_cmd53_t *cmd); int wilc_sdio_enable_interrupt(struct wilc *); void wilc_sdio_disable_interrupt(struct wilc *); -int wilc_sdio_set_max_speed(void); -int wilc_sdio_set_default_speed(void); - diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index f550ce059c15..b0454a7e78a5 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -610,16 +610,6 @@ _fail_: return 0; } -static void sdio_set_max_speed(void) -{ - wilc_sdio_set_max_speed(); -} - -static void sdio_set_default_speed(void) -{ - wilc_sdio_set_default_speed(); -} - static int sdio_read_size(u32 *size) { @@ -927,8 +917,6 @@ const struct wilc_hif_func wilc_hif_sdio = { .hif_block_tx_ext = sdio_write, .hif_block_rx_ext = sdio_read, .hif_sync_ext = sdio_sync_ext, - .hif_set_max_bus_speed = sdio_set_max_speed, - .hif_set_default_bus_speed = sdio_set_default_speed, .enable_interrupt = wilc_sdio_enable_interrupt, .disable_interrupt = wilc_sdio_disable_interrupt, }; diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index df8503f83a12..114ea9535f79 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1575,16 +1575,6 @@ int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size) return ret; } -void wilc_bus_set_max_speed(void) -{ - g_wlan.hif_func.hif_set_max_bus_speed(); -} - -void wilc_bus_set_default_speed(void) -{ - g_wlan.hif_func.hif_set_default_bus_speed(); -} - static u32 init_chip(struct net_device *dev) { u32 chipid; From 4c885c6b2617809474499912e3d51e73339640be Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Wed, 18 Nov 2015 15:11:23 +0900 Subject: [PATCH 553/843] staging: wilc1000: remove spi speed control codes This patch removes spi speed control codes. We are not using define SPEED to specify speed of spi, it is not proper way of doing this. It will be provided by the device tree. The following functions and variable are removed. MIN_SPEED, MAX_SPEED, SPEED wilc_spi_set_max_speed wilc_spi_max_bus_speed wilc_spi_default_bus_speed hif_set_max_bus_speed hif_set_default_bus_speed Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan_spi.c | 42 ----------------------- drivers/staging/wilc1000/linux_wlan_spi.h | 2 -- drivers/staging/wilc1000/wilc_spi.c | 11 ------ drivers/staging/wilc1000/wilc_wlan.h | 2 -- 4 files changed, 57 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index 1d8922d6eb6a..5e3bff05a95f 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -17,33 +17,6 @@ #define USE_SPI_DMA 0 /* johnny add */ -#ifdef WILC_ASIC_A0 - #if defined(PLAT_PANDA_ES_OMAP4460) - #define MIN_SPEED 12000000 - #define MAX_SPEED 24000000 - #elif defined(PLAT_WMS8304) - #define MIN_SPEED 12000000 - #define MAX_SPEED 24000000 /* 4000000 */ - #elif defined(CUSTOMER_PLATFORM) -/* - TODO : define Clock speed under 48M. - * - * ex) - * #define MIN_SPEED 24000000 - * #define MAX_SPEED 48000000 - */ - #else - #define MIN_SPEED 24000000 - #define MAX_SPEED 48000000 - #endif -#else /* WILC_ASIC_A0 */ -/* Limit clk to 6MHz on FPGA. */ - #define MIN_SPEED 6000000 - #define MAX_SPEED 6000000 -#endif /* WILC_ASIC_A0 */ - -static u32 SPEED = MIN_SPEED; - static const struct wilc1000_ops wilc1000_spi_ops; static int wilc_bus_probe(struct spi_device *spi) @@ -119,7 +92,6 @@ int wilc_spi_write(u8 *b, u32 len) struct spi_transfer tr = { .tx_buf = b + (i * TXRX_PHASE_SIZE), .len = TXRX_PHASE_SIZE, - .speed_hz = SPEED, .bits_per_word = 8, .delay_usecs = 0, }; @@ -145,7 +117,6 @@ int wilc_spi_write(u8 *b, u32 len) struct spi_transfer tr = { .tx_buf = b + (blk * TXRX_PHASE_SIZE), .len = remainder, - .speed_hz = SPEED, .bits_per_word = 8, .delay_usecs = 0, }; @@ -187,7 +158,6 @@ int wilc_spi_write(u8 *b, u32 len) struct spi_transfer tr = { .tx_buf = b, .len = len, - .speed_hz = SPEED, .delay_usecs = 0, }; char *r_buffer = kzalloc(len, GFP_KERNEL); @@ -249,7 +219,6 @@ int wilc_spi_read(u8 *rb, u32 rlen) struct spi_transfer tr = { .rx_buf = rb + (i * TXRX_PHASE_SIZE), .len = TXRX_PHASE_SIZE, - .speed_hz = SPEED, .bits_per_word = 8, .delay_usecs = 0, }; @@ -273,7 +242,6 @@ int wilc_spi_read(u8 *rb, u32 rlen) struct spi_transfer tr = { .rx_buf = rb + (blk * TXRX_PHASE_SIZE), .len = remainder, - .speed_hz = SPEED, .bits_per_word = 8, .delay_usecs = 0, }; @@ -313,7 +281,6 @@ int wilc_spi_read(u8 *rb, u32 rlen) struct spi_transfer tr = { .rx_buf = rb, .len = rlen, - .speed_hz = SPEED, .delay_usecs = 0, }; @@ -359,7 +326,6 @@ int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen) .rx_buf = rb, .tx_buf = wb, .len = rlen, - .speed_hz = SPEED, .bits_per_word = 8, .delay_usecs = 0, @@ -384,11 +350,3 @@ int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen) return ret; } - -int wilc_spi_set_max_speed(void) -{ - SPEED = MAX_SPEED; - - PRINT_INFO(BUS_DBG, "@@@@@@@@@@@@ change SPI speed to %d @@@@@@@@@\n", SPEED); - return 1; -} diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h b/drivers/staging/wilc1000/linux_wlan_spi.h index f434f79913ab..baa98cc9a247 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.h +++ b/drivers/staging/wilc1000/linux_wlan_spi.h @@ -7,6 +7,4 @@ int wilc_spi_init(void); int wilc_spi_write(u8 *b, u32 len); int wilc_spi_read(u8 *rb, u32 rlen); int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen); -int wilc_spi_set_max_speed(void); - #endif diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index 39dd75665ba7..1c5dcda4b634 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -793,15 +793,6 @@ static int _wilc_spi_init(struct wilc *wilc, wilc_debug_func func) return 1; } -static void wilc_spi_max_bus_speed(void) -{ - wilc_spi_set_max_speed(); -} - -static void wilc_spi_default_bus_speed(void) -{ -} - static int wilc_spi_read_size(u32 *size) { int ret; @@ -1036,6 +1027,4 @@ const struct wilc_hif_func wilc_hif_spi = { .hif_block_tx_ext = _wilc_spi_write, .hif_block_rx_ext = _wilc_spi_read, .hif_sync_ext = wilc_spi_sync_ext, - .hif_set_max_bus_speed = wilc_spi_max_bus_speed, - .hif_set_default_bus_speed = wilc_spi_default_bus_speed, }; diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 20bca44bc8ba..ee13771eb54c 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -251,8 +251,6 @@ struct wilc_hif_func { int (*hif_block_tx_ext)(u32, u8 *, u32); int (*hif_block_rx_ext)(u32, u8 *, u32); int (*hif_sync_ext)(int); - void (*hif_set_max_bus_speed)(void); - void (*hif_set_default_bus_speed)(void); int (*enable_interrupt)(struct wilc *nic); void (*disable_interrupt)(struct wilc *nic); }; From aeed77f42709f0d7a7f6f70dd3a2a2fa63acbee8 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Wed, 18 Nov 2015 15:11:24 +0900 Subject: [PATCH 554/843] staging: wilc1000: remove paltform define PLAT_WMS8304 This patch removes PLAT_WMS8304 and it's related codes as well. We will not use this way of supporting other platform. This will be supported if necessary by device tree later. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan_spi.c | 161 ---------------------- 1 file changed, 161 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index 5e3bff05a95f..bfd3cc391494 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -66,88 +66,6 @@ int wilc_spi_init(void) return 1; } -#if defined(PLAT_WMS8304) -#define TXRX_PHASE_SIZE (4096) -#endif - -#if defined(TXRX_PHASE_SIZE) - -int wilc_spi_write(u8 *b, u32 len) -{ - struct spi_device *spi = to_spi_device(wilc_dev->dev); - int ret; - - if (len > 0 && b != NULL) { - int i = 0; - int blk = len / TXRX_PHASE_SIZE; - int remainder = len % TXRX_PHASE_SIZE; - - char *r_buffer = kzalloc(TXRX_PHASE_SIZE, GFP_KERNEL); - if (!r_buffer) - return -ENOMEM; - - if (blk) { - while (i < blk) { - struct spi_message msg; - struct spi_transfer tr = { - .tx_buf = b + (i * TXRX_PHASE_SIZE), - .len = TXRX_PHASE_SIZE, - .bits_per_word = 8, - .delay_usecs = 0, - }; - - tr.rx_buf = r_buffer; - - memset(&msg, 0, sizeof(msg)); - spi_message_init(&msg); - msg.spi = spi; - msg.is_dma_mapped = USE_SPI_DMA; - - spi_message_add_tail(&tr, &msg); - ret = spi_sync(spi, &msg); - if (ret < 0) { - PRINT_ER("SPI transaction failed\n"); - } - i++; - - } - } - if (remainder) { - struct spi_message msg; - struct spi_transfer tr = { - .tx_buf = b + (blk * TXRX_PHASE_SIZE), - .len = remainder, - .bits_per_word = 8, - .delay_usecs = 0, - }; - tr.rx_buf = r_buffer; - - memset(&msg, 0, sizeof(msg)); - spi_message_init(&msg); - msg.spi = spi; - msg.is_dma_mapped = USE_SPI_DMA; /* rachel */ - - spi_message_add_tail(&tr, &msg); - ret = spi_sync(spi, &msg); - if (ret < 0) { - PRINT_ER("SPI transaction failed\n"); - } - } - kfree(r_buffer); - } else { - PRINT_ER("can't write data with the following length: %d\n", len); - PRINT_ER("FAILED due to NULL buffer or ZERO length check the following length: %d\n", len); - ret = -1; - } - - /* change return value to match WILC interface */ - (ret < 0) ? (ret = 0) : (ret = 1); - - return ret; - -} - -#else int wilc_spi_write(u8 *b, u32 len) { struct spi_device *spi = to_spi_device(wilc_dev->dev); @@ -194,83 +112,6 @@ int wilc_spi_write(u8 *b, u32 len) return ret; } -#endif - -#if defined(TXRX_PHASE_SIZE) - -int wilc_spi_read(u8 *rb, u32 rlen) -{ - struct spi_device *spi = to_spi_device(wilc_dev->dev); - int ret; - - if (rlen > 0) { - int i = 0; - - int blk = rlen / TXRX_PHASE_SIZE; - int remainder = rlen % TXRX_PHASE_SIZE; - - char *t_buffer = kzalloc(TXRX_PHASE_SIZE, GFP_KERNEL); - if (!t_buffer) - return -ENOMEM; - - if (blk) { - while (i < blk) { - struct spi_message msg; - struct spi_transfer tr = { - .rx_buf = rb + (i * TXRX_PHASE_SIZE), - .len = TXRX_PHASE_SIZE, - .bits_per_word = 8, - .delay_usecs = 0, - }; - tr.tx_buf = t_buffer; - - memset(&msg, 0, sizeof(msg)); - spi_message_init(&msg); - msg.spi = spi; - msg.is_dma_mapped = USE_SPI_DMA; - - spi_message_add_tail(&tr, &msg); - ret = spi_sync(spi, &msg); - if (ret < 0) { - PRINT_ER("SPI transaction failed\n"); - } - i++; - } - } - if (remainder) { - struct spi_message msg; - struct spi_transfer tr = { - .rx_buf = rb + (blk * TXRX_PHASE_SIZE), - .len = remainder, - .bits_per_word = 8, - .delay_usecs = 0, - }; - tr.tx_buf = t_buffer; - - memset(&msg, 0, sizeof(msg)); - spi_message_init(&msg); - msg.spi = spi; - msg.is_dma_mapped = USE_SPI_DMA; /* rachel */ - - spi_message_add_tail(&tr, &msg); - ret = spi_sync(spi, &msg); - if (ret < 0) { - PRINT_ER("SPI transaction failed\n"); - } - } - - kfree(t_buffer); - } else { - PRINT_ER("can't read data with the following length: %u\n", rlen); - ret = -1; - } - /* change return value to match WILC interface */ - (ret < 0) ? (ret = 0) : (ret = 1); - - return ret; -} - -#else int wilc_spi_read(u8 *rb, u32 rlen) { struct spi_device *spi = to_spi_device(wilc_dev->dev); @@ -313,8 +154,6 @@ int wilc_spi_read(u8 *rb, u32 rlen) return ret; } -#endif - int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen) { struct spi_device *spi = to_spi_device(wilc_dev->dev); From 00215dde5e386f548227f2d435908b36e3f90f29 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Wed, 18 Nov 2015 15:11:25 +0900 Subject: [PATCH 555/843] staging: wilc1000: pass struct wilc to the functions which use hif_func This patch passes struct wilc to the functions which use hif_func inside. The function pointers of wilc_hif_func will pass wilc also in the later patch. Pass wilc to the functions if necessary. Flollowings are modified functions. chip_wakeup wilc_chip_sleep_manually chip_allow_sleep wilc_get_chipid wilc_unknown_isr_ext wilc_pllupdate_isr_ext wilc_sleeptimer_isr_ext Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 3 +- drivers/staging/wilc1000/linux_wlan.c | 5 +- drivers/staging/wilc1000/wilc_wlan.c | 56 +++++++++++------------ drivers/staging/wilc1000/wilc_wlan.h | 2 +- drivers/staging/wilc1000/wilc_wlan_if.h | 3 +- 5 files changed, 36 insertions(+), 33 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 4acd936fd572..672092b386dc 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2834,6 +2834,7 @@ static int hostIFthread(void *pvArg) u32 u32Ret; struct host_if_msg msg; struct host_if_drv *hif_drv; + struct wilc *wilc = (struct wilc*)pvArg; memset(&msg, 0, sizeof(struct host_if_msg)); @@ -2906,7 +2907,7 @@ static int hostIFthread(void *pvArg) PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); if (!wilc_wlan_get_num_conn_ifcs(wilc_dev)) - wilc_chip_sleep_manually(); + wilc_chip_sleep_manually(wilc); Handle_ScanDone(msg.drv, SCAN_EVENT_DONE); diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index ab17110fb17e..43458e6ca691 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -514,7 +514,8 @@ static int wilc1000_firmware_download(struct net_device *dev) return 0; } -static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_nic) +static int linux_wlan_init_test_config(struct net_device *dev, + struct wilc *wilc) { unsigned char c_val[64]; unsigned char mac_add[] = {0x00, 0x80, 0xC2, 0x5E, 0xa2, 0xff}; @@ -532,7 +533,7 @@ static int linux_wlan_init_test_config(struct net_device *dev, struct wilc *p_ni PRINT_D(INIT_DBG, "MAC address is : %02x-%02x-%02x-%02x-%02x-%02x\n", mac_add[0], mac_add[1], mac_add[2], mac_add[3], mac_add[4], mac_add[5]); - wilc_get_chipid(0); + wilc_get_chipid(wilc, 0); *(int *)c_val = 1; diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 114ea9535f79..e30a34dae231 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -35,9 +35,9 @@ typedef struct { static wilc_wlan_dev_t g_wlan; #ifdef WILC_OPTIMIZE_SLEEP_INT -static inline void chip_allow_sleep(void); +static inline void chip_allow_sleep(struct wilc *wilc); #endif -static inline void chip_wakeup(void); +static inline void chip_wakeup(struct wilc *wilc); static u32 dbgflag = N_INIT | N_ERR | N_INTR | N_TXQ | N_RXQ; /* FIXME: replace with dev_debug() */ @@ -65,7 +65,7 @@ static inline void acquire_bus(struct wilc *wilc, BUS_ACQUIRE_T acquire) #endif { if (acquire == ACQUIRE_AND_WAKEUP) - chip_wakeup(); + chip_wakeup(wilc); } } @@ -73,7 +73,7 @@ static inline void release_bus(struct wilc *wilc, BUS_RELEASE_T release) { #ifdef WILC_OPTIMIZE_SLEEP_INT if (release == RELEASE_ALLOW_SLEEP) - chip_allow_sleep(); + chip_allow_sleep(wilc); #endif mutex_unlock(&wilc->hif_cs); } @@ -562,7 +562,7 @@ static struct rxq_entry_t *wilc_wlan_rxq_remove(struct wilc *wilc) #ifdef WILC_OPTIMIZE_SLEEP_INT -static inline void chip_allow_sleep(void) +static inline void chip_allow_sleep(struct wilc *wilc) { u32 reg = 0; @@ -571,7 +571,7 @@ static inline void chip_allow_sleep(void) g_wlan.hif_func.hif_write_reg(0xf0, reg & ~BIT(0)); } -static inline void chip_wakeup(void) +static inline void chip_wakeup(struct wilc *wilc) { u32 reg, clk_status_reg, trials = 0; u32 sleep_time; @@ -584,12 +584,12 @@ static inline void chip_wakeup(void) do { usleep_range(2 * 1000, 2 * 1000); - if ((wilc_get_chipid(true) == 0)) + if ((wilc_get_chipid(wilc, true) == 0)) wilc_debug(N_ERR, "Couldn't read chip id. Wake up failed\n"); - } while ((wilc_get_chipid(true) == 0) && ((++trials % 3) == 0)); + } while ((wilc_get_chipid(wilc, true) == 0) && ((++trials % 3) == 0)); - } while (wilc_get_chipid(true) == 0); + } while (wilc_get_chipid(wilc, true) == 0); } else if ((g_wlan.io_type & 0x1) == HIF_SDIO) { g_wlan.hif_func.hif_read_reg(0xf0, ®); do { @@ -616,7 +616,7 @@ static inline void chip_wakeup(void) reg &= ~BIT(0); g_wlan.hif_func.hif_write_reg(0x1C0C, reg); - if (wilc_get_chipid(false) >= 0x1002b0) { + if (wilc_get_chipid(wilc, false) >= 0x1002b0) { u32 val32; g_wlan.hif_func.hif_read_reg(0x1e1c, &val32); @@ -631,7 +631,7 @@ static inline void chip_wakeup(void) chip_ps_state = CHIP_WAKEDUP; } #else -static inline void chip_wakeup(void) +static inline void chip_wakeup(struct wilc *wilc) { u32 reg, trials = 0; @@ -651,19 +651,19 @@ static inline void chip_wakeup(void) do { mdelay(3); - if ((wilc_get_chipid(true) == 0)) + if ((wilc_get_chipid(wilc, true) == 0)) wilc_debug(N_ERR, "Couldn't read chip id. Wake up failed\n"); - } while ((wilc_get_chipid(true) == 0) && ((++trials % 3) == 0)); + } while ((wilc_get_chipid(wilc, true) == 0) && ((++trials % 3) == 0)); - } while (wilc_get_chipid(true) == 0); + } while (wilc_get_chipid(wilc, true) == 0); if (chip_ps_state == CHIP_SLEEPING_MANUAL) { g_wlan.hif_func.hif_read_reg(0x1C0C, ®); reg &= ~BIT(0); g_wlan.hif_func.hif_write_reg(0x1C0C, reg); - if (wilc_get_chipid(false) >= 0x1002b0) { + if (wilc_get_chipid(wilc, false) >= 0x1002b0) { u32 val32; g_wlan.hif_func.hif_read_reg(0x1e1c, &val32); @@ -678,19 +678,19 @@ static inline void chip_wakeup(void) chip_ps_state = CHIP_WAKEDUP; } #endif -void wilc_chip_sleep_manually(void) +void wilc_chip_sleep_manually(struct wilc *wilc) { if (chip_ps_state != CHIP_WAKEDUP) return; - acquire_bus(wilc_dev, ACQUIRE_ONLY); + acquire_bus(wilc, ACQUIRE_ONLY); #ifdef WILC_OPTIMIZE_SLEEP_INT - chip_allow_sleep(); + chip_allow_sleep(wilc); #endif g_wlan.hif_func.hif_write_reg(0x10a8, 1); chip_ps_state = CHIP_SLEEPING_MANUAL; - release_bus(wilc_dev, RELEASE_ONLY); + release_bus(wilc, RELEASE_ONLY); } int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) @@ -1056,12 +1056,12 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) PRINT_D(RX_DBG, "THREAD: Exiting RX thread\n"); } -static void wilc_unknown_isr_ext(void) +static void wilc_unknown_isr_ext(struct wilc *wilc) { g_wlan.hif_func.hif_clear_int_ext(0); } -static void wilc_pllupdate_isr_ext(u32 int_stats) +static void wilc_pllupdate_isr_ext(struct wilc *wilc, u32 int_stats) { int trials = 10; @@ -1072,13 +1072,13 @@ static void wilc_pllupdate_isr_ext(u32 int_stats) else mdelay(WILC_PLL_TO_SPI); - while (!(ISWILC1000(wilc_get_chipid(true)) && --trials)) { + while (!(ISWILC1000(wilc_get_chipid(wilc, true)) && --trials)) { PRINT_D(TX_DBG, "PLL update retrying\n"); mdelay(1); } } -static void wilc_sleeptimer_isr_ext(u32 int_stats1) +static void wilc_sleeptimer_isr_ext(struct wilc *wilc, u32 int_stats1) { g_wlan.hif_func.hif_clear_int_ext(SLEEP_INT_CLR); #ifndef WILC_OPTIMIZE_SLEEP_INT @@ -1165,7 +1165,7 @@ void wilc_handle_isr(struct wilc *wilc) g_wlan.hif_func.hif_read_int(&int_status); if (int_status & PLL_INT_EXT) - wilc_pllupdate_isr_ext(int_status); + wilc_pllupdate_isr_ext(wilc, int_status); if (int_status & DATA_INT_EXT) { wilc_wlan_handle_isr_ext(wilc, int_status); @@ -1174,10 +1174,10 @@ void wilc_handle_isr(struct wilc *wilc) #endif } if (int_status & SLEEP_INT_EXT) - wilc_sleeptimer_isr_ext(int_status); + wilc_sleeptimer_isr_ext(wilc, int_status); if (!(int_status & (ALL_INT_EXT))) { - wilc_unknown_isr_ext(); + wilc_unknown_isr_ext(wilc); } release_bus(wilc, RELEASE_ALLOW_SLEEP); } @@ -1587,7 +1587,7 @@ static u32 init_chip(struct net_device *dev) acquire_bus(wilc, ACQUIRE_ONLY); - chipid = wilc_get_chipid(true); + chipid = wilc_get_chipid(wilc, true); if ((chipid & 0xfff) != 0xa0) { ret = g_wlan.hif_func.hif_read_reg(0x1118, ®); @@ -1613,7 +1613,7 @@ static u32 init_chip(struct net_device *dev) return ret; } -u32 wilc_get_chipid(u8 update) +u32 wilc_get_chipid(struct wilc *wilc, u8 update) { static u32 chipid; u32 tempchipid = 0; diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index ee13771eb54c..334abafe3b0f 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -295,7 +295,7 @@ int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drv_handler); int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size); int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, u32 buffer_size, wilc_tx_complete_func_t func); -void wilc_chip_sleep_manually(void); +void wilc_chip_sleep_manually(struct wilc *wilc); void wilc_enable_tcp_ack_filter(bool value); int wilc_wlan_get_num_conn_ifcs(struct wilc *); diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index 2f465f4fb063..618903caff54 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -909,9 +909,10 @@ typedef enum { WID_MAX = 0xFFFF } WID_T; +struct wilc; int wilc_wlan_init(struct net_device *dev); void wilc_bus_set_max_speed(void); void wilc_bus_set_default_speed(void); -u32 wilc_get_chipid(u8 update); +u32 wilc_get_chipid(struct wilc *wilc, u8 update); #endif From 49dcd0dd0e70ee7dc8cd6bf1d16a4c25e1bdfc6f Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Wed, 18 Nov 2015 15:11:26 +0900 Subject: [PATCH 556/843] staging: wilc1000: pass wilc to all function pointers of wilc_hif_func This patch adds new function parameter struct wilc to all function pointers of struct wilc_hif_func, and all functions of wilc_sdio.c and wilc_spi.c need to be changed as it's function pointer is changed. Pass wilc in all the functions call as well. The wilc will be passed to functions in linux_wlan_sdio.c and linux_wlan_spi.c to replace with global variable wilc_dev in the next patch. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_sdio.c | 84 +++++++------- drivers/staging/wilc1000/wilc_spi.c | 113 ++++++++++-------- drivers/staging/wilc1000/wilc_wlan.c | 167 +++++++++++++++------------ drivers/staging/wilc1000/wilc_wlan.h | 26 ++--- 4 files changed, 208 insertions(+), 182 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index b0454a7e78a5..3f8260477f7c 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -26,8 +26,8 @@ typedef struct { static wilc_sdio_t g_sdio; -static int sdio_write_reg(u32 addr, u32 data); -static int sdio_read_reg(u32 addr, u32 *data); +static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data); +static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data); /******************************************** * @@ -35,7 +35,7 @@ static int sdio_read_reg(u32 addr, u32 *data); * ********************************************/ -static int sdio_set_func0_csa_address(u32 adr) +static int sdio_set_func0_csa_address(struct wilc *wilc, u32 adr) { sdio_cmd52_t cmd; @@ -71,7 +71,7 @@ _fail_: return 0; } -static int sdio_set_func0_block_size(u32 block_size) +static int sdio_set_func0_block_size(struct wilc *wilc, u32 block_size) { sdio_cmd52_t cmd; @@ -103,7 +103,7 @@ _fail_: * ********************************************/ -static int sdio_set_func1_block_size(u32 block_size) +static int sdio_set_func1_block_size(struct wilc *wilc, u32 block_size) { sdio_cmd52_t cmd; @@ -128,7 +128,7 @@ _fail_: return 0; } -static int sdio_clear_int(void) +static int sdio_clear_int(struct wilc *wilc) { if (!g_sdio.irq_gpio) { /* u32 sts; */ @@ -145,12 +145,12 @@ static int sdio_clear_int(void) } else { u32 reg; - if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, ®)) { + if (!sdio_read_reg(wilc, WILC_HOST_RX_CTRL_0, ®)) { g_sdio.dPrint(N_ERR, "[wilc spi]: Failed read reg (%08x)...\n", WILC_HOST_RX_CTRL_0); return 0; } reg &= ~0x1; - sdio_write_reg(WILC_HOST_RX_CTRL_0, reg); + sdio_write_reg(wilc, WILC_HOST_RX_CTRL_0, reg); return 1; } @@ -161,7 +161,7 @@ static int sdio_clear_int(void) * Sdio interfaces * ********************************************/ -static int sdio_write_reg(u32 addr, u32 data) +static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data) { #ifdef BIG_ENDIAN data = BYTE_SWAP(data); @@ -185,7 +185,7 @@ static int sdio_write_reg(u32 addr, u32 data) /** * set the AHB address **/ - if (!sdio_set_func0_csa_address(addr)) + if (!sdio_set_func0_csa_address(wilc, addr)) goto _fail_; cmd.read_write = 1; @@ -210,7 +210,7 @@ _fail_: return 0; } -static int sdio_write(u32 addr, u8 *buf, u32 size) +static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) { u32 block_size = g_sdio.block_size; sdio_cmd53_t cmd; @@ -257,7 +257,7 @@ static int sdio_write(u32 addr, u8 *buf, u32 size) cmd.buffer = buf; cmd.block_size = block_size; if (addr > 0) { - if (!sdio_set_func0_csa_address(addr)) + if (!sdio_set_func0_csa_address(wilc, addr)) goto _fail_; } if (!wilc_sdio_cmd53(&cmd)) { @@ -278,7 +278,7 @@ static int sdio_write(u32 addr, u8 *buf, u32 size) cmd.block_size = block_size; /* johnny : prevent it from setting unexpected value */ if (addr > 0) { - if (!sdio_set_func0_csa_address(addr)) + if (!sdio_set_func0_csa_address(wilc, addr)) goto _fail_; } if (!wilc_sdio_cmd53(&cmd)) { @@ -294,7 +294,7 @@ _fail_: return 0; } -static int sdio_read_reg(u32 addr, u32 *data) +static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data) { if ((addr >= 0xf0) && (addr <= 0xff)) { sdio_cmd52_t cmd; @@ -311,7 +311,7 @@ static int sdio_read_reg(u32 addr, u32 *data) } else { sdio_cmd53_t cmd; - if (!sdio_set_func0_csa_address(addr)) + if (!sdio_set_func0_csa_address(wilc, addr)) goto _fail_; cmd.read_write = 0; @@ -341,7 +341,7 @@ _fail_: return 0; } -static int sdio_read(u32 addr, u8 *buf, u32 size) +static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) { u32 block_size = g_sdio.block_size; sdio_cmd53_t cmd; @@ -388,7 +388,7 @@ static int sdio_read(u32 addr, u8 *buf, u32 size) cmd.buffer = buf; cmd.block_size = block_size; if (addr > 0) { - if (!sdio_set_func0_csa_address(addr)) + if (!sdio_set_func0_csa_address(wilc, addr)) goto _fail_; } if (!wilc_sdio_cmd53(&cmd)) { @@ -409,7 +409,7 @@ static int sdio_read(u32 addr, u8 *buf, u32 size) cmd.block_size = block_size; /* johnny : prevent it from setting unexpected value */ if (addr > 0) { - if (!sdio_set_func0_csa_address(addr)) + if (!sdio_set_func0_csa_address(wilc, addr)) goto _fail_; } if (!wilc_sdio_cmd53(&cmd)) { @@ -431,25 +431,25 @@ _fail_: * ********************************************/ -static int sdio_deinit(void *pv) +static int sdio_deinit(struct wilc *wilc) { return 1; } -static int sdio_sync(void) +static int sdio_sync(struct wilc *wilc) { u32 reg; /** * Disable power sequencer **/ - if (!sdio_read_reg(WILC_MISC, ®)) { + if (!sdio_read_reg(wilc, WILC_MISC, ®)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed read misc reg...\n"); return 0; } reg &= ~BIT(8); - if (!sdio_write_reg(WILC_MISC, reg)) { + if (!sdio_write_reg(wilc, WILC_MISC, reg)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed write misc reg...\n"); return 0; } @@ -461,13 +461,13 @@ static int sdio_sync(void) /** * interrupt pin mux select **/ - ret = sdio_read_reg(WILC_PIN_MUX_0, ®); + ret = sdio_read_reg(wilc, WILC_PIN_MUX_0, ®); if (!ret) { g_sdio.dPrint(N_ERR, "[wilc spi]: Failed read reg (%08x)...\n", WILC_PIN_MUX_0); return 0; } reg |= BIT(8); - ret = sdio_write_reg(WILC_PIN_MUX_0, reg); + ret = sdio_write_reg(wilc, WILC_PIN_MUX_0, reg); if (!ret) { g_sdio.dPrint(N_ERR, "[wilc spi]: Failed write reg (%08x)...\n", WILC_PIN_MUX_0); return 0; @@ -476,13 +476,13 @@ static int sdio_sync(void) /** * interrupt enable **/ - ret = sdio_read_reg(WILC_INTR_ENABLE, ®); + ret = sdio_read_reg(wilc, WILC_INTR_ENABLE, ®); if (!ret) { g_sdio.dPrint(N_ERR, "[wilc spi]: Failed read reg (%08x)...\n", WILC_INTR_ENABLE); return 0; } reg |= BIT(16); - ret = sdio_write_reg(WILC_INTR_ENABLE, reg); + ret = sdio_write_reg(wilc, WILC_INTR_ENABLE, reg); if (!ret) { g_sdio.dPrint(N_ERR, "[wilc spi]: Failed write reg (%08x)...\n", WILC_INTR_ENABLE); return 0; @@ -526,7 +526,7 @@ static int sdio_init(struct wilc *wilc, wilc_debug_func func) /** * function 0 block size **/ - if (!sdio_set_func0_block_size(WILC_SDIO_BLOCK_SIZE)) { + if (!sdio_set_func0_block_size(wilc, WILC_SDIO_BLOCK_SIZE)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, set func 0 block size...\n"); goto _fail_; } @@ -571,7 +571,7 @@ static int sdio_init(struct wilc *wilc, wilc_debug_func func) /** * func 1 is ready, set func 1 block size **/ - if (!sdio_set_func1_block_size(WILC_SDIO_BLOCK_SIZE)) { + if (!sdio_set_func1_block_size(wilc, WILC_SDIO_BLOCK_SIZE)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail set func 1 block size...\n"); goto _fail_; } @@ -592,7 +592,7 @@ static int sdio_init(struct wilc *wilc, wilc_debug_func func) /** * make sure can read back chip id correctly **/ - if (!sdio_read_reg(0x1000, &chipid)) { + if (!sdio_read_reg(wilc, 0x1000, &chipid)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd read chip id...\n"); goto _fail_; } @@ -610,7 +610,7 @@ _fail_: return 0; } -static int sdio_read_size(u32 *size) +static int sdio_read_size(struct wilc *wilc, u32 *size) { u32 tmp; @@ -639,13 +639,13 @@ static int sdio_read_size(u32 *size) return 1; } -static int sdio_read_int(u32 *int_status) +static int sdio_read_int(struct wilc *wilc, u32 *int_status) { u32 tmp; sdio_cmd52_t cmd; - sdio_read_size(&tmp); + sdio_read_size(wilc, &tmp); /** * Read IRQ flags @@ -694,7 +694,7 @@ static int sdio_read_int(u32 *int_status) return 1; } -static int sdio_clear_int_ext(u32 val) +static int sdio_clear_int_ext(struct wilc *wilc, u32 val) { int ret; @@ -812,7 +812,7 @@ _fail_: return 0; } -static int sdio_sync_ext(int nint /* how mant interrupts to enable. */) +static int sdio_sync_ext(struct wilc *wilc, int nint) { u32 reg; @@ -830,13 +830,13 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */) /** * Disable power sequencer **/ - if (!sdio_read_reg(WILC_MISC, ®)) { + if (!sdio_read_reg(wilc, WILC_MISC, ®)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed read misc reg...\n"); return 0; } reg &= ~BIT(8); - if (!sdio_write_reg(WILC_MISC, reg)) { + if (!sdio_write_reg(wilc, WILC_MISC, reg)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed write misc reg...\n"); return 0; } @@ -848,13 +848,13 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */) /** * interrupt pin mux select **/ - ret = sdio_read_reg(WILC_PIN_MUX_0, ®); + ret = sdio_read_reg(wilc, WILC_PIN_MUX_0, ®); if (!ret) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed read reg (%08x)...\n", WILC_PIN_MUX_0); return 0; } reg |= BIT(8); - ret = sdio_write_reg(WILC_PIN_MUX_0, reg); + ret = sdio_write_reg(wilc, WILC_PIN_MUX_0, reg); if (!ret) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed write reg (%08x)...\n", WILC_PIN_MUX_0); return 0; @@ -863,7 +863,7 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */) /** * interrupt enable **/ - ret = sdio_read_reg(WILC_INTR_ENABLE, ®); + ret = sdio_read_reg(wilc, WILC_INTR_ENABLE, ®); if (!ret) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed read reg (%08x)...\n", WILC_INTR_ENABLE); return 0; @@ -871,13 +871,13 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */) for (i = 0; (i < 5) && (nint > 0); i++, nint--) reg |= BIT((27 + i)); - ret = sdio_write_reg(WILC_INTR_ENABLE, reg); + ret = sdio_write_reg(wilc, WILC_INTR_ENABLE, reg); if (!ret) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed write reg (%08x)...\n", WILC_INTR_ENABLE); return 0; } if (nint) { - ret = sdio_read_reg(WILC_INTR2_ENABLE, ®); + ret = sdio_read_reg(wilc, WILC_INTR2_ENABLE, ®); if (!ret) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed read reg (%08x)...\n", WILC_INTR2_ENABLE); return 0; @@ -886,7 +886,7 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */) for (i = 0; (i < 3) && (nint > 0); i++, nint--) reg |= BIT(i); - ret = sdio_read_reg(WILC_INTR2_ENABLE, ®); + ret = sdio_read_reg(wilc, WILC_INTR2_ENABLE, ®); if (!ret) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed write reg (%08x)...\n", WILC_INTR2_ENABLE); return 0; diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index 1c5dcda4b634..53d098f80156 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -22,8 +22,8 @@ typedef struct { static wilc_spi_t g_spi; -static int _wilc_spi_read(u32, u8 *, u32); -static int _wilc_spi_write(u32, u8 *, u32); +static int _wilc_spi_read(struct wilc *wilc, u32, u8 *, u32); +static int _wilc_spi_write(struct wilc *wilc, u32, u8 *, u32); /******************************************** * @@ -108,7 +108,8 @@ static u8 crc7(u8 crc, const u8 *buffer, u32 len) #define DATA_PKT_SZ_8K (8 * 1024) #define DATA_PKT_SZ DATA_PKT_SZ_8K -static int spi_cmd_complete(u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless) +static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, + u8 clockless) { u8 wb[32], rb[32]; u8 wix, rix; @@ -447,7 +448,7 @@ _error_: return result; } -static int spi_data_write(u8 *b, u32 sz) +static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz) { int ix, nbytes; int result = 1; @@ -524,14 +525,15 @@ static int spi_data_write(u8 *b, u32 sz) * ********************************************/ -static int spi_internal_write(u32 adr, u32 dat) +static int spi_internal_write(struct wilc *wilc, u32 adr, u32 dat) { int result; #ifdef BIG_ENDIAN dat = BYTE_SWAP(dat); #endif - result = spi_cmd_complete(CMD_INTERNAL_WRITE, adr, (u8 *)&dat, 4, 0); + result = spi_cmd_complete(wilc, CMD_INTERNAL_WRITE, adr, (u8 *)&dat, 4, + 0); if (result != N_OK) { PRINT_ER("[wilc spi]: Failed internal write cmd...\n"); } @@ -539,11 +541,12 @@ static int spi_internal_write(u32 adr, u32 dat) return result; } -static int spi_internal_read(u32 adr, u32 *data) +static int spi_internal_read(struct wilc *wilc, u32 adr, u32 *data) { int result; - result = spi_cmd_complete(CMD_INTERNAL_READ, adr, (u8 *)data, 4, 0); + result = spi_cmd_complete(wilc, CMD_INTERNAL_READ, adr, (u8 *)data, 4, + 0); if (result != N_OK) { PRINT_ER("[wilc spi]: Failed internal read cmd...\n"); return 0; @@ -562,7 +565,7 @@ static int spi_internal_read(u32 adr, u32 *data) * ********************************************/ -static int wilc_spi_write_reg(u32 addr, u32 data) +static int wilc_spi_write_reg(struct wilc *wilc, u32 addr, u32 data) { int result = N_OK; u8 cmd = CMD_SINGLE_WRITE; @@ -577,7 +580,7 @@ static int wilc_spi_write_reg(u32 addr, u32 data) clockless = 1; } - result = spi_cmd_complete(cmd, addr, (u8 *)&data, 4, clockless); + result = spi_cmd_complete(wilc, cmd, addr, (u8 *)&data, 4, clockless); if (result != N_OK) { PRINT_ER("[wilc spi]: Failed cmd, write reg (%08x)...\n", addr); } @@ -585,7 +588,7 @@ static int wilc_spi_write_reg(u32 addr, u32 data) return result; } -static int _wilc_spi_write(u32 addr, u8 *buf, u32 size) +static int _wilc_spi_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) { int result; u8 cmd = CMD_DMA_EXT_WRITE; @@ -596,7 +599,7 @@ static int _wilc_spi_write(u32 addr, u8 *buf, u32 size) if (size <= 4) return 0; - result = spi_cmd_complete(cmd, addr, NULL, size, 0); + result = spi_cmd_complete(wilc, cmd, addr, NULL, size, 0); if (result != N_OK) { PRINT_ER("[wilc spi]: Failed cmd, write block (%08x)...\n", addr); return 0; @@ -605,7 +608,7 @@ static int _wilc_spi_write(u32 addr, u8 *buf, u32 size) /** * Data **/ - result = spi_data_write(buf, size); + result = spi_data_write(wilc, buf, size); if (result != N_OK) { PRINT_ER("[wilc spi]: Failed block data write...\n"); } @@ -613,7 +616,7 @@ static int _wilc_spi_write(u32 addr, u8 *buf, u32 size) return 1; } -static int wilc_spi_read_reg(u32 addr, u32 *data) +static int wilc_spi_read_reg(struct wilc *wilc, u32 addr, u32 *data) { int result = N_OK; u8 cmd = CMD_SINGLE_READ; @@ -626,7 +629,7 @@ static int wilc_spi_read_reg(u32 addr, u32 *data) clockless = 1; } - result = spi_cmd_complete(cmd, addr, (u8 *)data, 4, clockless); + result = spi_cmd_complete(wilc, cmd, addr, (u8 *)data, 4, clockless); if (result != N_OK) { PRINT_ER("[wilc spi]: Failed cmd, read reg (%08x)...\n", addr); return 0; @@ -639,7 +642,7 @@ static int wilc_spi_read_reg(u32 addr, u32 *data) return 1; } -static int _wilc_spi_read(u32 addr, u8 *buf, u32 size) +static int _wilc_spi_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) { u8 cmd = CMD_DMA_EXT_READ; int result; @@ -647,7 +650,7 @@ static int _wilc_spi_read(u32 addr, u8 *buf, u32 size) if (size <= 4) return 0; - result = spi_cmd_complete(cmd, addr, buf, size, 0); + result = spi_cmd_complete(wilc, cmd, addr, buf, size, 0); if (result != N_OK) { PRINT_ER("[wilc spi]: Failed cmd, read block (%08x)...\n", addr); return 0; @@ -662,20 +665,20 @@ static int _wilc_spi_read(u32 addr, u8 *buf, u32 size) * ********************************************/ -static int wilc_spi_clear_int(void) +static int wilc_spi_clear_int(struct wilc *wilc) { u32 reg; - if (!wilc_spi_read_reg(WILC_HOST_RX_CTRL_0, ®)) { + if (!wilc_spi_read_reg(wilc, WILC_HOST_RX_CTRL_0, ®)) { PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_HOST_RX_CTRL_0); return 0; } reg &= ~0x1; - wilc_spi_write_reg(WILC_HOST_RX_CTRL_0, reg); + wilc_spi_write_reg(wilc, WILC_HOST_RX_CTRL_0, reg); return 1; } -static int _wilc_spi_deinit(void *pv) +static int _wilc_spi_deinit(struct wilc *wilc) { /** * TODO: @@ -683,7 +686,7 @@ static int _wilc_spi_deinit(void *pv) return 1; } -static int wilc_spi_sync(void) +static int wilc_spi_sync(struct wilc *wilc) { u32 reg; int ret; @@ -691,13 +694,13 @@ static int wilc_spi_sync(void) /** * interrupt pin mux select **/ - ret = wilc_spi_read_reg(WILC_PIN_MUX_0, ®); + ret = wilc_spi_read_reg(wilc, WILC_PIN_MUX_0, ®); if (!ret) { PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_PIN_MUX_0); return 0; } reg |= BIT(8); - ret = wilc_spi_write_reg(WILC_PIN_MUX_0, reg); + ret = wilc_spi_write_reg(wilc, WILC_PIN_MUX_0, reg); if (!ret) { PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_PIN_MUX_0); return 0; @@ -706,13 +709,13 @@ static int wilc_spi_sync(void) /** * interrupt enable **/ - ret = wilc_spi_read_reg(WILC_INTR_ENABLE, ®); + ret = wilc_spi_read_reg(wilc, WILC_INTR_ENABLE, ®); if (!ret) { PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_INTR_ENABLE); return 0; } reg |= BIT(16); - ret = wilc_spi_write_reg(WILC_INTR_ENABLE, reg); + ret = wilc_spi_write_reg(wilc, WILC_INTR_ENABLE, reg); if (!ret) { PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_INTR_ENABLE); return 0; @@ -730,7 +733,7 @@ static int _wilc_spi_init(struct wilc *wilc, wilc_debug_func func) if (isinit) { - if (!wilc_spi_read_reg(0x1000, &chipid)) { + if (!wilc_spi_read_reg(wilc, 0x1000, &chipid)) { PRINT_ER("[wilc spi]: Fail cmd read chip id...\n"); return 0; } @@ -754,12 +757,12 @@ static int _wilc_spi_init(struct wilc *wilc, wilc_debug_func func) /* TODO: We can remove the CRC trials if there is a definite way to reset */ /* the SPI to it's initial value. */ - if (!spi_internal_read(WILC_SPI_PROTOCOL_OFFSET, ®)) { + if (!spi_internal_read(wilc, WILC_SPI_PROTOCOL_OFFSET, ®)) { /* Read failed. Try with CRC off. This might happen when module * is removed but chip isn't reset*/ g_spi.crc_off = 1; PRINT_ER("[wilc spi]: Failed internal read protocol with CRC on, retyring with CRC off...\n"); - if (!spi_internal_read(WILC_SPI_PROTOCOL_OFFSET, ®)) { + if (!spi_internal_read(wilc, WILC_SPI_PROTOCOL_OFFSET, ®)) { /* Reaad failed with both CRC on and off, something went bad */ PRINT_ER("[wilc spi]: Failed internal read protocol...\n"); return 0; @@ -769,7 +772,7 @@ static int _wilc_spi_init(struct wilc *wilc, wilc_debug_func func) reg &= ~0xc; /* disable crc checking */ reg &= ~0x70; reg |= (0x5 << 4); - if (!spi_internal_write(WILC_SPI_PROTOCOL_OFFSET, reg)) { + if (!spi_internal_write(wilc, WILC_SPI_PROTOCOL_OFFSET, reg)) { PRINT_ER("[wilc spi %d]: Failed internal write protocol reg...\n", __LINE__); return 0; } @@ -780,7 +783,7 @@ static int _wilc_spi_init(struct wilc *wilc, wilc_debug_func func) /** * make sure can read back chip id correctly **/ - if (!wilc_spi_read_reg(0x1000, &chipid)) { + if (!wilc_spi_read_reg(wilc, 0x1000, &chipid)) { PRINT_ER("[wilc spi]: Fail cmd read chip id...\n"); return 0; } @@ -793,18 +796,20 @@ static int _wilc_spi_init(struct wilc *wilc, wilc_debug_func func) return 1; } -static int wilc_spi_read_size(u32 *size) +static int wilc_spi_read_size(struct wilc *wilc, u32 *size) { int ret; if (g_spi.has_thrpt_enh) { - ret = spi_internal_read(0xe840 - WILC_SPI_REG_BASE, size); + ret = spi_internal_read(wilc, 0xe840 - WILC_SPI_REG_BASE, + size); *size = *size & IRQ_DMA_WD_CNT_MASK; } else { u32 tmp; u32 byte_cnt; - ret = wilc_spi_read_reg(WILC_VMM_TO_HOST_SIZE, &byte_cnt); + ret = wilc_spi_read_reg(wilc, WILC_VMM_TO_HOST_SIZE, + &byte_cnt); if (!ret) { PRINT_ER("[wilc spi]: Failed read WILC_VMM_TO_HOST_SIZE ...\n"); goto _fail_; @@ -821,17 +826,19 @@ _fail_: -static int wilc_spi_read_int(u32 *int_status) +static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status) { int ret; if (g_spi.has_thrpt_enh) { - ret = spi_internal_read(0xe840 - WILC_SPI_REG_BASE, int_status); + ret = spi_internal_read(wilc, 0xe840 - WILC_SPI_REG_BASE, + int_status); } else { u32 tmp; u32 byte_cnt; - ret = wilc_spi_read_reg(WILC_VMM_TO_HOST_SIZE, &byte_cnt); + ret = wilc_spi_read_reg(wilc, WILC_VMM_TO_HOST_SIZE, + &byte_cnt); if (!ret) { PRINT_ER("[wilc spi]: Failed read WILC_VMM_TO_HOST_SIZE ...\n"); goto _fail_; @@ -847,11 +854,12 @@ static int wilc_spi_read_int(u32 *int_status) happended = 0; - wilc_spi_read_reg(0x1a90, &irq_flags); + wilc_spi_read_reg(wilc, 0x1a90, &irq_flags); tmp |= ((irq_flags >> 27) << IRG_FLAGS_OFFSET); if (g_spi.nint > 5) { - wilc_spi_read_reg(0x1a94, &irq_flags); + wilc_spi_read_reg(wilc, 0x1a94, + &irq_flags); tmp |= (((irq_flags >> 0) & 0x7) << (IRG_FLAGS_OFFSET + 5)); } @@ -877,12 +885,13 @@ _fail_: return ret; } -static int wilc_spi_clear_int_ext(u32 val) +static int wilc_spi_clear_int_ext(struct wilc *wilc, u32 val) { int ret; if (g_spi.has_thrpt_enh) { - ret = spi_internal_write(0xe844 - WILC_SPI_REG_BASE, val); + ret = spi_internal_write(wilc, 0xe844 - WILC_SPI_REG_BASE, + val); } else { u32 flags; @@ -894,7 +903,7 @@ static int wilc_spi_clear_int_ext(u32 val) for (i = 0; i < g_spi.nint; i++) { /* No matter what you write 1 or 0, it will clear interrupt. */ if (flags & 1) - ret = wilc_spi_write_reg(0x10c8 + i * 4, 1); + ret = wilc_spi_write_reg(wilc, 0x10c8 + i * 4, 1); if (!ret) break; flags >>= 1; @@ -921,7 +930,8 @@ static int wilc_spi_clear_int_ext(u32 val) if ((val & SEL_VMM_TBL1) == SEL_VMM_TBL1) tbl_ctl |= BIT(1); - ret = wilc_spi_write_reg(WILC_VMM_TBL_CTL, tbl_ctl); + ret = wilc_spi_write_reg(wilc, WILC_VMM_TBL_CTL, + tbl_ctl); if (!ret) { PRINT_ER("[wilc spi]: fail write reg vmm_tbl_ctl...\n"); goto _fail_; @@ -931,7 +941,8 @@ static int wilc_spi_clear_int_ext(u32 val) /** * enable vmm transfer. **/ - ret = wilc_spi_write_reg(WILC_VMM_CORE_CTL, 1); + ret = wilc_spi_write_reg(wilc, + WILC_VMM_CORE_CTL, 1); if (!ret) { PRINT_ER("[wilc spi]: fail write reg vmm_core_ctl...\n"); goto _fail_; @@ -943,7 +954,7 @@ _fail_: return ret; } -static int wilc_spi_sync_ext(int nint /* how mant interrupts to enable. */) +static int wilc_spi_sync_ext(struct wilc *wilc, int nint) { u32 reg; int ret, i; @@ -958,13 +969,13 @@ static int wilc_spi_sync_ext(int nint /* how mant interrupts to enable. */) /** * interrupt pin mux select **/ - ret = wilc_spi_read_reg(WILC_PIN_MUX_0, ®); + ret = wilc_spi_read_reg(wilc, WILC_PIN_MUX_0, ®); if (!ret) { PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_PIN_MUX_0); return 0; } reg |= BIT(8); - ret = wilc_spi_write_reg(WILC_PIN_MUX_0, reg); + ret = wilc_spi_write_reg(wilc, WILC_PIN_MUX_0, reg); if (!ret) { PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_PIN_MUX_0); return 0; @@ -973,7 +984,7 @@ static int wilc_spi_sync_ext(int nint /* how mant interrupts to enable. */) /** * interrupt enable **/ - ret = wilc_spi_read_reg(WILC_INTR_ENABLE, ®); + ret = wilc_spi_read_reg(wilc, WILC_INTR_ENABLE, ®); if (!ret) { PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_INTR_ENABLE); return 0; @@ -982,13 +993,13 @@ static int wilc_spi_sync_ext(int nint /* how mant interrupts to enable. */) for (i = 0; (i < 5) && (nint > 0); i++, nint--) { reg |= (BIT((27 + i))); } - ret = wilc_spi_write_reg(WILC_INTR_ENABLE, reg); + ret = wilc_spi_write_reg(wilc, WILC_INTR_ENABLE, reg); if (!ret) { PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_INTR_ENABLE); return 0; } if (nint) { - ret = wilc_spi_read_reg(WILC_INTR2_ENABLE, ®); + ret = wilc_spi_read_reg(wilc, WILC_INTR2_ENABLE, ®); if (!ret) { PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_INTR2_ENABLE); return 0; @@ -998,7 +1009,7 @@ static int wilc_spi_sync_ext(int nint /* how mant interrupts to enable. */) reg |= BIT(i); } - ret = wilc_spi_read_reg(WILC_INTR2_ENABLE, ®); + ret = wilc_spi_read_reg(wilc, WILC_INTR2_ENABLE, ®); if (!ret) { PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_INTR2_ENABLE); return 0; diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index e30a34dae231..9ac6ad7df605 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -566,9 +566,9 @@ static inline void chip_allow_sleep(struct wilc *wilc) { u32 reg = 0; - g_wlan.hif_func.hif_read_reg(0xf0, ®); + g_wlan.hif_func.hif_read_reg(wilc, 0xf0, ®); - g_wlan.hif_func.hif_write_reg(0xf0, reg & ~BIT(0)); + g_wlan.hif_func.hif_write_reg(wilc, 0xf0, reg & ~BIT(0)); } static inline void chip_wakeup(struct wilc *wilc) @@ -578,9 +578,9 @@ static inline void chip_wakeup(struct wilc *wilc) if ((g_wlan.io_type & 0x1) == HIF_SPI) { do { - g_wlan.hif_func.hif_read_reg(1, ®); - g_wlan.hif_func.hif_write_reg(1, reg | BIT(1)); - g_wlan.hif_func.hif_write_reg(1, reg & ~BIT(1)); + g_wlan.hif_func.hif_read_reg(wilc, 1, ®); + g_wlan.hif_func.hif_write_reg(wilc, 1, reg | BIT(1)); + g_wlan.hif_func.hif_write_reg(wilc, 1, reg & ~BIT(1)); do { usleep_range(2 * 1000, 2 * 1000); @@ -591,41 +591,44 @@ static inline void chip_wakeup(struct wilc *wilc) } while (wilc_get_chipid(wilc, true) == 0); } else if ((g_wlan.io_type & 0x1) == HIF_SDIO) { - g_wlan.hif_func.hif_read_reg(0xf0, ®); + g_wlan.hif_func.hif_read_reg(wilc, 0xf0, ®); do { - g_wlan.hif_func.hif_write_reg(0xf0, reg | BIT(0)); - g_wlan.hif_func.hif_read_reg(0xf1, &clk_status_reg); + g_wlan.hif_func.hif_write_reg(wilc, 0xf0, + reg | BIT(0)); + g_wlan.hif_func.hif_read_reg(wilc, 0xf1, + &clk_status_reg); while (((clk_status_reg & 0x1) == 0) && (((++trials) % 3) == 0)) { usleep_range(2 * 1000, 2 * 1000); - g_wlan.hif_func.hif_read_reg(0xf1, &clk_status_reg); + g_wlan.hif_func.hif_read_reg(wilc, 0xf1, + &clk_status_reg); if ((clk_status_reg & 0x1) == 0) wilc_debug(N_ERR, "clocks still OFF. Wake up failed\n"); } if ((clk_status_reg & 0x1) == 0) { - g_wlan.hif_func.hif_write_reg(0xf0, reg & - (~BIT(0))); + g_wlan.hif_func.hif_write_reg(wilc, 0xf0, + reg & (~BIT(0))); } } while ((clk_status_reg & 0x1) == 0); } if (chip_ps_state == CHIP_SLEEPING_MANUAL) { - g_wlan.hif_func.hif_read_reg(0x1C0C, ®); + g_wlan.hif_func.hif_read_reg(wilc, 0x1C0C, ®); reg &= ~BIT(0); - g_wlan.hif_func.hif_write_reg(0x1C0C, reg); + g_wlan.hif_func.hif_write_reg(wilc, 0x1C0C, reg); if (wilc_get_chipid(wilc, false) >= 0x1002b0) { u32 val32; - g_wlan.hif_func.hif_read_reg(0x1e1c, &val32); + g_wlan.hif_func.hif_read_reg(wilc, 0x1e1c, &val32); val32 |= BIT(6); - g_wlan.hif_func.hif_write_reg(0x1e1c, val32); + g_wlan.hif_func.hif_write_reg(wilc, 0x1e1c, val32); - g_wlan.hif_func.hif_read_reg(0x1e9c, &val32); + g_wlan.hif_func.hif_read_reg(wilc, 0x1e9c, &val32); val32 |= BIT(6); - g_wlan.hif_func.hif_write_reg(0x1e9c, val32); + g_wlan.hif_func.hif_write_reg(wilc, 0x1e9c, val32); } } chip_ps_state = CHIP_WAKEDUP; @@ -637,15 +640,18 @@ static inline void chip_wakeup(struct wilc *wilc) do { if ((g_wlan.io_type & 0x1) == HIF_SPI) { - g_wlan.hif_func.hif_read_reg(1, ®); - g_wlan.hif_func.hif_write_reg(1, reg & ~BIT(1)); - g_wlan.hif_func.hif_write_reg(1, reg | BIT(1)); - g_wlan.hif_func.hif_write_reg(1, reg & ~BIT(1)); + g_wlan.hif_func.hif_read_reg(wilc, 1, ®); + g_wlan.hif_func.hif_write_reg(wilc, 1, reg & ~BIT(1)); + g_wlan.hif_func.hif_write_reg(wilc, 1, reg | BIT(1)); + g_wlan.hif_func.hif_write_reg(wilc, 1, reg & ~BIT(1)); } else if ((g_wlan.io_type & 0x1) == HIF_SDIO) { - g_wlan.hif_func.hif_read_reg(0xf0, ®); - g_wlan.hif_func.hif_write_reg(0xf0, reg & ~BIT(0)); - g_wlan.hif_func.hif_write_reg(0xf0, reg | BIT(0)); - g_wlan.hif_func.hif_write_reg(0xf0, reg & ~BIT(0)); + g_wlan.hif_func.hif_read_reg(wilc, 0xf0, ®); + g_wlan.hif_func.hif_write_reg(wilc, 0xf0, + reg & ~BIT(0)); + g_wlan.hif_func.hif_write_reg(wilc, 0xf0, + reg | BIT(0)); + g_wlan.hif_func.hif_write_reg(wilc, 0xf0, + reg & ~BIT(0)); } do { @@ -659,20 +665,20 @@ static inline void chip_wakeup(struct wilc *wilc) } while (wilc_get_chipid(wilc, true) == 0); if (chip_ps_state == CHIP_SLEEPING_MANUAL) { - g_wlan.hif_func.hif_read_reg(0x1C0C, ®); + g_wlan.hif_func.hif_read_reg(wilc, 0x1C0C, ®); reg &= ~BIT(0); - g_wlan.hif_func.hif_write_reg(0x1C0C, reg); + g_wlan.hif_func.hif_write_reg(wilc, 0x1C0C, reg); if (wilc_get_chipid(wilc, false) >= 0x1002b0) { u32 val32; - g_wlan.hif_func.hif_read_reg(0x1e1c, &val32); + g_wlan.hif_func.hif_read_reg(wilc, 0x1e1c, &val32); val32 |= BIT(6); - g_wlan.hif_func.hif_write_reg(0x1e1c, val32); + g_wlan.hif_func.hif_write_reg(wilc, 0x1e1c, val32); - g_wlan.hif_func.hif_read_reg(0x1e9c, &val32); + g_wlan.hif_func.hif_read_reg(wilc, 0x1e9c, &val32); val32 |= BIT(6); - g_wlan.hif_func.hif_write_reg(0x1e9c, val32); + g_wlan.hif_func.hif_write_reg(wilc, 0x1e9c, val32); } } chip_ps_state = CHIP_WAKEDUP; @@ -687,7 +693,7 @@ void wilc_chip_sleep_manually(struct wilc *wilc) #ifdef WILC_OPTIMIZE_SLEEP_INT chip_allow_sleep(wilc); #endif - g_wlan.hif_func.hif_write_reg(0x10a8, 1); + g_wlan.hif_func.hif_write_reg(wilc, 0x10a8, 1); chip_ps_state = CHIP_SLEEPING_MANUAL; release_bus(wilc, RELEASE_ONLY); @@ -778,7 +784,8 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) acquire_bus(wilc, ACQUIRE_AND_WAKEUP); counter = 0; do { - ret = p->hif_func.hif_read_reg(WILC_HOST_TX_CTRL, ®); + ret = p->hif_func.hif_read_reg(wilc, WILC_HOST_TX_CTRL, + ®); if (!ret) { wilc_debug(N_ERR, "[wilc txq]: fail can't read reg vmm_tbl_entry..\n"); break; @@ -792,7 +799,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) if (counter > 200) { counter = 0; PRINT_D(TX_DBG, "Looping in tx ctrl , forcce quit\n"); - ret = p->hif_func.hif_write_reg(WILC_HOST_TX_CTRL, 0); + ret = p->hif_func.hif_write_reg(wilc, WILC_HOST_TX_CTRL, 0); break; } PRINT_WRN(GENERIC_DBG, "[wilc txq]: warn, vmm table not clear yet, wait...\n"); @@ -807,20 +814,21 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) timeout = 200; do { - ret = p->hif_func.hif_block_tx(WILC_VMM_TBL_RX_SHADOW_BASE, (u8 *)vmm_table, ((i + 1) * 4)); + ret = p->hif_func.hif_block_tx(wilc, WILC_VMM_TBL_RX_SHADOW_BASE, (u8 *)vmm_table, ((i + 1) * 4)); if (!ret) { wilc_debug(N_ERR, "ERR block TX of VMM table.\n"); break; } - ret = p->hif_func.hif_write_reg(WILC_HOST_VMM_CTL, 0x2); + ret = p->hif_func.hif_write_reg(wilc, WILC_HOST_VMM_CTL, + 0x2); if (!ret) { wilc_debug(N_ERR, "[wilc txq]: fail can't write reg host_vmm_ctl..\n"); break; } do { - ret = p->hif_func.hif_read_reg(WILC_HOST_VMM_CTL, ®); + ret = p->hif_func.hif_read_reg(wilc, WILC_HOST_VMM_CTL, ®); if (!ret) { wilc_debug(N_ERR, "[wilc txq]: fail can't read reg host_vmm_ctl..\n"); break; @@ -836,7 +844,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) } } while (--timeout); if (timeout <= 0) { - ret = p->hif_func.hif_write_reg(WILC_HOST_VMM_CTL, 0x0); + ret = p->hif_func.hif_write_reg(wilc, WILC_HOST_VMM_CTL, 0x0); break; } @@ -846,13 +854,13 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) if (entries == 0) { PRINT_WRN(GENERIC_DBG, "[wilc txq]: no more buffer in the chip (reg: %08x), retry later [[ %d, %x ]]\n", reg, i, vmm_table[i - 1]); - ret = p->hif_func.hif_read_reg(WILC_HOST_TX_CTRL, ®); + ret = p->hif_func.hif_read_reg(wilc, WILC_HOST_TX_CTRL, ®); if (!ret) { wilc_debug(N_ERR, "[wilc txq]: fail can't read reg WILC_HOST_TX_CTRL..\n"); break; } reg &= ~BIT(0); - ret = p->hif_func.hif_write_reg(WILC_HOST_TX_CTRL, reg); + ret = p->hif_func.hif_write_reg(wilc, WILC_HOST_TX_CTRL, reg); if (!ret) { wilc_debug(N_ERR, "[wilc txq]: fail can't write reg WILC_HOST_TX_CTRL..\n"); break; @@ -928,13 +936,13 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) acquire_bus(wilc, ACQUIRE_AND_WAKEUP); - ret = p->hif_func.hif_clear_int_ext(ENABLE_TX_VMM); + ret = p->hif_func.hif_clear_int_ext(wilc, ENABLE_TX_VMM); if (!ret) { wilc_debug(N_ERR, "[wilc txq]: fail can't start tx VMM ...\n"); goto _end_; } - ret = p->hif_func.hif_block_tx_ext(0, txb, offset); + ret = p->hif_func.hif_block_tx_ext(wilc, 0, txb, offset); if (!ret) { wilc_debug(N_ERR, "[wilc txq]: fail can't block tx ext...\n"); goto _end_; @@ -1058,14 +1066,14 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) static void wilc_unknown_isr_ext(struct wilc *wilc) { - g_wlan.hif_func.hif_clear_int_ext(0); + g_wlan.hif_func.hif_clear_int_ext(wilc, 0); } static void wilc_pllupdate_isr_ext(struct wilc *wilc, u32 int_stats) { int trials = 10; - g_wlan.hif_func.hif_clear_int_ext(PLL_INT_CLR); + g_wlan.hif_func.hif_clear_int_ext(wilc, PLL_INT_CLR); if (g_wlan.io_type == HIF_SDIO) mdelay(WILC_PLL_TO_SDIO); @@ -1080,7 +1088,7 @@ static void wilc_pllupdate_isr_ext(struct wilc *wilc, u32 int_stats) static void wilc_sleeptimer_isr_ext(struct wilc *wilc, u32 int_stats1) { - g_wlan.hif_func.hif_clear_int_ext(SLEEP_INT_CLR); + g_wlan.hif_func.hif_clear_int_ext(wilc, SLEEP_INT_CLR); #ifndef WILC_OPTIMIZE_SLEEP_INT chip_ps_state = CHIP_SLEEPING_AUTO; #endif @@ -1104,7 +1112,7 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) u32 time = 0; wilc_debug(N_ERR, "RX Size equal zero ... Trying to read it again for %d time\n", time++); - p->hif_func.hif_read_size(&size); + p->hif_func.hif_read_size(wilc, &size); size = ((size & 0x7fff) << 2); retries++; } @@ -1128,8 +1136,9 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) goto _end_; } #endif - p->hif_func.hif_clear_int_ext(DATA_INT_CLR | ENABLE_RX_VMM); - ret = p->hif_func.hif_block_rx_ext(0, buffer, size); + p->hif_func.hif_clear_int_ext(wilc, + DATA_INT_CLR | ENABLE_RX_VMM); + ret = p->hif_func.hif_block_rx_ext(wilc, 0, buffer, size); if (!ret) { wilc_debug(N_ERR, "[wilc isr]: fail block rx...\n"); @@ -1162,7 +1171,7 @@ void wilc_handle_isr(struct wilc *wilc) u32 int_status; acquire_bus(wilc, ACQUIRE_AND_WAKEUP); - g_wlan.hif_func.hif_read_int(&int_status); + g_wlan.hif_func.hif_read_int(wilc, &int_status); if (int_status & PLL_INT_EXT) wilc_pllupdate_isr_ext(wilc, int_status); @@ -1219,7 +1228,8 @@ int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 buffer_ size2 = blksz; memcpy(dma_buffer, &buffer[offset], size2); - ret = p->hif_func.hif_block_tx(addr, dma_buffer, size2); + ret = p->hif_func.hif_block_tx(wilc, addr, dma_buffer, + size2); if (!ret) break; @@ -1260,7 +1270,7 @@ int wilc_wlan_start(struct wilc *wilc) reg = 1; } acquire_bus(wilc, ACQUIRE_ONLY); - ret = p->hif_func.hif_write_reg(WILC_VMM_CORE_CFG, reg); + ret = p->hif_func.hif_write_reg(wilc, WILC_VMM_CORE_CFG, reg); if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail write reg vmm_core_cfg...\n"); release_bus(wilc, RELEASE_ONLY); @@ -1294,7 +1304,7 @@ int wilc_wlan_start(struct wilc *wilc) reg |= WILC_HAVE_DISABLE_WILC_UART; #endif - ret = p->hif_func.hif_write_reg(WILC_GP_REG_1, reg); + ret = p->hif_func.hif_write_reg(wilc, WILC_GP_REG_1, reg); if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail write WILC_GP_REG_1 ...\n"); release_bus(wilc, RELEASE_ONLY); @@ -1302,9 +1312,9 @@ int wilc_wlan_start(struct wilc *wilc) return ret; } - p->hif_func.hif_sync_ext(NUM_INT_EXT); + p->hif_func.hif_sync_ext(wilc, NUM_INT_EXT); - ret = p->hif_func.hif_read_reg(0x1000, &chipid); + ret = p->hif_func.hif_read_reg(wilc, 0x1000, &chipid); if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail read reg 0x1000 ...\n"); release_bus(wilc, RELEASE_ONLY); @@ -1312,16 +1322,16 @@ int wilc_wlan_start(struct wilc *wilc) return ret; } - p->hif_func.hif_read_reg(WILC_GLB_RESET_0, ®); + p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0, ®); if ((reg & BIT(10)) == BIT(10)) { reg &= ~BIT(10); - p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg); - p->hif_func.hif_read_reg(WILC_GLB_RESET_0, ®); + p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, reg); + p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0, ®); } reg |= BIT(10); - ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg); - p->hif_func.hif_read_reg(WILC_GLB_RESET_0, ®); + ret = p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, reg); + p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0, ®); release_bus(wilc, RELEASE_ONLY); return (ret < 0) ? ret : 0; @@ -1333,7 +1343,7 @@ void wilc_wlan_global_reset(struct wilc *wilc) wilc_wlan_dev_t *p = &g_wlan; acquire_bus(wilc, ACQUIRE_AND_WAKEUP); - p->hif_func.hif_write_reg(WILC_GLB_RESET_0, 0x0); + p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, 0x0); release_bus(wilc, RELEASE_ONLY); } int wilc_wlan_stop(struct wilc *wilc) @@ -1344,7 +1354,7 @@ int wilc_wlan_stop(struct wilc *wilc) u8 timeout = 10; acquire_bus(wilc, ACQUIRE_AND_WAKEUP); - ret = p->hif_func.hif_read_reg(WILC_GLB_RESET_0, ®); + ret = p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0, ®); if (!ret) { PRINT_ER("Error while reading reg\n"); release_bus(wilc, RELEASE_ALLOW_SLEEP); @@ -1352,7 +1362,7 @@ int wilc_wlan_stop(struct wilc *wilc) } reg &= ~BIT(10); - ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg); + ret = p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, reg); if (!ret) { PRINT_ER("Error while writing reg\n"); release_bus(wilc, RELEASE_ALLOW_SLEEP); @@ -1360,7 +1370,7 @@ int wilc_wlan_stop(struct wilc *wilc) } do { - ret = p->hif_func.hif_read_reg(WILC_GLB_RESET_0, ®); + ret = p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0, ®); if (!ret) { PRINT_ER("Error while reading reg\n"); release_bus(wilc, RELEASE_ALLOW_SLEEP); @@ -1373,12 +1383,14 @@ int wilc_wlan_stop(struct wilc *wilc) PRINT_D(GENERIC_DBG, "Bit 10 not reset : Retry %d\n", timeout); reg &= ~BIT(10); - ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg); + ret = p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, + reg); timeout--; } else { PRINT_D(GENERIC_DBG, "Bit 10 reset after : Retry %d\n", timeout); - ret = p->hif_func.hif_read_reg(WILC_GLB_RESET_0, ®); + ret = p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0, + ®); if (!ret) { PRINT_ER("Error while reading reg\n"); release_bus(wilc, RELEASE_ALLOW_SLEEP); @@ -1393,10 +1405,10 @@ int wilc_wlan_stop(struct wilc *wilc) reg = (BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(8) | BIT(9) | BIT(26) | BIT(29) | BIT(30) | BIT(31)); - p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg); + p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, reg); reg = (u32)~BIT(10); - ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg); + ret = p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, reg); release_bus(wilc, RELEASE_ALLOW_SLEEP); @@ -1444,13 +1456,14 @@ void wilc_wlan_cleanup(struct net_device *dev) acquire_bus(wilc, ACQUIRE_AND_WAKEUP); - ret = p->hif_func.hif_read_reg(WILC_GP_REG_0, ®); + ret = p->hif_func.hif_read_reg(wilc, WILC_GP_REG_0, ®); if (!ret) { PRINT_ER("Error while reading reg\n"); release_bus(wilc, RELEASE_ALLOW_SLEEP); } PRINT_ER("Writing ABORT reg\n"); - ret = p->hif_func.hif_write_reg(WILC_GP_REG_0, (reg | ABORT_INT)); + ret = p->hif_func.hif_write_reg(wilc, WILC_GP_REG_0, + (reg | ABORT_INT)); if (!ret) { PRINT_ER("Error while writing reg\n"); release_bus(wilc, RELEASE_ALLOW_SLEEP); @@ -1590,18 +1603,18 @@ static u32 init_chip(struct net_device *dev) chipid = wilc_get_chipid(wilc, true); if ((chipid & 0xfff) != 0xa0) { - ret = g_wlan.hif_func.hif_read_reg(0x1118, ®); + ret = g_wlan.hif_func.hif_read_reg(wilc, 0x1118, ®); if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail read reg 0x1118 ...\n"); return ret; } reg |= BIT(0); - ret = g_wlan.hif_func.hif_write_reg(0x1118, reg); + ret = g_wlan.hif_func.hif_write_reg(wilc, 0x1118, reg); if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail write reg 0x1118 ...\n"); return ret; } - ret = g_wlan.hif_func.hif_write_reg(0xc0000, 0x71); + ret = g_wlan.hif_func.hif_write_reg(wilc, 0xc0000, 0x71); if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail write reg 0xc0000 ...\n"); return ret; @@ -1620,8 +1633,8 @@ u32 wilc_get_chipid(struct wilc *wilc, u8 update) u32 rfrevid; if (chipid == 0 || update != 0) { - g_wlan.hif_func.hif_read_reg(0x1000, &tempchipid); - g_wlan.hif_func.hif_read_reg(0x13f4, &rfrevid); + g_wlan.hif_func.hif_read_reg(wilc, 0x1000, &tempchipid); + g_wlan.hif_func.hif_read_reg(wilc, 0x13f4, &rfrevid); if (!ISWILC1000(tempchipid)) { chipid = 0; goto _fail_; @@ -1723,7 +1736,8 @@ u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value) wilc = nic->wilc; mutex_lock(&wilc->hif_cs); - ret = (&g_wlan)->hif_func.hif_read_reg(WILC_CHANGING_VIR_IF, ®); + ret = (&g_wlan)->hif_func.hif_read_reg(wilc, WILC_CHANGING_VIR_IF, + ®); if (!ret) PRINT_ER("Error while Reading reg WILC_CHANGING_VIR_IF\n"); @@ -1732,7 +1746,8 @@ u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value) else reg &= ~BIT(31); - ret = (&g_wlan)->hif_func.hif_write_reg(WILC_CHANGING_VIR_IF, reg); + ret = (&g_wlan)->hif_func.hif_write_reg(wilc, WILC_CHANGING_VIR_IF, + reg); if (!ret) PRINT_ER("Error while writing reg WILC_CHANGING_VIR_IF\n"); diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 334abafe3b0f..c3f13aa14c70 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -238,19 +238,19 @@ struct rxq_entry_t { struct wilc; struct wilc_hif_func { int (*hif_init)(struct wilc *, wilc_debug_func); - int (*hif_deinit)(void *); - int (*hif_read_reg)(u32, u32 *); - int (*hif_write_reg)(u32, u32); - int (*hif_block_rx)(u32, u8 *, u32); - int (*hif_block_tx)(u32, u8 *, u32); - int (*hif_sync)(void); - int (*hif_clear_int)(void); - int (*hif_read_int)(u32 *); - int (*hif_clear_int_ext)(u32); - int (*hif_read_size)(u32 *); - int (*hif_block_tx_ext)(u32, u8 *, u32); - int (*hif_block_rx_ext)(u32, u8 *, u32); - int (*hif_sync_ext)(int); + int (*hif_deinit)(struct wilc *); + int (*hif_read_reg)(struct wilc *, u32, u32 *); + int (*hif_write_reg)(struct wilc *, u32, u32); + int (*hif_block_rx)(struct wilc *, u32, u8 *, u32); + int (*hif_block_tx)(struct wilc *, u32, u8 *, u32); + int (*hif_sync)(struct wilc *); + int (*hif_clear_int)(struct wilc *); + int (*hif_read_int)(struct wilc *, u32 *); + int (*hif_clear_int_ext)(struct wilc *, u32); + int (*hif_read_size)(struct wilc *, u32 *); + int (*hif_block_tx_ext)(struct wilc *, u32, u8 *, u32); + int (*hif_block_rx_ext)(struct wilc *, u32, u8 *, u32); + int (*hif_sync_ext)(struct wilc *, int); int (*enable_interrupt)(struct wilc *nic); void (*disable_interrupt)(struct wilc *nic); }; From ea5779b4fbc722cec770e20557d883c959a34d74 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Wed, 18 Nov 2015 15:11:27 +0900 Subject: [PATCH 557/843] staging: wilc1000: wilc_sdio_cmd52: pass struct wilc This patch adds new function parameter struct wilc and use it instead of wilc_dev. Pass wilc to the function as well. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan_sdio.c | 4 +-- drivers/staging/wilc1000/linux_wlan_sdio.h | 2 +- drivers/staging/wilc1000/wilc_sdio.c | 42 +++++++++++----------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index 761cb3ddd132..6a38876ab2df 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -29,9 +29,9 @@ static void wilc_sdio_interrupt(struct sdio_func *func) sdio_claim_host(func); } -int wilc_sdio_cmd52(sdio_cmd52_t *cmd) +int wilc_sdio_cmd52(struct wilc *wilc, sdio_cmd52_t *cmd) { - struct sdio_func *func = container_of(wilc_dev->dev, struct sdio_func, dev); + struct sdio_func *func = container_of(wilc->dev, struct sdio_func, dev); int ret; u8 data; diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h b/drivers/staging/wilc1000/linux_wlan_sdio.h index dbe911a9ae3d..d966bb96d269 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.h +++ b/drivers/staging/wilc1000/linux_wlan_sdio.h @@ -1,7 +1,7 @@ #include int wilc_sdio_init(void); -int wilc_sdio_cmd52(sdio_cmd52_t *cmd); +int wilc_sdio_cmd52(struct wilc *wilc, sdio_cmd52_t *cmd); int wilc_sdio_cmd53(sdio_cmd53_t *cmd); int wilc_sdio_enable_interrupt(struct wilc *); diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index 3f8260477f7c..6e53ea001ee5 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -47,21 +47,21 @@ static int sdio_set_func0_csa_address(struct wilc *wilc, u32 adr) cmd.raw = 0; cmd.address = 0x10c; cmd.data = (u8)adr; - if (!wilc_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(wilc, &cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10c data...\n"); goto _fail_; } cmd.address = 0x10d; cmd.data = (u8)(adr >> 8); - if (!wilc_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(wilc, &cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10d data...\n"); goto _fail_; } cmd.address = 0x10e; cmd.data = (u8)(adr >> 16); - if (!wilc_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(wilc, &cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10e data...\n"); goto _fail_; } @@ -80,14 +80,14 @@ static int sdio_set_func0_block_size(struct wilc *wilc, u32 block_size) cmd.raw = 0; cmd.address = 0x10; cmd.data = (u8)block_size; - if (!wilc_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(wilc, &cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10 data...\n"); goto _fail_; } cmd.address = 0x11; cmd.data = (u8)(block_size >> 8); - if (!wilc_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(wilc, &cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x11 data...\n"); goto _fail_; } @@ -112,13 +112,13 @@ static int sdio_set_func1_block_size(struct wilc *wilc, u32 block_size) cmd.raw = 0; cmd.address = 0x110; cmd.data = (u8)block_size; - if (!wilc_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(wilc, &cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x110 data...\n"); goto _fail_; } cmd.address = 0x111; cmd.data = (u8)(block_size >> 8); - if (!wilc_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(wilc, &cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x111 data...\n"); goto _fail_; } @@ -139,7 +139,7 @@ static int sdio_clear_int(struct wilc *wilc) cmd.raw = 0; cmd.address = 0x4; cmd.data = 0; - wilc_sdio_cmd52(&cmd); + wilc_sdio_cmd52(wilc, &cmd); return cmd.data; } else { @@ -175,7 +175,7 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data) cmd.raw = 0; cmd.address = addr; cmd.data = data; - if (!wilc_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(wilc, &cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd 52, read reg (%08x) ...\n", addr); goto _fail_; } @@ -303,7 +303,7 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data) cmd.function = 0; cmd.raw = 0; cmd.address = addr; - if (!wilc_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(wilc, &cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd 52, read reg (%08x) ...\n", addr); goto _fail_; } @@ -518,7 +518,7 @@ static int sdio_init(struct wilc *wilc, wilc_debug_func func) cmd.raw = 1; cmd.address = 0x100; cmd.data = 0x80; - if (!wilc_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(wilc, &cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, enable csa...\n"); goto _fail_; } @@ -540,7 +540,7 @@ static int sdio_init(struct wilc *wilc, wilc_debug_func func) cmd.raw = 1; cmd.address = 0x2; cmd.data = 0x2; - if (!wilc_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(wilc, &cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio] Fail cmd 52, set IOE register...\n"); goto _fail_; } @@ -555,7 +555,7 @@ static int sdio_init(struct wilc *wilc, wilc_debug_func func) loop = 3; do { cmd.data = 0; - if (!wilc_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(wilc, &cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, get IOR register...\n"); goto _fail_; } @@ -584,7 +584,7 @@ static int sdio_init(struct wilc *wilc, wilc_debug_func func) cmd.raw = 1; cmd.address = 0x4; cmd.data = 0x3; - if (!wilc_sdio_cmd52(&cmd)) { + if (!wilc_sdio_cmd52(wilc, &cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, set IEN register...\n"); goto _fail_; } @@ -624,7 +624,7 @@ static int sdio_read_size(struct wilc *wilc, u32 *size) cmd.raw = 0; cmd.address = 0xf2; cmd.data = 0; - wilc_sdio_cmd52(&cmd); + wilc_sdio_cmd52(wilc, &cmd); tmp = cmd.data; /* cmd.read_write = 0; */ @@ -632,7 +632,7 @@ static int sdio_read_size(struct wilc *wilc, u32 *size) /* cmd.raw = 0; */ cmd.address = 0xf3; cmd.data = 0; - wilc_sdio_cmd52(&cmd); + wilc_sdio_cmd52(wilc, &cmd); tmp |= (cmd.data << 8); *size = tmp; @@ -656,7 +656,7 @@ static int sdio_read_int(struct wilc *wilc, u32 *int_status) cmd.function = 1; cmd.address = 0x04; cmd.data = 0; - wilc_sdio_cmd52(&cmd); + wilc_sdio_cmd52(wilc, &cmd); if (cmd.data & BIT(0)) tmp |= INT_0; @@ -684,7 +684,7 @@ static int sdio_read_int(struct wilc *wilc, u32 *int_status) cmd.raw = 0; cmd.address = 0xf7; cmd.data = 0; - wilc_sdio_cmd52(&cmd); + wilc_sdio_cmd52(wilc, &cmd); irq_flags = cmd.data & 0x1f; tmp |= ((irq_flags >> 0) << IRG_FLAGS_OFFSET); } @@ -727,7 +727,7 @@ static int sdio_clear_int_ext(struct wilc *wilc, u32 val) cmd.address = 0xf8; cmd.data = reg; - ret = wilc_sdio_cmd52(&cmd); + ret = wilc_sdio_cmd52(wilc, &cmd); if (!ret) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0xf8 data (%d) ...\n", __LINE__); goto _fail_; @@ -755,7 +755,7 @@ static int sdio_clear_int_ext(struct wilc *wilc, u32 val) cmd.address = 0xf8; cmd.data = BIT(i); - ret = wilc_sdio_cmd52(&cmd); + ret = wilc_sdio_cmd52(wilc, &cmd); if (!ret) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0xf8 data (%d) ...\n", __LINE__); goto _fail_; @@ -798,7 +798,7 @@ static int sdio_clear_int_ext(struct wilc *wilc, u32 val) cmd.raw = 0; cmd.address = 0xf6; cmd.data = vmm_ctl; - ret = wilc_sdio_cmd52(&cmd); + ret = wilc_sdio_cmd52(wilc, &cmd); if (!ret) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0xf6 data (%d) ...\n", __LINE__); goto _fail_; From 9b410fe82f444e473f1f13b3476f5aecdff50610 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Wed, 18 Nov 2015 15:11:28 +0900 Subject: [PATCH 558/843] staging: wilc1000: wilc_sdio_cmd53: pass struct wilc This patch adds new function parameter struct wilc and use it instead of global variable wilc_dev and pass wilc to the function as well. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan_sdio.c | 4 ++-- drivers/staging/wilc1000/linux_wlan_sdio.h | 2 +- drivers/staging/wilc1000/wilc_sdio.c | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index 6a38876ab2df..92633aa2c0bb 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -61,9 +61,9 @@ int wilc_sdio_cmd52(struct wilc *wilc, sdio_cmd52_t *cmd) } -int wilc_sdio_cmd53(sdio_cmd53_t *cmd) +int wilc_sdio_cmd53(struct wilc *wilc, sdio_cmd53_t *cmd) { - struct sdio_func *func = container_of(wilc_dev->dev, struct sdio_func, dev); + struct sdio_func *func = container_of(wilc->dev, struct sdio_func, dev); int size, ret; sdio_claim_host(func); diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h b/drivers/staging/wilc1000/linux_wlan_sdio.h index d966bb96d269..8d276c61cdcc 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.h +++ b/drivers/staging/wilc1000/linux_wlan_sdio.h @@ -2,7 +2,7 @@ int wilc_sdio_init(void); int wilc_sdio_cmd52(struct wilc *wilc, sdio_cmd52_t *cmd); -int wilc_sdio_cmd53(sdio_cmd53_t *cmd); +int wilc_sdio_cmd53(struct wilc *wilc, sdio_cmd53_t *cmd); int wilc_sdio_enable_interrupt(struct wilc *); void wilc_sdio_disable_interrupt(struct wilc *); diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index 6e53ea001ee5..ff7990a0b5ec 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -197,7 +197,7 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data) cmd.buffer = (u8 *)&data; cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */ - if (!wilc_sdio_cmd53(&cmd)) { + if (!wilc_sdio_cmd53(wilc, &cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53, write reg (%08x)...\n", addr); goto _fail_; } @@ -260,7 +260,7 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) if (!sdio_set_func0_csa_address(wilc, addr)) goto _fail_; } - if (!wilc_sdio_cmd53(&cmd)) { + if (!wilc_sdio_cmd53(wilc, &cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block send...\n", addr); goto _fail_; } @@ -281,7 +281,7 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) if (!sdio_set_func0_csa_address(wilc, addr)) goto _fail_; } - if (!wilc_sdio_cmd53(&cmd)) { + if (!wilc_sdio_cmd53(wilc, &cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], bytes send...\n", addr); goto _fail_; } @@ -324,7 +324,7 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data) cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */ - if (!wilc_sdio_cmd53(&cmd)) { + if (!wilc_sdio_cmd53(wilc, &cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53, read reg (%08x)...\n", addr); goto _fail_; } @@ -391,7 +391,7 @@ static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) if (!sdio_set_func0_csa_address(wilc, addr)) goto _fail_; } - if (!wilc_sdio_cmd53(&cmd)) { + if (!wilc_sdio_cmd53(wilc, &cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block read...\n", addr); goto _fail_; } @@ -412,7 +412,7 @@ static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) if (!sdio_set_func0_csa_address(wilc, addr)) goto _fail_; } - if (!wilc_sdio_cmd53(&cmd)) { + if (!wilc_sdio_cmd53(wilc, &cmd)) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], bytes read...\n", addr); goto _fail_; } From 643b2e42621f66ea951059880f2ba33163b0fef5 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Wed, 18 Nov 2015 15:11:29 +0900 Subject: [PATCH 559/843] staging: wilc1000: wilc_spi_write: pass struct wilc This patch add new function parameter struct wilc and use it instead of wilc_dev, and pass wilc to the function as well. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan_spi.c | 4 ++-- drivers/staging/wilc1000/linux_wlan_spi.h | 3 ++- drivers/staging/wilc1000/wilc_spi.c | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index bfd3cc391494..7be750bbe9da 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -66,9 +66,9 @@ int wilc_spi_init(void) return 1; } -int wilc_spi_write(u8 *b, u32 len) +int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len) { - struct spi_device *spi = to_spi_device(wilc_dev->dev); + struct spi_device *spi = to_spi_device(wilc->dev); int ret; struct spi_message msg; diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h b/drivers/staging/wilc1000/linux_wlan_spi.h index baa98cc9a247..41d47dc9cf95 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.h +++ b/drivers/staging/wilc1000/linux_wlan_spi.h @@ -2,9 +2,10 @@ #define LINUX_WLAN_SPI_H #include +#include "wilc_wfi_netdevice.h" int wilc_spi_init(void); -int wilc_spi_write(u8 *b, u32 len); +int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len); int wilc_spi_read(u8 *rb, u32 rlen); int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen); #endif diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index 53d098f80156..46f7ea835770 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -482,7 +482,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz) order = 0x2; } cmd |= order; - if (!wilc_spi_write(&cmd, 1)) { + if (!wilc_spi_write(wilc, &cmd, 1)) { PRINT_ER("[wilc spi]: Failed data block cmd write, bus error...\n"); result = N_FAIL; break; @@ -491,7 +491,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz) /** * Write data **/ - if (!wilc_spi_write(&b[ix], nbytes)) { + if (!wilc_spi_write(wilc, &b[ix], nbytes)) { PRINT_ER("[wilc spi]: Failed data block write, bus error...\n"); result = N_FAIL; break; @@ -501,7 +501,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz) * Write Crc **/ if (!g_spi.crc_off) { - if (!wilc_spi_write(crc, 2)) { + if (!wilc_spi_write(wilc, crc, 2)) { PRINT_ER("[wilc spi]: Failed data block crc write, bus error...\n"); result = N_FAIL; break; From 1b8d17a0c94fe6e42443a01f33a36a199ec58fe6 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Wed, 18 Nov 2015 15:11:30 +0900 Subject: [PATCH 560/843] staging: wilc1000: wilc_spi_read: pass struct wilc This patch adds new function parameter struct wilc and use it instead of global variable wilc_dev, and pass wilc to the functions as well. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan_spi.c | 4 ++-- drivers/staging/wilc1000/linux_wlan_spi.h | 2 +- drivers/staging/wilc1000/wilc_spi.c | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index 7be750bbe9da..5066191b9013 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -112,9 +112,9 @@ int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len) return ret; } -int wilc_spi_read(u8 *rb, u32 rlen) +int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen) { - struct spi_device *spi = to_spi_device(wilc_dev->dev); + struct spi_device *spi = to_spi_device(wilc->dev); int ret; if (rlen > 0) { diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h b/drivers/staging/wilc1000/linux_wlan_spi.h index 41d47dc9cf95..16f0b9fb82f8 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.h +++ b/drivers/staging/wilc1000/linux_wlan_spi.h @@ -6,6 +6,6 @@ int wilc_spi_init(void); int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len); -int wilc_spi_read(u8 *rb, u32 rlen); +int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen); int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen); #endif diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index 46f7ea835770..5e21109ceadf 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -365,7 +365,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, /** * Read bytes **/ - if (!wilc_spi_read(&b[ix], nbytes)) { + if (!wilc_spi_read(wilc, &b[ix], nbytes)) { PRINT_ER("[wilc spi]: Failed data block read, bus error...\n"); result = N_FAIL; goto _error_; @@ -375,7 +375,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, * Read Crc **/ if (!g_spi.crc_off) { - if (!wilc_spi_read(crc, 2)) { + if (!wilc_spi_read(wilc, crc, 2)) { PRINT_ER("[wilc spi]: Failed data block crc read, bus error...\n"); result = N_FAIL; goto _error_; @@ -406,7 +406,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, **/ retry = 10; do { - if (!wilc_spi_read(&rsp, 1)) { + if (!wilc_spi_read(wilc, &rsp, 1)) { PRINT_ER("[wilc spi]: Failed data response read, bus error...\n"); result = N_FAIL; break; @@ -422,7 +422,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, /** * Read bytes **/ - if (!wilc_spi_read(&b[ix], nbytes)) { + if (!wilc_spi_read(wilc, &b[ix], nbytes)) { PRINT_ER("[wilc spi]: Failed data block read, bus error...\n"); result = N_FAIL; break; @@ -432,7 +432,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, * Read Crc **/ if (!g_spi.crc_off) { - if (!wilc_spi_read(crc, 2)) { + if (!wilc_spi_read(wilc, crc, 2)) { PRINT_ER("[wilc spi]: Failed data block crc read, bus error...\n"); result = N_FAIL; break; From f8598aaa21b222864badc5d7f9e04fe1c4fbc12d Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Wed, 18 Nov 2015 15:11:31 +0900 Subject: [PATCH 561/843] staging: wilc1000: wilc_spi_write_read: pass struct wilc This patch adds new function parameter struct wilc and use it instead of global variable wilc_dev, and pass wilc to the function as well. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan_spi.c | 4 ++-- drivers/staging/wilc1000/linux_wlan_spi.h | 2 +- drivers/staging/wilc1000/wilc_spi.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index 5066191b9013..f3ffc9e6d626 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -154,9 +154,9 @@ int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen) return ret; } -int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen) +int wilc_spi_write_read(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen) { - struct spi_device *spi = to_spi_device(wilc_dev->dev); + struct spi_device *spi = to_spi_device(wilc->dev); int ret; if (rlen > 0) { diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h b/drivers/staging/wilc1000/linux_wlan_spi.h index 16f0b9fb82f8..00733aba9179 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.h +++ b/drivers/staging/wilc1000/linux_wlan_spi.h @@ -7,5 +7,5 @@ int wilc_spi_init(void); int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len); int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen); -int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen); +int wilc_spi_write_read(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen); #endif diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index 5e21109ceadf..d6f412117fd8 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -250,7 +250,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, } rix = len; - if (!wilc_spi_write_read(wb, rb, len2)) { + if (!wilc_spi_write_read(wilc, wb, rb, len2)) { PRINT_ER("[wilc spi]: Failed cmd write, bus error...\n"); result = N_FAIL; return result; From b82d940db037d1aaf591845cdd1352ceb439b929 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Wed, 18 Nov 2015 15:11:32 +0900 Subject: [PATCH 562/843] staging: wilc1000: add struct wilc to host_if_drv This patch adds struct wilc to host_if_dev and assign wilc to use driver's primary structure in host_if_dev. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 1 + drivers/staging/wilc1000/host_interface.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 672092b386dc..4fae80dae6e0 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3843,6 +3843,7 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) result = -ENOMEM; goto _fail_; } + hif_drv->wilc = wilc; *hif_drv_handler = hif_drv; err = add_handler_in_list(hif_drv); if (err) { diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index efeb9e233589..004467c65502 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -259,7 +259,9 @@ enum p2p_listen_state { P2P_GRP_FORMATION }; +struct wilc; struct host_if_drv { + struct wilc *wilc; struct user_scan_req usr_scan_req; struct user_conn_req usr_conn_req; struct remain_ch remain_on_ch; From ec62e6d1ec3f668ee0462734ede28be6b3d7db1c Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Wed, 18 Nov 2015 15:11:33 +0900 Subject: [PATCH 563/843] staging: wilc1000: wilc_send_config_pkt: pass struct wilc This patch passes struct wilc to wilc_send_config_pkt. The function wilc_wlan_cfg_set and wilc_wlan_cfg_get function will get wilc to replace wilc_dev with it. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 3 +- drivers/staging/wilc1000/coreconfigurator.h | 3 +- drivers/staging/wilc1000/host_interface.c | 127 +++++++++++--------- 3 files changed, 74 insertions(+), 59 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 47fa82f26b53..dc290d13fd37 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -588,7 +588,8 @@ s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo) * @date 1 Mar 2012 * @version 1.0 */ -s32 wilc_send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv) +s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids, + u32 count, u32 drv) { s32 counter = 0, ret = 0; diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h index 912d5c2879e4..3f2a7d3c3a17 100644 --- a/drivers/staging/wilc1000/coreconfigurator.h +++ b/drivers/staging/wilc1000/coreconfigurator.h @@ -127,7 +127,8 @@ typedef struct { size_t ie_len; } tstrDisconnectNotifInfo; -s32 wilc_send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv); +s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids, + u32 count, u32 drv); s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo); s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo); diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 4fae80dae6e0..db34048864e6 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -329,7 +329,7 @@ static s32 handle_set_channel(struct host_if_drv *hif_drv, PRINT_D(HOSTINF_DBG, "Setting channel\n"); - result = wilc_send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { @@ -351,7 +351,8 @@ static s32 handle_set_wfi_drv_handler(struct host_if_drv *hif_drv, wid.val = (s8 *)&hif_drv_handler->handler; wid.size = sizeof(u32); - result = wilc_send_config_pkt(SET_CFG, &wid, 1, hif_drv_handler->handler); + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, + hif_drv_handler->handler); if (!hif_drv) up(&hif_sema_driver); @@ -375,7 +376,7 @@ static s32 handle_set_operation_mode(struct host_if_drv *hif_drv, wid.val = (s8 *)&hif_op_mode->mode; wid.size = sizeof(u32); - result = wilc_send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if ((hif_op_mode->mode) == IDLE_MODE) @@ -410,7 +411,7 @@ static s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 *ip_addr, u8 id wid.val = (u8 *)ip_addr; wid.size = IP_ALEN; - result = wilc_send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); host_int_get_ipaddress(hif_drv, firmware_ip_addr, idx); @@ -435,7 +436,7 @@ static s32 handle_get_ip_address(struct host_if_drv *hif_drv, u8 idx) wid.val = kmalloc(IP_ALEN, GFP_KERNEL); wid.size = IP_ALEN; - result = wilc_send_config_pkt(GET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1, get_id_from_handler(hif_drv)); PRINT_INFO(HOSTINF_DBG, "%pI4\n", wid.val); @@ -478,7 +479,7 @@ static s32 handle_set_mac_address(struct host_if_drv *hif_drv, wid.size = ETH_ALEN; PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", wid.val); - result = wilc_send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { PRINT_ER("Failed to set mac address\n"); @@ -500,7 +501,7 @@ static s32 handle_get_mac_address(struct host_if_drv *hif_drv, wid.val = get_mac_addr->mac_addr; wid.size = ETH_ALEN; - result = wilc_send_config_pkt(GET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { @@ -795,8 +796,8 @@ static s32 handle_cfg_param(struct host_if_drv *hif_drv, wid_cnt++; } - result = wilc_send_config_pkt(SET_CFG, wid_list, wid_cnt, - get_id_from_handler(hif_drv)); + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, wid_list, + wid_cnt, get_id_from_handler(hif_drv)); if (result) PRINT_ER("Error in setting CFG params\n"); @@ -918,8 +919,9 @@ static s32 Handle_Scan(struct host_if_drv *hif_drv, else if (hif_drv->hif_state == HOST_IF_IDLE) scan_while_connected = false; - result = wilc_send_config_pkt(SET_CFG, strWIDList, u32WidsCount, - get_id_from_handler(hif_drv)); + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, strWIDList, + u32WidsCount, + get_id_from_handler(hif_drv)); if (result) PRINT_ER("Failed to send scan paramters config packet\n"); @@ -962,7 +964,7 @@ static s32 Handle_ScanDone(struct host_if_drv *hif_drv, wid.val = (s8 *)&u8abort_running_scan; wid.size = sizeof(char); - result = wilc_send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { @@ -1216,8 +1218,9 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv, PRINT_D(GENERIC_DBG, "save bssid = %pM\n", wilc_connected_SSID); } - result = wilc_send_config_pkt(SET_CFG, strWIDList, u32WidsCount, - get_id_from_handler(hif_drv)); + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, strWIDList, + u32WidsCount, + get_id_from_handler(hif_drv)); if (result) { PRINT_ER("failed to send config packet\n"); result = -EFAULT; @@ -1313,8 +1316,9 @@ static s32 Handle_FlushConnect(struct host_if_drv *hif_drv) u32WidsCount++; - result = wilc_send_config_pkt(SET_CFG, strWIDList, u32WidsCount, - get_id_from_handler(join_req_drv)); + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, strWIDList, + u32WidsCount, + get_id_from_handler(join_req_drv)); if (result) { PRINT_ER("failed to send config packet\n"); result = -EINVAL; @@ -1374,7 +1378,7 @@ static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv) PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); - result = wilc_send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) PRINT_ER("Failed to send dissconect config packet\n"); @@ -1757,8 +1761,9 @@ static int Handle_Key(struct host_if_drv *hif_drv, strWIDList[3].size = pstrHostIFkeyAttr->attr.wep.key_len; strWIDList[3].val = (s8 *)pu8keybuf; - result = wilc_send_config_pkt(SET_CFG, strWIDList, 4, - get_id_from_handler(hif_drv)); + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, + strWIDList, 4, + get_id_from_handler(hif_drv)); kfree(pu8keybuf); } @@ -1780,8 +1785,9 @@ static int Handle_Key(struct host_if_drv *hif_drv, wid.val = (s8 *)pu8keybuf; wid.size = pstrHostIFkeyAttr->attr.wep.key_len + 2; - result = wilc_send_config_pkt(SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, + &wid, 1, + get_id_from_handler(hif_drv)); kfree(pu8keybuf); } else if (pstrHostIFkeyAttr->action & REMOVEKEY) { PRINT_D(HOSTINF_DBG, "Removing key\n"); @@ -1792,8 +1798,9 @@ static int Handle_Key(struct host_if_drv *hif_drv, wid.val = s8idxarray; wid.size = 1; - result = wilc_send_config_pkt(SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, + &wid, 1, + get_id_from_handler(hif_drv)); } else { wid.id = (u16)WID_KEY_ID; wid.type = WID_CHAR; @@ -1802,8 +1809,9 @@ static int Handle_Key(struct host_if_drv *hif_drv, PRINT_D(HOSTINF_DBG, "Setting default key index\n"); - result = wilc_send_config_pkt(SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, + &wid, 1, + get_id_from_handler(hif_drv)); } up(&hif_drv->sem_test_key_block); break; @@ -1835,8 +1843,9 @@ static int Handle_Key(struct host_if_drv *hif_drv, strWIDList[1].val = (s8 *)pu8keybuf; strWIDList[1].size = RX_MIC_KEY_MSG_LEN; - result = wilc_send_config_pkt(SET_CFG, strWIDList, 2, - get_id_from_handler(hif_drv)); + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, + strWIDList, 2, + get_id_from_handler(hif_drv)); kfree(pu8keybuf); up(&hif_drv->sem_test_key_block); @@ -1868,8 +1877,9 @@ static int Handle_Key(struct host_if_drv *hif_drv, wid.val = (s8 *)pu8keybuf; wid.size = RX_MIC_KEY_MSG_LEN; - result = wilc_send_config_pkt(SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, + &wid, 1, + get_id_from_handler(hif_drv)); kfree(pu8keybuf); up(&hif_drv->sem_test_key_block); @@ -1907,8 +1917,9 @@ _WPARxGtk_end_case_: strWIDList[1].val = (s8 *)pu8keybuf; strWIDList[1].size = PTK_KEY_MSG_LEN + 1; - result = wilc_send_config_pkt(SET_CFG, strWIDList, 2, - get_id_from_handler(hif_drv)); + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, + strWIDList, 2, + get_id_from_handler(hif_drv)); kfree(pu8keybuf); up(&hif_drv->sem_test_key_block); } @@ -1930,8 +1941,9 @@ _WPARxGtk_end_case_: wid.val = (s8 *)pu8keybuf; wid.size = PTK_KEY_MSG_LEN; - result = wilc_send_config_pkt(SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, + &wid, 1, + get_id_from_handler(hif_drv)); kfree(pu8keybuf); up(&hif_drv->sem_test_key_block); } @@ -1965,7 +1977,7 @@ _WPAPtk_end_case_: wid.val = (s8 *)pu8keybuf; wid.size = (pstrHostIFkeyAttr->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1; - result = wilc_send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); kfree(pu8keybuf); @@ -1997,7 +2009,7 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv) eth_zero_addr(wilc_connected_SSID); - result = wilc_send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { @@ -2084,7 +2096,7 @@ static s32 Handle_GetChnl(struct host_if_drv *hif_drv) PRINT_D(HOSTINF_DBG, "Getting channel value\n"); - result = wilc_send_config_pkt(GET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { @@ -2109,7 +2121,7 @@ static void Handle_GetRssi(struct host_if_drv *hif_drv) PRINT_D(HOSTINF_DBG, "Getting RSSI value\n"); - result = wilc_send_config_pkt(GET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { PRINT_ER("Failed to get RSSI value\n"); @@ -2133,7 +2145,7 @@ static void Handle_GetLinkspeed(struct host_if_drv *hif_drv) PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n"); - result = wilc_send_config_pkt(GET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { PRINT_ER("Failed to get LINKSPEED value\n"); @@ -2178,8 +2190,9 @@ static s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pst strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->tx_fail_cnt; u32WidsCount++; - result = wilc_send_config_pkt(GET_CFG, strWIDList, u32WidsCount, - get_id_from_handler(hif_drv)); + result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, strWIDList, + u32WidsCount, + get_id_from_handler(hif_drv)); if (result) PRINT_ER("Failed to send scan paramters config packet\n"); @@ -2205,7 +2218,7 @@ static s32 Handle_Get_InActiveTime(struct host_if_drv *hif_drv, PRINT_D(CFG80211_DBG, "SETING STA inactive time\n"); - result = wilc_send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { @@ -2218,7 +2231,7 @@ static s32 Handle_Get_InActiveTime(struct host_if_drv *hif_drv, wid.val = (s8 *)&inactive_time; wid.size = sizeof(u32); - result = wilc_send_config_pkt(GET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { @@ -2277,7 +2290,7 @@ static void Handle_AddBeacon(struct host_if_drv *hif_drv, memcpy(pu8CurrByte, pstrSetBeaconParam->tail, pstrSetBeaconParam->tail_len); pu8CurrByte += pstrSetBeaconParam->tail_len; - result = wilc_send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) PRINT_ER("Failed to send add beacon config packet\n"); @@ -2306,7 +2319,7 @@ static void Handle_DelBeacon(struct host_if_drv *hif_drv) PRINT_D(HOSTINF_DBG, "Deleting BEACON\n"); - result = wilc_send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) PRINT_ER("Failed to send delete beacon config packet\n"); @@ -2379,7 +2392,7 @@ static void Handle_AddStation(struct host_if_drv *hif_drv, pu8CurrByte = wid.val; pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); - result = wilc_send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result != 0) PRINT_ER("Failed to send add station config packet\n"); @@ -2421,7 +2434,7 @@ static void Handle_DelAllSta(struct host_if_drv *hif_drv, pu8CurrByte += ETH_ALEN; } - result = wilc_send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) PRINT_ER("Failed to send add station config packet\n"); @@ -2453,7 +2466,7 @@ static void Handle_DelStation(struct host_if_drv *hif_drv, memcpy(pu8CurrByte, pstrDelStaParam->mac_addr, ETH_ALEN); - result = wilc_send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) PRINT_ER("Failed to send add station config packet\n"); @@ -2481,7 +2494,7 @@ static void Handle_EditStation(struct host_if_drv *hif_drv, pu8CurrByte = wid.val; pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); - result = wilc_send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) PRINT_ER("Failed to send edit station config packet\n"); @@ -2542,7 +2555,7 @@ static int Handle_RemainOnChan(struct host_if_drv *hif_drv, wid.val[0] = u8remain_on_chan_flag; wid.val[1] = (s8)pstrHostIfRemainOnChan->ch; - result = wilc_send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result != 0) PRINT_ER("Failed to set remain on channel\n"); @@ -2590,7 +2603,7 @@ static int Handle_RegisterFrame(struct host_if_drv *hif_drv, wid.size = sizeof(u16) + 2; - result = wilc_send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { PRINT_ER("Failed to frame register config packet\n"); @@ -2622,7 +2635,7 @@ static u32 Handle_ListenStateExpired(struct host_if_drv *hif_drv, wid.val[0] = u8remain_on_chan_flag; wid.val[1] = FALSE_FRMWR_CHANNEL; - result = wilc_send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result != 0) { PRINT_ER("Failed to set remain on channel\n"); @@ -2680,7 +2693,7 @@ static void Handle_PowerManagement(struct host_if_drv *hif_drv, PRINT_D(HOSTINF_DBG, "Handling Power Management\n"); - result = wilc_send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) PRINT_ER("Failed to send power management config packet\n"); @@ -2717,7 +2730,7 @@ static void Handle_SetMulticastFilter(struct host_if_drv *hif_drv, memcpy(pu8CurrByte, wilc_multicast_mac_addr_list, ((strHostIfSetMulti->cnt) * ETH_ALEN)); - result = wilc_send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) PRINT_ER("Failed to send setup multicast config packet\n"); @@ -2763,7 +2776,7 @@ static s32 Handle_AddBASession(struct host_if_drv *hif_drv, *ptr++ = 8; *ptr++ = 0; - result = wilc_send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) PRINT_D(HOSTINF_DBG, "Couldn't open BA Session\n"); @@ -2782,7 +2795,7 @@ static s32 Handle_AddBASession(struct host_if_drv *hif_drv, *ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF); *ptr++ = ((strHostIfBASessionInfo->time_out >> 16) & 0xFF); *ptr++ = 3; - result = wilc_send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); kfree(wid.val); @@ -2817,7 +2830,7 @@ static s32 Handle_DelAllRxBASessions(struct host_if_drv *hif_drv, *ptr++ = 0; *ptr++ = 32; - result = wilc_send_config_pkt(SET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n"); @@ -3551,7 +3564,7 @@ static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, wid.val = pu8AssocRespInfo; wid.size = u32MaxAssocRespInfoLen; - result = wilc_send_config_pkt(GET_CFG, &wid, 1, + result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1, get_id_from_handler(hif_drv)); if (result) { *pu32RcvdAssocRespInfoLen = 0; From 89758e13b89608e168a192a6df51a70d32ebd737 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Wed, 18 Nov 2015 15:11:34 +0900 Subject: [PATCH 564/843] staging: wilc1000: wilc_wlan_cfg_set: pass struct wilc This patch pass struct wilc to the function and use it instead of global variable wilc_dev. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 2 +- drivers/staging/wilc1000/linux_wlan.c | 101 +++++++++++--------- drivers/staging/wilc1000/wilc_wlan.c | 5 +- drivers/staging/wilc1000/wilc_wlan.h | 4 +- 4 files changed, 63 insertions(+), 49 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index dc290d13fd37..6278aecba2f7 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -616,7 +616,7 @@ s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids, } else if (mode == SET_CFG) { for (counter = 0; counter < count; counter++) { PRINT_D(CORECONFIG_DBG, "Sending config SET PACKET WID:%x\n", wids[counter].id); - if (!wilc_wlan_cfg_set(!counter, + if (!wilc_wlan_cfg_set(wilc, !counter, wids[counter].id, wids[counter].val, wids[counter].size, diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 43458e6ca691..792cc0be5a63 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -537,179 +537,194 @@ static int linux_wlan_init_test_config(struct net_device *dev, *(int *)c_val = 1; - if (!wilc_wlan_cfg_set(1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0)) goto _fail_; c_val[0] = 0; - if (!wilc_wlan_cfg_set(0, WID_PC_TEST_MODE, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_PC_TEST_MODE, c_val, 1, 0, 0)) goto _fail_; c_val[0] = INFRASTRUCTURE; - if (!wilc_wlan_cfg_set(0, WID_BSS_TYPE, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_BSS_TYPE, c_val, 1, 0, 0)) goto _fail_; c_val[0] = RATE_AUTO; - if (!wilc_wlan_cfg_set(0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0)) goto _fail_; c_val[0] = G_MIXED_11B_2_MODE; - if (!wilc_wlan_cfg_set(0, WID_11G_OPERATING_MODE, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_11G_OPERATING_MODE, c_val, 1, 0, + 0)) goto _fail_; c_val[0] = 1; - if (!wilc_wlan_cfg_set(0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0)) goto _fail_; c_val[0] = G_SHORT_PREAMBLE; - if (!wilc_wlan_cfg_set(0, WID_PREAMBLE, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_PREAMBLE, c_val, 1, 0, 0)) goto _fail_; c_val[0] = AUTO_PROT; - if (!wilc_wlan_cfg_set(0, WID_11N_PROT_MECH, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_PROT_MECH, c_val, 1, 0, 0)) goto _fail_; c_val[0] = ACTIVE_SCAN; - if (!wilc_wlan_cfg_set(0, WID_SCAN_TYPE, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_SCAN_TYPE, c_val, 1, 0, 0)) goto _fail_; c_val[0] = SITE_SURVEY_OFF; - if (!wilc_wlan_cfg_set(0, WID_SITE_SURVEY, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_SITE_SURVEY, c_val, 1, 0, 0)) goto _fail_; *((int *)c_val) = 0xffff; - if (!wilc_wlan_cfg_set(0, WID_RTS_THRESHOLD, c_val, 2, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_RTS_THRESHOLD, c_val, 2, 0, 0)) goto _fail_; *((int *)c_val) = 2346; - if (!wilc_wlan_cfg_set(0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0)) goto _fail_; c_val[0] = 0; - if (!wilc_wlan_cfg_set(0, WID_BCAST_SSID, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_BCAST_SSID, c_val, 1, 0, 0)) goto _fail_; c_val[0] = 1; - if (!wilc_wlan_cfg_set(0, WID_QOS_ENABLE, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_QOS_ENABLE, c_val, 1, 0, 0)) goto _fail_; c_val[0] = NO_POWERSAVE; - if (!wilc_wlan_cfg_set(0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0)) goto _fail_; c_val[0] = NO_SECURITY; /* NO_ENCRYPT, 0x79 */ - if (!wilc_wlan_cfg_set(0, WID_11I_MODE, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_11I_MODE, c_val, 1, 0, 0)) goto _fail_; c_val[0] = OPEN_SYSTEM; - if (!wilc_wlan_cfg_set(0, WID_AUTH_TYPE, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_AUTH_TYPE, c_val, 1, 0, 0)) goto _fail_; strcpy(c_val, "123456790abcdef1234567890"); - if (!wilc_wlan_cfg_set(0, WID_WEP_KEY_VALUE, c_val, (strlen(c_val) + 1), 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_WEP_KEY_VALUE, c_val, + (strlen(c_val) + 1), 0, 0)) goto _fail_; strcpy(c_val, "12345678"); - if (!wilc_wlan_cfg_set(0, WID_11I_PSK, c_val, (strlen(c_val)), 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_11I_PSK, c_val, (strlen(c_val)), 0, + 0)) goto _fail_; strcpy(c_val, "password"); - if (!wilc_wlan_cfg_set(0, WID_1X_KEY, c_val, (strlen(c_val) + 1), 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_1X_KEY, c_val, (strlen(c_val) + 1), + 0, 0)) goto _fail_; c_val[0] = 192; c_val[1] = 168; c_val[2] = 1; c_val[3] = 112; - if (!wilc_wlan_cfg_set(0, WID_1X_SERV_ADDR, c_val, 4, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_1X_SERV_ADDR, c_val, 4, 0, 0)) goto _fail_; c_val[0] = 3; - if (!wilc_wlan_cfg_set(0, WID_LISTEN_INTERVAL, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_LISTEN_INTERVAL, c_val, 1, 0, 0)) goto _fail_; c_val[0] = 3; - if (!wilc_wlan_cfg_set(0, WID_DTIM_PERIOD, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_DTIM_PERIOD, c_val, 1, 0, 0)) goto _fail_; c_val[0] = NORMAL_ACK; - if (!wilc_wlan_cfg_set(0, WID_ACK_POLICY, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_ACK_POLICY, c_val, 1, 0, 0)) goto _fail_; c_val[0] = 0; - if (!wilc_wlan_cfg_set(0, WID_USER_CONTROL_ON_TX_POWER, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_USER_CONTROL_ON_TX_POWER, c_val, 1, + 0, 0)) goto _fail_; c_val[0] = 48; - if (!wilc_wlan_cfg_set(0, WID_TX_POWER_LEVEL_11A, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_TX_POWER_LEVEL_11A, c_val, 1, 0, + 0)) goto _fail_; c_val[0] = 28; - if (!wilc_wlan_cfg_set(0, WID_TX_POWER_LEVEL_11B, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_TX_POWER_LEVEL_11B, c_val, 1, 0, + 0)) goto _fail_; *((int *)c_val) = 100; - if (!wilc_wlan_cfg_set(0, WID_BEACON_INTERVAL, c_val, 2, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_BEACON_INTERVAL, c_val, 2, 0, 0)) goto _fail_; c_val[0] = REKEY_DISABLE; - if (!wilc_wlan_cfg_set(0, WID_REKEY_POLICY, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_REKEY_POLICY, c_val, 1, 0, 0)) goto _fail_; *((int *)c_val) = 84600; - if (!wilc_wlan_cfg_set(0, WID_REKEY_PERIOD, c_val, 4, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_REKEY_PERIOD, c_val, 4, 0, 0)) goto _fail_; *((int *)c_val) = 500; - if (!wilc_wlan_cfg_set(0, WID_REKEY_PACKET_COUNT, c_val, 4, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_REKEY_PACKET_COUNT, c_val, 4, 0, + 0)) goto _fail_; c_val[0] = 1; - if (!wilc_wlan_cfg_set(0, WID_SHORT_SLOT_ALLOWED, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_SHORT_SLOT_ALLOWED, c_val, 1, 0, + 0)) goto _fail_; c_val[0] = G_SELF_CTS_PROT; - if (!wilc_wlan_cfg_set(0, WID_11N_ERP_PROT_TYPE, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_ERP_PROT_TYPE, c_val, 1, 0, 0)) goto _fail_; c_val[0] = 1; - if (!wilc_wlan_cfg_set(0, WID_11N_ENABLE, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_ENABLE, c_val, 1, 0, 0)) goto _fail_; c_val[0] = HT_MIXED_MODE; - if (!wilc_wlan_cfg_set(0, WID_11N_OPERATING_MODE, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_OPERATING_MODE, c_val, 1, 0, + 0)) goto _fail_; c_val[0] = 1; - if (!wilc_wlan_cfg_set(0, WID_11N_TXOP_PROT_DISABLE, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_TXOP_PROT_DISABLE, c_val, 1, 0, + 0)) goto _fail_; memcpy(c_val, mac_add, 6); - if (!wilc_wlan_cfg_set(0, WID_MAC_ADDR, c_val, 6, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_MAC_ADDR, c_val, 6, 0, 0)) goto _fail_; c_val[0] = DETECT_PROTECT_REPORT; - if (!wilc_wlan_cfg_set(0, WID_11N_OBSS_NONHT_DETECTION, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_OBSS_NONHT_DETECTION, c_val, 1, + 0, 0)) goto _fail_; c_val[0] = RTS_CTS_NONHT_PROT; - if (!wilc_wlan_cfg_set(0, WID_11N_HT_PROT_TYPE, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_HT_PROT_TYPE, c_val, 1, 0, 0)) goto _fail_; c_val[0] = 0; - if (!wilc_wlan_cfg_set(0, WID_11N_RIFS_PROT_ENABLE, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_RIFS_PROT_ENABLE, c_val, 1, 0, + 0)) goto _fail_; c_val[0] = MIMO_MODE; - if (!wilc_wlan_cfg_set(0, WID_11N_SMPS_MODE, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_SMPS_MODE, c_val, 1, 0, 0)) goto _fail_; c_val[0] = 7; - if (!wilc_wlan_cfg_set(0, WID_11N_CURRENT_TX_MCS, c_val, 1, 0, 0)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_CURRENT_TX_MCS, c_val, 1, 0, + 0)) goto _fail_; c_val[0] = 1; - if (!wilc_wlan_cfg_set(0, WID_11N_IMMEDIATE_BA_ENABLED, c_val, 1, 1, 1)) + if (!wilc_wlan_cfg_set(wilc, 0, WID_11N_IMMEDIATE_BA_ENABLED, c_val, 1, + 1, 1)) goto _fail_; return 0; diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 9ac6ad7df605..03c707b6488f 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1499,11 +1499,10 @@ static int wilc_wlan_cfg_commit(struct wilc *wilc, int type, u32 drv_handler) return 0; } -int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, - int commit, u32 drv_handler) +int wilc_wlan_cfg_set(struct wilc *wilc, int start, u32 wid, u8 *buffer, + u32 buffer_size, int commit, u32 drv_handler) { wilc_wlan_dev_t *p = &g_wlan; - struct wilc *wilc = wilc_dev; u32 offset; int ret_size; diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index c3f13aa14c70..e1a8c730831c 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -289,8 +289,8 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count); void wilc_handle_isr(struct wilc *wilc); void wilc_wlan_cleanup(struct net_device *dev); -int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size, - int commit, u32 drv_handler); +int wilc_wlan_cfg_set(struct wilc *wilc, int start, u32 wid, u8 *buffer, + u32 buffer_size, int commit, u32 drv_handler); int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drv_handler); int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size); int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, From d40c99c74c91441b935a900b5c92df7f81e0b8b1 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Wed, 18 Nov 2015 15:11:35 +0900 Subject: [PATCH 565/843] staging: wilc1000: wilc_wlan_cfg_get: pass struct wilc This patch passes the struct wilc to the function and use it instead of global variable wilc_dev. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 2 +- drivers/staging/wilc1000/linux_wlan.c | 2 +- drivers/staging/wilc1000/wilc_wlan.c | 4 ++-- drivers/staging/wilc1000/wilc_wlan.h | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 6278aecba2f7..0cd2accf1a34 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -597,7 +597,7 @@ s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids, for (counter = 0; counter < count; counter++) { PRINT_INFO(CORECONFIG_DBG, "Sending CFG packet [%d][%d]\n", !counter, (counter == count - 1)); - if (!wilc_wlan_cfg_get(!counter, + if (!wilc_wlan_cfg_get(wilc, !counter, wids[counter].id, (counter == count - 1), drv)) { diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 792cc0be5a63..1457e755dc49 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -939,7 +939,7 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) goto _fail_irq_enable_; } - if (wilc_wlan_cfg_get(1, WID_FIRMWARE_VERSION, 1, 0)) { + if (wilc_wlan_cfg_get(wl, 1, WID_FIRMWARE_VERSION, 1, 0)) { int size; char Firmware_ver[20]; diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 03c707b6488f..a27185115e49 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1540,10 +1540,10 @@ int wilc_wlan_cfg_set(struct wilc *wilc, int start, u32 wid, u8 *buffer, return ret_size; } -int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drv_handler) +int wilc_wlan_cfg_get(struct wilc *wilc, int start, u32 wid, int commit, + u32 drv_handler) { wilc_wlan_dev_t *p = &g_wlan; - struct wilc *wilc = wilc_dev; u32 offset; int ret_size; diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index e1a8c730831c..2ac63a3e092a 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -291,7 +291,8 @@ void wilc_handle_isr(struct wilc *wilc); void wilc_wlan_cleanup(struct net_device *dev); int wilc_wlan_cfg_set(struct wilc *wilc, int start, u32 wid, u8 *buffer, u32 buffer_size, int commit, u32 drv_handler); -int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drv_handler); +int wilc_wlan_cfg_get(struct wilc *wilc, int start, u32 wid, int commit, + u32 drv_handler); int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size); int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, u32 buffer_size, wilc_tx_complete_func_t func); From d36ec22d1d9b8020e08d9ae9ee7db73554a355e7 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Wed, 18 Nov 2015 15:11:36 +0900 Subject: [PATCH 566/843] staging: wilc1000: wilc_dbg: remove wilc This patch remove parameter struct wilc since it is not used and also wilc_dev will be removed. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 2 +- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +- drivers/staging/wilc1000/wilc_wlan.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 1457e755dc49..cd471abcedf7 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -245,7 +245,7 @@ static void deinit_irq(struct net_device *dev) } } -void wilc_dbg(struct wilc *wilc, u8 *buff) +void wilc_dbg(u8 *buff) { PRINT_D(INIT_DBG, "%d\n", *buff); } diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 6ec6d6a2868c..4c8de8b19c83 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -210,7 +210,7 @@ extern struct net_device *WILC_WFI_devs[]; void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset); void wilc_mac_indicate(struct wilc *wilc, int flag); void wilc_rx_complete(struct wilc *wilc); -void wilc_dbg(struct wilc *, u8 *buff); +void wilc_dbg(u8 *buff); int wilc_lock_timeout(struct wilc *wilc, void *, u32 timeout); void wilc_netdev_cleanup(struct wilc *wilc); diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index a27185115e49..a73e99f64f27 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -51,7 +51,7 @@ static void wilc_debug(u32 flag, char *fmt, ...) vsprintf(buf, fmt, args); va_end(args); - wilc_dbg(wilc_dev, buf); + wilc_dbg(buf); } } From 825b966f9ee283b47cc8fa463c638c7ed1d1d922 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Wed, 18 Nov 2015 15:11:37 +0900 Subject: [PATCH 567/843] staging: wilc1000: use wilc instead of wilc_dev and remove wilc_dev This patch changes wilc_dev with wilc in the function call wilc_wlan_get_num_conn_ifcs, and remove wilc_dev and it's related codes. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 2 +- drivers/staging/wilc1000/linux_wlan.c | 5 +---- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 - 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index db34048864e6..b1b4802fc56a 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2919,7 +2919,7 @@ static int hostIFthread(void *pvArg) del_timer(&hif_drv->scan_timer); PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); - if (!wilc_wlan_get_num_conn_ifcs(wilc_dev)) + if (!wilc_wlan_get_num_conn_ifcs(wilc)) wilc_chip_sleep_manually(wilc); Handle_ScanDone(msg.drv, SCAN_EVENT_DONE); diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index cd471abcedf7..73954f468ae8 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -43,8 +43,6 @@ static int mac_init_fn(struct net_device *ndev); static struct net_device_stats *mac_stats(struct net_device *dev); static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd); static void wilc_set_multicast_list(struct net_device *dev); -struct wilc *wilc_dev; -EXPORT_SYMBOL_GPL(wilc_dev); bool wilc_enable_ps = true; @@ -1432,7 +1430,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, sema_init(&close_exit_sync, 0); - wl = kzalloc(sizeof(*wilc_dev), GFP_KERNEL); + wl = kzalloc(sizeof(*wl), GFP_KERNEL); if (!wl) return -ENOMEM; @@ -1495,7 +1493,6 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, nic->iftype = STATION_MODE; nic->mac_opened = 0; } - wilc_dev = *wilc = wl; return 0; } diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 4c8de8b19c83..212d607748e9 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -205,7 +205,6 @@ struct WILC_WFI_mon_priv { int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic); -extern struct wilc *wilc_dev; extern struct net_device *WILC_WFI_devs[]; void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset); void wilc_mac_indicate(struct wilc *wilc, int flag); From 771fbae49b5c49bd692b42d46fe4f4d96c61d953 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:10 +0900 Subject: [PATCH 568/843] staging: wilc1000: rename u32LastScannedNtwrksCountShadow variable This patch renames u32LastScannedNtwrksCountShadow variable to last_scanned_cnt to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 50 +++++++++---------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index cc279c654e53..97848e400288 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -107,7 +107,7 @@ extern int wilc_mac_open(struct net_device *ndev); extern int wilc_mac_close(struct net_device *ndev); static tstrNetworkInfo astrLastScannedNtwrksShadow[MAX_NUM_SCANNED_NETWORKS_SHADOW]; -static u32 u32LastScannedNtwrksCountShadow; +static u32 last_scanned_cnt; struct timer_list wilc_during_ip_timer; static struct timer_list hAgingTimer; static u8 op_ifcs; @@ -213,16 +213,16 @@ static void clear_shadow_scan(void *pUserVoid) del_timer_sync(&hAgingTimer); PRINT_INFO(CORECONFIG_DBG, "destroy aging timer\n"); - for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { - if (astrLastScannedNtwrksShadow[u32LastScannedNtwrksCountShadow].pu8IEs != NULL) { + for (i = 0; i < last_scanned_cnt; i++) { + if (astrLastScannedNtwrksShadow[last_scanned_cnt].pu8IEs != NULL) { kfree(astrLastScannedNtwrksShadow[i].pu8IEs); - astrLastScannedNtwrksShadow[u32LastScannedNtwrksCountShadow].pu8IEs = NULL; + astrLastScannedNtwrksShadow[last_scanned_cnt].pu8IEs = NULL; } wilc_free_join_params(astrLastScannedNtwrksShadow[i].pJoinParams); astrLastScannedNtwrksShadow[i].pJoinParams = NULL; } - u32LastScannedNtwrksCountShadow = 0; + last_scanned_cnt = 0; } } @@ -251,7 +251,7 @@ static void refresh_scan(void *pUserVoid, u8 all, bool bDirectScan) priv = (struct wilc_priv *)pUserVoid; wiphy = priv->dev->ieee80211_ptr->wiphy; - for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { + for (i = 0; i < last_scanned_cnt; i++) { tstrNetworkInfo *pstrNetworkInfo; pstrNetworkInfo = &(astrLastScannedNtwrksShadow[i]); @@ -284,19 +284,16 @@ static void reset_shadow_found(void *pUserVoid) { int i; - for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { + for (i = 0; i < last_scanned_cnt; i++) astrLastScannedNtwrksShadow[i].u8Found = 0; - - } } static void update_scan_time(void *pUserVoid) { int i; - for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { + for (i = 0; i < last_scanned_cnt; i++) astrLastScannedNtwrksShadow[i].u32TimeRcvdInScan = jiffies; - } } static void remove_network_from_shadow(unsigned long arg) @@ -305,7 +302,7 @@ static void remove_network_from_shadow(unsigned long arg) int i, j; - for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { + for (i = 0; i < last_scanned_cnt; i++) { if (time_after(now, astrLastScannedNtwrksShadow[i].u32TimeRcvdInScan + (unsigned long)(SCAN_RESULT_EXPIRE))) { PRINT_D(CFG80211_DBG, "Network expired in ScanShadow: %s\n", astrLastScannedNtwrksShadow[i].au8ssid); @@ -314,15 +311,16 @@ static void remove_network_from_shadow(unsigned long arg) wilc_free_join_params(astrLastScannedNtwrksShadow[i].pJoinParams); - for (j = i; (j < u32LastScannedNtwrksCountShadow - 1); j++) { + for (j = i; (j < last_scanned_cnt - 1); j++) astrLastScannedNtwrksShadow[j] = astrLastScannedNtwrksShadow[j + 1]; - } - u32LastScannedNtwrksCountShadow--; + + last_scanned_cnt--; } } - PRINT_D(CFG80211_DBG, "Number of cached networks: %d\n", u32LastScannedNtwrksCountShadow); - if (u32LastScannedNtwrksCountShadow != 0) { + PRINT_D(CFG80211_DBG, "Number of cached networks: %d\n", + last_scanned_cnt); + if (last_scanned_cnt != 0) { hAgingTimer.data = arg; mod_timer(&hAgingTimer, jiffies + msecs_to_jiffies(AGING_TIME)); } else { @@ -341,14 +339,14 @@ static int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoi int state = -1; int i; - if (u32LastScannedNtwrksCountShadow == 0) { + if (last_scanned_cnt == 0) { PRINT_D(CFG80211_DBG, "Starting Aging timer\n"); hAgingTimer.data = (unsigned long)pUserVoid; mod_timer(&hAgingTimer, jiffies + msecs_to_jiffies(AGING_TIME)); state = -1; } else { /* Linear search for now */ - for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { + for (i = 0; i < last_scanned_cnt; i++) { if (memcmp(astrLastScannedNtwrksShadow[i].au8bssid, pstrNetworkInfo->au8bssid, 6) == 0) { state = i; @@ -365,13 +363,13 @@ static void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserV u32 ap_index = 0; u8 rssi_index = 0; - if (u32LastScannedNtwrksCountShadow >= MAX_NUM_SCANNED_NETWORKS_SHADOW) { + if (last_scanned_cnt >= MAX_NUM_SCANNED_NETWORKS_SHADOW) { PRINT_D(CFG80211_DBG, "Shadow network reached its maximum limit\n"); return; } if (ap_found == -1) { - ap_index = u32LastScannedNtwrksCountShadow; - u32LastScannedNtwrksCountShadow++; + ap_index = last_scanned_cnt; + last_scanned_cnt++; } else { ap_index = ap_found; @@ -619,7 +617,7 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, memcpy(priv->au8AssociatedBss, pstrConnectInfo->au8bssid, ETH_ALEN); - for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { + for (i = 0; i < last_scanned_cnt; i++) { if (memcmp(astrLastScannedNtwrksShadow[i].au8bssid, pstrConnectInfo->au8bssid, ETH_ALEN) == 0) { unsigned long now = jiffies; @@ -850,7 +848,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, } PRINT_INFO(CFG80211_DBG, "Required SSID = %s\n , AuthType = %d\n", sme->ssid, sme->auth_type); - for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { + for (i = 0; i < last_scanned_cnt; i++) { if ((sme->ssid_len == astrLastScannedNtwrksShadow[i].u8SsidLen) && memcmp(astrLastScannedNtwrksShadow[i].au8ssid, sme->ssid, @@ -874,7 +872,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, } } - if (i < u32LastScannedNtwrksCountShadow) { + if (i < last_scanned_cnt) { PRINT_D(CFG80211_DBG, "Required bss is in scan results\n"); pstrNetworkInfo = &(astrLastScannedNtwrksShadow[i]); @@ -885,7 +883,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, pstrNetworkInfo->au8bssid[4], pstrNetworkInfo->au8bssid[5]); } else { s32Error = -ENOENT; - if (u32LastScannedNtwrksCountShadow == 0) + if (last_scanned_cnt == 0) PRINT_D(CFG80211_DBG, "No Scan results yet\n"); else PRINT_D(CFG80211_DBG, "Required bss not in scan results: Error(%d)\n", s32Error); From f1ab117db845a6cd63c75c1b9a8be3b9589b0c1b Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:11 +0900 Subject: [PATCH 569/843] staging: wilc1000: rename astrLastScannedNtwrksShadow variable This patch renames astrLastScannedNtwrksShadow variable to last_scanned_shadow to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 122 ++++++++---------- 1 file changed, 57 insertions(+), 65 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 97848e400288..32cc7349c453 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -106,7 +106,7 @@ static const struct ieee80211_txrx_stypes extern int wilc_mac_open(struct net_device *ndev); extern int wilc_mac_close(struct net_device *ndev); -static tstrNetworkInfo astrLastScannedNtwrksShadow[MAX_NUM_SCANNED_NETWORKS_SHADOW]; +static tstrNetworkInfo last_scanned_shadow[MAX_NUM_SCANNED_NETWORKS_SHADOW]; static u32 last_scanned_cnt; struct timer_list wilc_during_ip_timer; static struct timer_list hAgingTimer; @@ -214,13 +214,13 @@ static void clear_shadow_scan(void *pUserVoid) PRINT_INFO(CORECONFIG_DBG, "destroy aging timer\n"); for (i = 0; i < last_scanned_cnt; i++) { - if (astrLastScannedNtwrksShadow[last_scanned_cnt].pu8IEs != NULL) { - kfree(astrLastScannedNtwrksShadow[i].pu8IEs); - astrLastScannedNtwrksShadow[last_scanned_cnt].pu8IEs = NULL; + if (last_scanned_shadow[last_scanned_cnt].pu8IEs) { + kfree(last_scanned_shadow[i].pu8IEs); + last_scanned_shadow[last_scanned_cnt].pu8IEs = NULL; } - wilc_free_join_params(astrLastScannedNtwrksShadow[i].pJoinParams); - astrLastScannedNtwrksShadow[i].pJoinParams = NULL; + wilc_free_join_params(last_scanned_shadow[i].pJoinParams); + last_scanned_shadow[i].pJoinParams = NULL; } last_scanned_cnt = 0; } @@ -254,8 +254,7 @@ static void refresh_scan(void *pUserVoid, u8 all, bool bDirectScan) for (i = 0; i < last_scanned_cnt; i++) { tstrNetworkInfo *pstrNetworkInfo; - pstrNetworkInfo = &(astrLastScannedNtwrksShadow[i]); - + pstrNetworkInfo = &last_scanned_shadow[i]; if ((!pstrNetworkInfo->u8Found) || all) { s32 s32Freq; @@ -285,7 +284,7 @@ static void reset_shadow_found(void *pUserVoid) int i; for (i = 0; i < last_scanned_cnt; i++) - astrLastScannedNtwrksShadow[i].u8Found = 0; + last_scanned_shadow[i].u8Found = 0; } static void update_scan_time(void *pUserVoid) @@ -293,7 +292,7 @@ static void update_scan_time(void *pUserVoid) int i; for (i = 0; i < last_scanned_cnt; i++) - astrLastScannedNtwrksShadow[i].u32TimeRcvdInScan = jiffies; + last_scanned_shadow[i].u32TimeRcvdInScan = jiffies; } static void remove_network_from_shadow(unsigned long arg) @@ -303,16 +302,16 @@ static void remove_network_from_shadow(unsigned long arg) for (i = 0; i < last_scanned_cnt; i++) { - if (time_after(now, astrLastScannedNtwrksShadow[i].u32TimeRcvdInScan + (unsigned long)(SCAN_RESULT_EXPIRE))) { - PRINT_D(CFG80211_DBG, "Network expired in ScanShadow: %s\n", astrLastScannedNtwrksShadow[i].au8ssid); + if (time_after(now, last_scanned_shadow[i].u32TimeRcvdInScan + (unsigned long)(SCAN_RESULT_EXPIRE))) { + PRINT_D(CFG80211_DBG, "Network expired in ScanShadow: %s\n", last_scanned_shadow[i].au8ssid); - kfree(astrLastScannedNtwrksShadow[i].pu8IEs); - astrLastScannedNtwrksShadow[i].pu8IEs = NULL; + kfree(last_scanned_shadow[i].pu8IEs); + last_scanned_shadow[i].pu8IEs = NULL; - wilc_free_join_params(astrLastScannedNtwrksShadow[i].pJoinParams); + wilc_free_join_params(last_scanned_shadow[i].pJoinParams); for (j = i; (j < last_scanned_cnt - 1); j++) - astrLastScannedNtwrksShadow[j] = astrLastScannedNtwrksShadow[j + 1]; + last_scanned_shadow[j] = last_scanned_shadow[j + 1]; last_scanned_cnt--; } @@ -347,8 +346,8 @@ static int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoi } else { /* Linear search for now */ for (i = 0; i < last_scanned_cnt; i++) { - if (memcmp(astrLastScannedNtwrksShadow[i].au8bssid, - pstrNetworkInfo->au8bssid, 6) == 0) { + if (memcmp(last_scanned_shadow[i].au8bssid, + pstrNetworkInfo->au8bssid, 6) == 0) { state = i; break; } @@ -374,44 +373,37 @@ static void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserV } else { ap_index = ap_found; } - rssi_index = astrLastScannedNtwrksShadow[ap_index].strRssi.u8Index; - astrLastScannedNtwrksShadow[ap_index].strRssi.as8RSSI[rssi_index++] = pstrNetworkInfo->s8rssi; + rssi_index = last_scanned_shadow[ap_index].strRssi.u8Index; + last_scanned_shadow[ap_index].strRssi.as8RSSI[rssi_index++] = pstrNetworkInfo->s8rssi; if (rssi_index == NUM_RSSI) { rssi_index = 0; - astrLastScannedNtwrksShadow[ap_index].strRssi.u8Full = 1; + last_scanned_shadow[ap_index].strRssi.u8Full = 1; } - astrLastScannedNtwrksShadow[ap_index].strRssi.u8Index = rssi_index; - - astrLastScannedNtwrksShadow[ap_index].s8rssi = pstrNetworkInfo->s8rssi; - astrLastScannedNtwrksShadow[ap_index].u16CapInfo = pstrNetworkInfo->u16CapInfo; - - astrLastScannedNtwrksShadow[ap_index].u8SsidLen = pstrNetworkInfo->u8SsidLen; - memcpy(astrLastScannedNtwrksShadow[ap_index].au8ssid, - pstrNetworkInfo->au8ssid, pstrNetworkInfo->u8SsidLen); - - memcpy(astrLastScannedNtwrksShadow[ap_index].au8bssid, - pstrNetworkInfo->au8bssid, ETH_ALEN); - - astrLastScannedNtwrksShadow[ap_index].u16BeaconPeriod = pstrNetworkInfo->u16BeaconPeriod; - astrLastScannedNtwrksShadow[ap_index].u8DtimPeriod = pstrNetworkInfo->u8DtimPeriod; - astrLastScannedNtwrksShadow[ap_index].u8channel = pstrNetworkInfo->u8channel; - - astrLastScannedNtwrksShadow[ap_index].u16IEsLen = pstrNetworkInfo->u16IEsLen; - astrLastScannedNtwrksShadow[ap_index].u64Tsf = pstrNetworkInfo->u64Tsf; + last_scanned_shadow[ap_index].strRssi.u8Index = rssi_index; + last_scanned_shadow[ap_index].s8rssi = pstrNetworkInfo->s8rssi; + last_scanned_shadow[ap_index].u16CapInfo = pstrNetworkInfo->u16CapInfo; + last_scanned_shadow[ap_index].u8SsidLen = pstrNetworkInfo->u8SsidLen; + memcpy(last_scanned_shadow[ap_index].au8ssid, + pstrNetworkInfo->au8ssid, pstrNetworkInfo->u8SsidLen); + memcpy(last_scanned_shadow[ap_index].au8bssid, + pstrNetworkInfo->au8bssid, ETH_ALEN); + last_scanned_shadow[ap_index].u16BeaconPeriod = pstrNetworkInfo->u16BeaconPeriod; + last_scanned_shadow[ap_index].u8DtimPeriod = pstrNetworkInfo->u8DtimPeriod; + last_scanned_shadow[ap_index].u8channel = pstrNetworkInfo->u8channel; + last_scanned_shadow[ap_index].u16IEsLen = pstrNetworkInfo->u16IEsLen; + last_scanned_shadow[ap_index].u64Tsf = pstrNetworkInfo->u64Tsf; if (ap_found != -1) - kfree(astrLastScannedNtwrksShadow[ap_index].pu8IEs); - astrLastScannedNtwrksShadow[ap_index].pu8IEs = + kfree(last_scanned_shadow[ap_index].pu8IEs); + last_scanned_shadow[ap_index].pu8IEs = kmalloc(pstrNetworkInfo->u16IEsLen, GFP_KERNEL); /* will be deallocated by the WILC_WFI_CfgScan() function */ - memcpy(astrLastScannedNtwrksShadow[ap_index].pu8IEs, - pstrNetworkInfo->pu8IEs, pstrNetworkInfo->u16IEsLen); - - astrLastScannedNtwrksShadow[ap_index].u32TimeRcvdInScan = jiffies; - astrLastScannedNtwrksShadow[ap_index].u32TimeRcvdInScanCached = jiffies; - astrLastScannedNtwrksShadow[ap_index].u8Found = 1; + memcpy(last_scanned_shadow[ap_index].pu8IEs, + pstrNetworkInfo->pu8IEs, pstrNetworkInfo->u16IEsLen); + last_scanned_shadow[ap_index].u32TimeRcvdInScan = jiffies; + last_scanned_shadow[ap_index].u32TimeRcvdInScanCached = jiffies; + last_scanned_shadow[ap_index].u8Found = 1; if (ap_found != -1) - wilc_free_join_params(astrLastScannedNtwrksShadow[ap_index].pJoinParams); - astrLastScannedNtwrksShadow[ap_index].pJoinParams = pJoinParams; - + wilc_free_join_params(last_scanned_shadow[ap_index].pJoinParams); + last_scanned_shadow[ap_index].pJoinParams = pJoinParams; } @@ -497,11 +489,11 @@ static void CfgScanResult(enum scan_event enuScanEvent, tstrNetworkInfo *pstrNet u32 i; /* So this network is discovered before, we'll just update its RSSI */ for (i = 0; i < priv->u32RcvdChCount; i++) { - if (memcmp(astrLastScannedNtwrksShadow[i].au8bssid, pstrNetworkInfo->au8bssid, 6) == 0) { - PRINT_D(CFG80211_DBG, "Update RSSI of %s\n", astrLastScannedNtwrksShadow[i].au8ssid); + if (memcmp(last_scanned_shadow[i].au8bssid, pstrNetworkInfo->au8bssid, 6) == 0) { + PRINT_D(CFG80211_DBG, "Update RSSI of %s\n", last_scanned_shadow[i].au8ssid); - astrLastScannedNtwrksShadow[i].s8rssi = pstrNetworkInfo->s8rssi; - astrLastScannedNtwrksShadow[i].u32TimeRcvdInScan = jiffies; + last_scanned_shadow[i].s8rssi = pstrNetworkInfo->s8rssi; + last_scanned_shadow[i].u32TimeRcvdInScan = jiffies; break; } } @@ -618,12 +610,12 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, for (i = 0; i < last_scanned_cnt; i++) { - if (memcmp(astrLastScannedNtwrksShadow[i].au8bssid, - pstrConnectInfo->au8bssid, ETH_ALEN) == 0) { + if (memcmp(last_scanned_shadow[i].au8bssid, + pstrConnectInfo->au8bssid, ETH_ALEN) == 0) { unsigned long now = jiffies; if (time_after(now, - astrLastScannedNtwrksShadow[i].u32TimeRcvdInScanCached + (unsigned long)(nl80211_SCAN_RESULT_EXPIRE - (1 * HZ)))) { + last_scanned_shadow[i].u32TimeRcvdInScanCached + (unsigned long)(nl80211_SCAN_RESULT_EXPIRE - (1 * HZ)))) { bNeedScanRefresh = true; } @@ -849,10 +841,10 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, PRINT_INFO(CFG80211_DBG, "Required SSID = %s\n , AuthType = %d\n", sme->ssid, sme->auth_type); for (i = 0; i < last_scanned_cnt; i++) { - if ((sme->ssid_len == astrLastScannedNtwrksShadow[i].u8SsidLen) && - memcmp(astrLastScannedNtwrksShadow[i].au8ssid, - sme->ssid, - sme->ssid_len) == 0) { + if ((sme->ssid_len == last_scanned_shadow[i].u8SsidLen) && + memcmp(last_scanned_shadow[i].au8ssid, + sme->ssid, + sme->ssid_len) == 0) { PRINT_INFO(CFG80211_DBG, "Network with required SSID is found %s\n", sme->ssid); if (sme->bssid == NULL) { /* BSSID is not passed from the user, so decision of matching @@ -862,9 +854,9 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, } else { /* BSSID is also passed from the user, so decision of matching * should consider also this passed BSSID */ - if (memcmp(astrLastScannedNtwrksShadow[i].au8bssid, - sme->bssid, - ETH_ALEN) == 0) { + if (memcmp(last_scanned_shadow[i].au8bssid, + sme->bssid, + ETH_ALEN) == 0) { PRINT_INFO(CFG80211_DBG, "BSSID is passed from the user and matched\n"); break; } @@ -875,7 +867,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, if (i < last_scanned_cnt) { PRINT_D(CFG80211_DBG, "Required bss is in scan results\n"); - pstrNetworkInfo = &(astrLastScannedNtwrksShadow[i]); + pstrNetworkInfo = &last_scanned_shadow[i]; PRINT_INFO(CFG80211_DBG, "network BSSID to be associated: %x%x%x%x%x%x\n", pstrNetworkInfo->au8bssid[0], pstrNetworkInfo->au8bssid[1], From 2736f476aed92e96109c16a4cfba92ce2289e095 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:12 +0900 Subject: [PATCH 570/843] staging: wilc1000: rename WILC_WFI_2ghz_channels variable This patch renames WILC_WFI_2ghz_channels variable to ieee80211_2ghz_channels to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 32cc7349c453..349b720fe57b 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -124,7 +124,7 @@ u8 wilc_initialized = 1; } /*Frequency range for channels*/ -static struct ieee80211_channel WILC_WFI_2ghz_channels[] = { +static struct ieee80211_channel ieee80211_2ghz_channels[] = { CHAN2G(1, 2412, 0), CHAN2G(2, 2417, 0), CHAN2G(3, 2422, 0), @@ -181,8 +181,8 @@ static u8 u8P2P_vendorspec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03}; static bool bWilc_ie; static struct ieee80211_supported_band WILC_WFI_band_2ghz = { - .channels = WILC_WFI_2ghz_channels, - .n_channels = ARRAY_SIZE(WILC_WFI_2ghz_channels), + .channels = ieee80211_2ghz_channels, + .n_channels = ARRAY_SIZE(ieee80211_2ghz_channels), .bitrates = WILC_WFI_rates, .n_bitrates = ARRAY_SIZE(WILC_WFI_rates), }; From 8d48b5bab62f1e9eaafa12467874cab4a1bfb1bc Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:13 +0900 Subject: [PATCH 571/843] staging: wilc1000: rename WILC_WFI_rates variable This patch renames WILC_WFI_rates variable to ieee80211_bitrates to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 349b720fe57b..c2e7bf89d0ca 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -149,7 +149,7 @@ static struct ieee80211_channel ieee80211_2ghz_channels[] = { /* Table 6 in section 3.2.1.1 */ -static struct ieee80211_rate WILC_WFI_rates[] = { +static struct ieee80211_rate ieee80211_bitrates[] = { RATETAB_ENT(10, 0, 0), RATETAB_ENT(20, 1, 0), RATETAB_ENT(55, 2, 0), @@ -183,8 +183,8 @@ static bool bWilc_ie; static struct ieee80211_supported_band WILC_WFI_band_2ghz = { .channels = ieee80211_2ghz_channels, .n_channels = ARRAY_SIZE(ieee80211_2ghz_channels), - .bitrates = WILC_WFI_rates, - .n_bitrates = ARRAY_SIZE(WILC_WFI_rates), + .bitrates = ieee80211_bitrates, + .n_bitrates = ARRAY_SIZE(ieee80211_bitrates), }; From 0bd8274fb8a8155bef0289a0eb669611cce9eb3e Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:14 +0900 Subject: [PATCH 572/843] staging: wilc1000: rename u8WLANChannel variable This patch renames u8WLANChannel variable to wlan_channel to avoid camelcase. And, remove the relation comment. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 29 +++++++------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index c2e7bf89d0ca..3b072ef27e68 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -169,9 +169,7 @@ struct p2p_mgmt_data { u8 *buff; }; -/*Global variable used to state the current connected STA channel*/ -static u8 u8WLANChannel = INVALID_CHANNEL; - +static u8 wlan_channel = INVALID_CHANNEL; static u8 curr_channel; static u8 u8P2P_oui[] = {0x50, 0x6f, 0x9A, 0x09}; @@ -593,9 +591,8 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, wilc_wlan_set_bssid(priv->dev, NullBssid); eth_zero_addr(wilc_connected_SSID); - /*Invalidate u8WLANChannel value on wlan0 disconnect*/ if (!pstrWFIDrv->p2p_connect) - u8WLANChannel = INVALID_CHANNEL; + wlan_channel = INVALID_CHANNEL; PRINT_ER("Unspecified failure: Connection status %d : MAC status = %d\n", u16ConnectStatus, u8MacStatus); } @@ -652,9 +649,8 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, wilc_wlan_set_bssid(priv->dev, NullBssid); eth_zero_addr(wilc_connected_SSID); - /*Invalidate u8WLANChannel value on wlan0 disconnect*/ if (!pstrWFIDrv->p2p_connect) - u8WLANChannel = INVALID_CHANNEL; + wlan_channel = INVALID_CHANNEL; /*Incase "P2P CLIENT Connected" send deauthentication reason by 3 to force the WPA_SUPPLICANT to directly change * virtual interface to station*/ if ((pstrWFIDrv->IFC_UP) && (dev == wl->vif[1].ndev)) { @@ -1029,7 +1025,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, curr_channel = pstrNetworkInfo->u8channel; if (!pstrWFIDrv->p2p_connect) - u8WLANChannel = pstrNetworkInfo->u8channel; + wlan_channel = pstrNetworkInfo->u8channel; wilc_wlan_set_bssid(dev, pstrNetworkInfo->au8bssid); @@ -1069,10 +1065,9 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co wilc_connecting = 0; priv = wiphy_priv(wiphy); - /*Invalidate u8WLANChannel value on wlan0 disconnect*/ pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv; if (!pstrWFIDrv->p2p_connect) - u8WLANChannel = INVALID_CHANNEL; + wlan_channel = INVALID_CHANNEL; wilc_wlan_set_bssid(priv->dev, NullBssid); PRINT_D(CFG80211_DBG, "Disconnecting with reason code(%d)\n", reason_code); @@ -1855,15 +1850,14 @@ static void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len) op_channel_attr_index = index; index += buf[index + 1] + 3; /* ID,Length byte */ } - if (u8WLANChannel != INVALID_CHANNEL) { - + if (wlan_channel != INVALID_CHANNEL) { /*Modify channel list attribute*/ if (channel_list_attr_index) { PRINT_D(GENERIC_DBG, "Modify channel list attribute\n"); for (i = channel_list_attr_index + 3; i < ((channel_list_attr_index + 3) + buf[channel_list_attr_index + 1]); i++) { if (buf[i] == 0x51) { for (j = i + 2; j < ((i + 2) + buf[i + 1]); j++) { - buf[j] = u8WLANChannel; + buf[j] = wlan_channel; } break; } @@ -1873,7 +1867,7 @@ static void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len) if (op_channel_attr_index) { PRINT_D(GENERIC_DBG, "Modify operating channel attribute\n"); buf[op_channel_attr_index + 6] = 0x51; - buf[op_channel_attr_index + 7] = u8WLANChannel; + buf[op_channel_attr_index + 7] = wlan_channel; } } } @@ -1909,15 +1903,14 @@ static void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftyp op_channel_attr_index = index; index += buf[index + 1] + 3; /* ID,Length byte */ } - if (u8WLANChannel != INVALID_CHANNEL && bOperChan) { - + if (wlan_channel != INVALID_CHANNEL && bOperChan) { /*Modify channel list attribute*/ if (channel_list_attr_index) { PRINT_D(GENERIC_DBG, "Modify channel list attribute\n"); for (i = channel_list_attr_index + 3; i < ((channel_list_attr_index + 3) + buf[channel_list_attr_index + 1]); i++) { if (buf[i] == 0x51) { for (j = i + 2; j < ((i + 2) + buf[i + 1]); j++) { - buf[j] = u8WLANChannel; + buf[j] = wlan_channel; } break; } @@ -1927,7 +1920,7 @@ static void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftyp if (op_channel_attr_index) { PRINT_D(GENERIC_DBG, "Modify operating channel attribute\n"); buf[op_channel_attr_index + 6] = 0x51; - buf[op_channel_attr_index + 7] = u8WLANChannel; + buf[op_channel_attr_index + 7] = wlan_channel; } } } From 881eb5d812ec76e69b37e644e77b3a16b83d52fd Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:15 +0900 Subject: [PATCH 573/843] staging: wilc1000: rename u8P2P_oui variable This patch renames u8P2P_oui variable to p2p_oui to avoid camelcase. And, remove the relation comment. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 3b072ef27e68..6ab4a79e70e0 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -171,8 +171,7 @@ struct p2p_mgmt_data { static u8 wlan_channel = INVALID_CHANNEL; static u8 curr_channel; - -static u8 u8P2P_oui[] = {0x50, 0x6f, 0x9A, 0x09}; +static u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09}; static u8 u8P2Plocalrandom = 0x01; static u8 u8P2Precvrandom = 0x00; static u8 u8P2P_vendorspec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03}; @@ -1997,9 +1996,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size) break; case PUBLIC_ACT_VENDORSPEC: - /*Now we have a public action vendor specific action frame, check if its a p2p public action frame - * based on the standard its should have the p2p_oui attribute with the following values 50 6f 9A 09*/ - if (!memcmp(u8P2P_oui, &buff[ACTION_SUBTYPE_ID + 1], 4)) { + if (!memcmp(p2p_oui, &buff[ACTION_SUBTYPE_ID + 1], 4)) { if ((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP)) { if (!bWilc_ie) { for (i = P2P_PUB_ACTION_SUBTYPE; i < size; i++) { @@ -2016,7 +2013,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size) if ((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP || buff[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_RSP)) { for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < size; i++) { - if (buff[i] == P2PELEM_ATTR_ID && !(memcmp(u8P2P_oui, &buff[i + 2], 4))) { + if (buff[i] == P2PELEM_ATTR_ID && !(memcmp(p2p_oui, &buff[i + 2], 4))) { WILC_WFI_CfgParseRxAction(&buff[i + 6], size - (i + 6)); break; } @@ -2292,9 +2289,7 @@ static int mgmt_tx(struct wiphy *wiphy, case PUBLIC_ACT_VENDORSPEC: { - /*Now we have a public action vendor specific action frame, check if its a p2p public action frame - * based on the standard its should have the p2p_oui attribute with the following values 50 6f 9A 09*/ - if (!memcmp(u8P2P_oui, &buf[ACTION_SUBTYPE_ID + 1], 4)) { + if (!memcmp(p2p_oui, &buf[ACTION_SUBTYPE_ID + 1], 4)) { /*For the connection of two WILC's connection generate a rand number to determine who will be a GO*/ if ((buf[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP)) { if (u8P2Plocalrandom == 1 && u8P2Precvrandom < u8P2Plocalrandom) { @@ -2311,7 +2306,7 @@ static int mgmt_tx(struct wiphy *wiphy, /*Search for the p2p information information element , after the Public action subtype theres a byte for teh dialog token, skip that*/ for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < len; i++) { - if (buf[i] == P2PELEM_ATTR_ID && !(memcmp(u8P2P_oui, &buf[i + 2], 4))) { + if (buf[i] == P2PELEM_ATTR_ID && !(memcmp(p2p_oui, &buf[i + 2], 4))) { if (buf[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_RSP) WILC_WFI_CfgParseTxAction(&mgmt_tx->buff[i + 6], len - (i + 6), true, nic->iftype); From 583d972cf7bbb1714c4ad26819d5ead12bfb69d7 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:16 +0900 Subject: [PATCH 574/843] staging: wilc1000: rename u8P2Plocalrandom variable This patch renames u8P2Plocalrandom variable to p2p_local_random to avoid camelcase. And, remove the relation comment. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 6ab4a79e70e0..dd8d4040622b 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -172,7 +172,7 @@ struct p2p_mgmt_data { static u8 wlan_channel = INVALID_CHANNEL; static u8 curr_channel; static u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09}; -static u8 u8P2Plocalrandom = 0x01; +static u8 p2p_local_random = 0x01; static u8 u8P2Precvrandom = 0x00; static u8 u8P2P_vendorspec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03}; static bool bWilc_ie; @@ -641,7 +641,7 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, wilc_optaining_ip = false; PRINT_ER("Received MAC_DISCONNECTED from firmware with reason %d on dev [%p]\n", pstrDisconnectNotifInfo->u16reason, priv->dev); - u8P2Plocalrandom = 0x01; + p2p_local_random = 0x01; u8P2Precvrandom = 0x00; bWilc_ie = false; eth_zero_addr(priv->au8AssociatedBss); @@ -1071,7 +1071,7 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co PRINT_D(CFG80211_DBG, "Disconnecting with reason code(%d)\n", reason_code); - u8P2Plocalrandom = 0x01; + p2p_local_random = 0x01; u8P2Precvrandom = 0x00; bWilc_ie = false; pstrWFIDrv->p2p_timeout = 0; @@ -2009,7 +2009,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size) } } } - if (u8P2Plocalrandom > u8P2Precvrandom) { + if (p2p_local_random > u8P2Precvrandom) { if ((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP || buff[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_RSP)) { for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < size; i++) { @@ -2019,8 +2019,9 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size) } } } - } else - PRINT_D(GENERIC_DBG, "PEER WILL BE GO LocaRand=%02x RecvRand %02x\n", u8P2Plocalrandom, u8P2Precvrandom); + } else { + PRINT_D(GENERIC_DBG, "PEER WILL BE GO LocaRand=%02x RecvRand %02x\n", p2p_local_random, u8P2Precvrandom); + } } @@ -2224,7 +2225,7 @@ static int mgmt_tx(struct wiphy *wiphy, struct host_if_drv *pstrWFIDrv; u32 i; perInterface_wlan_t *nic; - u32 buf_len = len + sizeof(u8P2P_vendorspec) + sizeof(u8P2Plocalrandom); + u32 buf_len = len + sizeof(u8P2P_vendorspec) + sizeof(p2p_local_random); nic = netdev_priv(wdev->netdev); priv = wiphy_priv(wiphy); @@ -2292,17 +2293,16 @@ static int mgmt_tx(struct wiphy *wiphy, if (!memcmp(p2p_oui, &buf[ACTION_SUBTYPE_ID + 1], 4)) { /*For the connection of two WILC's connection generate a rand number to determine who will be a GO*/ if ((buf[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP)) { - if (u8P2Plocalrandom == 1 && u8P2Precvrandom < u8P2Plocalrandom) { - get_random_bytes(&u8P2Plocalrandom, 1); - /*Increment the number to prevent if its 0*/ - u8P2Plocalrandom++; + if (p2p_local_random == 1 && u8P2Precvrandom < p2p_local_random) { + get_random_bytes(&p2p_local_random, 1); + p2p_local_random++; } } if ((buf[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP || buf[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_RSP)) { - if (u8P2Plocalrandom > u8P2Precvrandom) { - PRINT_D(GENERIC_DBG, "LOCAL WILL BE GO LocaRand=%02x RecvRand %02x\n", u8P2Plocalrandom, u8P2Precvrandom); + if (p2p_local_random > u8P2Precvrandom) { + PRINT_D(GENERIC_DBG, "LOCAL WILL BE GO LocaRand=%02x RecvRand %02x\n", p2p_local_random, u8P2Precvrandom); /*Search for the p2p information information element , after the Public action subtype theres a byte for teh dialog token, skip that*/ for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < len; i++) { @@ -2324,11 +2324,12 @@ static int mgmt_tx(struct wiphy *wiphy, * identify each other and connect */ memcpy(&mgmt_tx->buff[len], u8P2P_vendorspec, sizeof(u8P2P_vendorspec)); - mgmt_tx->buff[len + sizeof(u8P2P_vendorspec)] = u8P2Plocalrandom; + mgmt_tx->buff[len + sizeof(u8P2P_vendorspec)] = p2p_local_random; mgmt_tx->size = buf_len; } - } else - PRINT_D(GENERIC_DBG, "PEER WILL BE GO LocaRand=%02x RecvRand %02x\n", u8P2Plocalrandom, u8P2Precvrandom); + } else { + PRINT_D(GENERIC_DBG, "PEER WILL BE GO LocaRand=%02x RecvRand %02x\n", p2p_local_random, u8P2Precvrandom); + } } } else { @@ -2557,7 +2558,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, PRINT_D(HOSTAPD_DBG, "In Change virtual interface function\n"); PRINT_D(HOSTAPD_DBG, "Wireless interface name =%s\n", dev->name); - u8P2Plocalrandom = 0x01; + p2p_local_random = 0x01; u8P2Precvrandom = 0x00; bWilc_ie = false; From b84a3ac4276033baeae12bcfcdc8c970747d0f78 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:17 +0900 Subject: [PATCH 575/843] staging: wilc1000: rename u8P2Precvrandom variable This patch renames u8P2Precvrandom variable to p2p_recv_random to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index dd8d4040622b..904b21485f05 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -173,7 +173,7 @@ static u8 wlan_channel = INVALID_CHANNEL; static u8 curr_channel; static u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09}; static u8 p2p_local_random = 0x01; -static u8 u8P2Precvrandom = 0x00; +static u8 p2p_recv_random = 0x00; static u8 u8P2P_vendorspec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03}; static bool bWilc_ie; @@ -642,7 +642,7 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, PRINT_ER("Received MAC_DISCONNECTED from firmware with reason %d on dev [%p]\n", pstrDisconnectNotifInfo->u16reason, priv->dev); p2p_local_random = 0x01; - u8P2Precvrandom = 0x00; + p2p_recv_random = 0x00; bWilc_ie = false; eth_zero_addr(priv->au8AssociatedBss); wilc_wlan_set_bssid(priv->dev, NullBssid); @@ -1072,7 +1072,7 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co PRINT_D(CFG80211_DBG, "Disconnecting with reason code(%d)\n", reason_code); p2p_local_random = 0x01; - u8P2Precvrandom = 0x00; + p2p_recv_random = 0x00; bWilc_ie = false; pstrWFIDrv->p2p_timeout = 0; @@ -2001,15 +2001,15 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size) if (!bWilc_ie) { for (i = P2P_PUB_ACTION_SUBTYPE; i < size; i++) { if (!memcmp(u8P2P_vendorspec, &buff[i], 6)) { - u8P2Precvrandom = buff[i + 6]; + p2p_recv_random = buff[i + 6]; bWilc_ie = true; - PRINT_D(GENERIC_DBG, "WILC Vendor specific IE:%02x\n", u8P2Precvrandom); + PRINT_D(GENERIC_DBG, "WILC Vendor specific IE:%02x\n", p2p_recv_random); break; } } } } - if (p2p_local_random > u8P2Precvrandom) { + if (p2p_local_random > p2p_recv_random) { if ((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP || buff[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_RSP)) { for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < size; i++) { @@ -2020,7 +2020,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size) } } } else { - PRINT_D(GENERIC_DBG, "PEER WILL BE GO LocaRand=%02x RecvRand %02x\n", p2p_local_random, u8P2Precvrandom); + PRINT_D(GENERIC_DBG, "PEER WILL BE GO LocaRand=%02x RecvRand %02x\n", p2p_local_random, p2p_recv_random); } } @@ -2293,7 +2293,7 @@ static int mgmt_tx(struct wiphy *wiphy, if (!memcmp(p2p_oui, &buf[ACTION_SUBTYPE_ID + 1], 4)) { /*For the connection of two WILC's connection generate a rand number to determine who will be a GO*/ if ((buf[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP)) { - if (p2p_local_random == 1 && u8P2Precvrandom < p2p_local_random) { + if (p2p_local_random == 1 && p2p_recv_random < p2p_local_random) { get_random_bytes(&p2p_local_random, 1); p2p_local_random++; } @@ -2301,8 +2301,8 @@ static int mgmt_tx(struct wiphy *wiphy, if ((buf[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP || buf[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_RSP)) { - if (p2p_local_random > u8P2Precvrandom) { - PRINT_D(GENERIC_DBG, "LOCAL WILL BE GO LocaRand=%02x RecvRand %02x\n", p2p_local_random, u8P2Precvrandom); + if (p2p_local_random > p2p_recv_random) { + PRINT_D(GENERIC_DBG, "LOCAL WILL BE GO LocaRand=%02x RecvRand %02x\n", p2p_local_random, p2p_recv_random); /*Search for the p2p information information element , after the Public action subtype theres a byte for teh dialog token, skip that*/ for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < len; i++) { @@ -2328,7 +2328,7 @@ static int mgmt_tx(struct wiphy *wiphy, mgmt_tx->size = buf_len; } } else { - PRINT_D(GENERIC_DBG, "PEER WILL BE GO LocaRand=%02x RecvRand %02x\n", p2p_local_random, u8P2Precvrandom); + PRINT_D(GENERIC_DBG, "PEER WILL BE GO LocaRand=%02x RecvRand %02x\n", p2p_local_random, p2p_recv_random); } } @@ -2559,7 +2559,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, PRINT_D(HOSTAPD_DBG, "In Change virtual interface function\n"); PRINT_D(HOSTAPD_DBG, "Wireless interface name =%s\n", dev->name); p2p_local_random = 0x01; - u8P2Precvrandom = 0x00; + p2p_recv_random = 0x00; bWilc_ie = false; From 8668594a96516fad01e3336a6b13072a51ed188b Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:18 +0900 Subject: [PATCH 576/843] staging: wilc1000: rename u8P2P_vendorspec variable This patch renames u8P2P_vendorspec variable to p2p_vendor_spec to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 904b21485f05..0a7226c4c5c6 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -174,7 +174,7 @@ static u8 curr_channel; static u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09}; static u8 p2p_local_random = 0x01; static u8 p2p_recv_random = 0x00; -static u8 u8P2P_vendorspec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03}; +static u8 p2p_vendor_spec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03}; static bool bWilc_ie; static struct ieee80211_supported_band WILC_WFI_band_2ghz = { @@ -2000,7 +2000,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size) if ((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP)) { if (!bWilc_ie) { for (i = P2P_PUB_ACTION_SUBTYPE; i < size; i++) { - if (!memcmp(u8P2P_vendorspec, &buff[i], 6)) { + if (!memcmp(p2p_vendor_spec, &buff[i], 6)) { p2p_recv_random = buff[i + 6]; bWilc_ie = true; PRINT_D(GENERIC_DBG, "WILC Vendor specific IE:%02x\n", p2p_recv_random); @@ -2225,7 +2225,7 @@ static int mgmt_tx(struct wiphy *wiphy, struct host_if_drv *pstrWFIDrv; u32 i; perInterface_wlan_t *nic; - u32 buf_len = len + sizeof(u8P2P_vendorspec) + sizeof(p2p_local_random); + u32 buf_len = len + sizeof(p2p_vendor_spec) + sizeof(p2p_local_random); nic = netdev_priv(wdev->netdev); priv = wiphy_priv(wiphy); @@ -2323,8 +2323,8 @@ static int mgmt_tx(struct wiphy *wiphy, * Adding WILC information element to allow two WILC devices to * identify each other and connect */ - memcpy(&mgmt_tx->buff[len], u8P2P_vendorspec, sizeof(u8P2P_vendorspec)); - mgmt_tx->buff[len + sizeof(u8P2P_vendorspec)] = p2p_local_random; + memcpy(&mgmt_tx->buff[len], p2p_vendor_spec, sizeof(p2p_vendor_spec)); + mgmt_tx->buff[len + sizeof(p2p_vendor_spec)] = p2p_local_random; mgmt_tx->size = buf_len; } } else { From a25d51860c58e73e9cae1e458a927d4db2f8fcaa Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:19 +0900 Subject: [PATCH 577/843] staging: wilc1000: rename bWilc_ie variable This patch renames bWilc_ie variable to wilc_ie to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 0a7226c4c5c6..24e1e1516b76 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -175,7 +175,7 @@ static u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09}; static u8 p2p_local_random = 0x01; static u8 p2p_recv_random = 0x00; static u8 p2p_vendor_spec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03}; -static bool bWilc_ie; +static bool wilc_ie; static struct ieee80211_supported_band WILC_WFI_band_2ghz = { .channels = ieee80211_2ghz_channels, @@ -643,7 +643,7 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, pstrDisconnectNotifInfo->u16reason, priv->dev); p2p_local_random = 0x01; p2p_recv_random = 0x00; - bWilc_ie = false; + wilc_ie = false; eth_zero_addr(priv->au8AssociatedBss); wilc_wlan_set_bssid(priv->dev, NullBssid); eth_zero_addr(wilc_connected_SSID); @@ -1073,7 +1073,7 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co p2p_local_random = 0x01; p2p_recv_random = 0x00; - bWilc_ie = false; + wilc_ie = false; pstrWFIDrv->p2p_timeout = 0; s32Error = wilc_disconnect(priv->hWILCWFIDrv, reason_code); @@ -1998,11 +1998,11 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size) case PUBLIC_ACT_VENDORSPEC: if (!memcmp(p2p_oui, &buff[ACTION_SUBTYPE_ID + 1], 4)) { if ((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP)) { - if (!bWilc_ie) { + if (!wilc_ie) { for (i = P2P_PUB_ACTION_SUBTYPE; i < size; i++) { if (!memcmp(p2p_vendor_spec, &buff[i], 6)) { p2p_recv_random = buff[i + 6]; - bWilc_ie = true; + wilc_ie = true; PRINT_D(GENERIC_DBG, "WILC Vendor specific IE:%02x\n", p2p_recv_random); break; } @@ -2025,7 +2025,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size) } - if ((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP) && (bWilc_ie)) { + if ((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP) && (wilc_ie)) { PRINT_D(GENERIC_DBG, "Sending P2P to host without extra elemnt\n"); /* extra attribute for sig_dbm: signal strength in mBm, or 0 if unknown */ cfg80211_rx_mgmt(priv->wdev, s32Freq, 0, buff, size - 7, 0); @@ -2560,9 +2560,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, PRINT_D(HOSTAPD_DBG, "Wireless interface name =%s\n", dev->name); p2p_local_random = 0x01; p2p_recv_random = 0x00; - - bWilc_ie = false; - + wilc_ie = false; wilc_optaining_ip = false; del_timer(&wilc_during_ip_timer); PRINT_D(GENERIC_DBG, "Changing virtual interface, enable scan\n"); From 7e872df9cd627614f74ec343e11bb98aeb2f59e2 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:20 +0900 Subject: [PATCH 578/843] staging: wilc1000: rename duringIP_TIME variable This patch renames duringIP_TIME variable to during_ip_time to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 24e1e1516b76..c49b989c7ef3 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -200,7 +200,7 @@ static bool g_gtk_keys_saved; static bool g_wep_keys_saved; #define AGING_TIME (9 * 1000) -#define duringIP_TIME 15000 +#define during_ip_time 15000 static void clear_shadow_scan(void *pUserVoid) { @@ -2772,7 +2772,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, PRINT_D(GENERIC_DBG, "start duringIP timer\n"); wilc_optaining_ip = true; - mod_timer(&wilc_during_ip_timer, jiffies + msecs_to_jiffies(duringIP_TIME)); + mod_timer(&wilc_during_ip_timer, + jiffies + msecs_to_jiffies(during_ip_time)); wilc_set_power_mgmt(priv->hWILCWFIDrv, 0, 0); /*Delete block ack has to be the latest config packet*/ /*sent before downloading new FW. This is because it blocks on*/ From e554a305529598750eb71d65560554773450f081 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:21 +0900 Subject: [PATCH 579/843] staging: wilc1000: rename wilc_connected_SSID variable This patch renames wilc_connected_SSID variable to wilc_connected_ssid to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 22 +++++++++---------- drivers/staging/wilc1000/host_interface.h | 2 +- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index b1b4802fc56a..900b7ca2870f 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -987,7 +987,7 @@ static s32 Handle_ScanDone(struct host_if_drv *hif_drv, return result; } -u8 wilc_connected_SSID[6] = {0}; +u8 wilc_connected_ssid[6] = {0}; static s32 Handle_Connect(struct host_if_drv *hif_drv, struct connect_attr *pstrHostIFconnectAttr) { @@ -999,7 +999,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv, PRINT_D(GENERIC_DBG, "Handling connect request\n"); - if (memcmp(pstrHostIFconnectAttr->bssid, wilc_connected_SSID, ETH_ALEN) == 0) { + if (memcmp(pstrHostIFconnectAttr->bssid, wilc_connected_ssid, ETH_ALEN) == 0) { result = 0; PRINT_ER("Trying to connect to an already connected AP, Discard connect request\n"); return result; @@ -1212,10 +1212,11 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv, PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n"); if (pstrHostIFconnectAttr->bssid) { - memcpy(wilc_connected_SSID, pstrHostIFconnectAttr->bssid, ETH_ALEN); - - PRINT_D(GENERIC_DBG, "save Bssid = %pM\n", pstrHostIFconnectAttr->bssid); - PRINT_D(GENERIC_DBG, "save bssid = %pM\n", wilc_connected_SSID); + memcpy(wilc_connected_ssid, + pstrHostIFconnectAttr->bssid, ETH_ALEN); + PRINT_D(GENERIC_DBG, "save Bssid = %pM\n", + pstrHostIFconnectAttr->bssid); + PRINT_D(GENERIC_DBG, "save bssid = %pM\n", wilc_connected_ssid); } result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, strWIDList, @@ -1389,7 +1390,7 @@ static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv) hif_drv->usr_conn_req.ies_len = 0; kfree(hif_drv->usr_conn_req.ies); - eth_zero_addr(wilc_connected_SSID); + eth_zero_addr(wilc_connected_ssid); if (join_req && join_req_drv == hif_drv) { kfree(join_req); @@ -1585,11 +1586,10 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, if ((u8MacStatus == MAC_CONNECTED) && (strConnectInfo.u16ConnectStatus != SUCCESSFUL_STATUSCODE)) { PRINT_ER("Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n"); - eth_zero_addr(wilc_connected_SSID); - + eth_zero_addr(wilc_connected_ssid); } else if (u8MacStatus == MAC_DISCONNECTED) { PRINT_ER("Received MAC status is MAC_DISCONNECTED\n"); - eth_zero_addr(wilc_connected_SSID); + eth_zero_addr(wilc_connected_ssid); } if (hif_drv->usr_conn_req.pu8bssid) { @@ -2007,7 +2007,7 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv) wilc_optaining_ip = false; wilc_set_power_mgmt(hif_drv, 0, 0); - eth_zero_addr(wilc_connected_SSID); + eth_zero_addr(wilc_connected_ssid); result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 004467c65502..4f5300d096eb 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -398,7 +398,7 @@ s32 wilc_get_statistics(struct host_if_drv *hWFIDrv, void wilc_resolve_disconnect_aberration(struct host_if_drv *hif_drv); extern bool wilc_optaining_ip; -extern u8 wilc_connected_SSID[6]; +extern u8 wilc_connected_ssid[6]; extern u8 wilc_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; extern int wilc_connecting; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index c49b989c7ef3..718b06046399 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -588,7 +588,7 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, * = SUCCESSFUL_STATUSCODE, while mac status is MAC_DISCONNECTED (which means something wrong happened) */ u16ConnectStatus = WLAN_STATUS_UNSPECIFIED_FAILURE; wilc_wlan_set_bssid(priv->dev, NullBssid); - eth_zero_addr(wilc_connected_SSID); + eth_zero_addr(wilc_connected_ssid); if (!pstrWFIDrv->p2p_connect) wlan_channel = INVALID_CHANNEL; @@ -646,7 +646,7 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, wilc_ie = false; eth_zero_addr(priv->au8AssociatedBss); wilc_wlan_set_bssid(priv->dev, NullBssid); - eth_zero_addr(wilc_connected_SSID); + eth_zero_addr(wilc_connected_ssid); if (!pstrWFIDrv->p2p_connect) wlan_channel = INVALID_CHANNEL; From d14991afe0a84900cfd51d63d2c142b6b36d3e26 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:22 +0900 Subject: [PATCH 580/843] staging: wilc1000: clear_shadow_scan: remove unused argument This patch removes pUserVoid that is first argument of clear_shadow_scan function because it is not used in this function. Remove argument in the function call also. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 718b06046399..e72608b0df42 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -202,7 +202,7 @@ static bool g_wep_keys_saved; #define AGING_TIME (9 * 1000) #define during_ip_time 15000 -static void clear_shadow_scan(void *pUserVoid) +static void clear_shadow_scan(void) { int i; @@ -3523,7 +3523,7 @@ int wilc_deinit_host_int(struct net_device *net) s32Error = wilc_deinit(priv->hWILCWFIDrv); /* Clear the Shadow scan */ - clear_shadow_scan(priv); + clear_shadow_scan(); if (op_ifcs == 0) { PRINT_D(CORECONFIG_DBG, "destroy during ip\n"); del_timer_sync(&wilc_during_ip_timer); From 84df0e6d718239cc5839d817ea30dbe26dd69cb2 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:23 +0900 Subject: [PATCH 581/843] staging: wilc1000: rename pUserVoid in refresh_scan function This patch renames pUserVoid to user_void that is first argument of refresh_scan function to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index e72608b0df42..e987e78217ea 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -237,7 +237,7 @@ static u32 get_rssi_avg(tstrNetworkInfo *pstrNetworkInfo) return rssi_v; } -static void refresh_scan(void *pUserVoid, u8 all, bool bDirectScan) +static void refresh_scan(void *user_void, u8 all, bool bDirectScan) { struct wilc_priv *priv; struct wiphy *wiphy; @@ -245,7 +245,7 @@ static void refresh_scan(void *pUserVoid, u8 all, bool bDirectScan) int i; int rssi = 0; - priv = (struct wilc_priv *)pUserVoid; + priv = (struct wilc_priv *)user_void; wiphy = priv->dev->ieee80211_ptr->wiphy; for (i = 0; i < last_scanned_cnt; i++) { From 48ee7bad3e1ec0c782b4908f68e2922629d95351 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:24 +0900 Subject: [PATCH 582/843] staging: wilc1000: rename bDirectScan in refresh_scan function This patch renames bDirectScan to direct_scan that is third argument of refresh_scan function to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index e987e78217ea..6f79662728f2 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -237,7 +237,7 @@ static u32 get_rssi_avg(tstrNetworkInfo *pstrNetworkInfo) return rssi_v; } -static void refresh_scan(void *user_void, u8 all, bool bDirectScan) +static void refresh_scan(void *user_void, u8 all, bool direct_scan) { struct wilc_priv *priv; struct wiphy *wiphy; @@ -263,7 +263,8 @@ static void refresh_scan(void *user_void, u8 all, bool bDirectScan) channel = ieee80211_get_channel(wiphy, s32Freq); rssi = get_rssi_avg(pstrNetworkInfo); - if (memcmp("DIRECT-", pstrNetworkInfo->au8ssid, 7) || bDirectScan) { + if (memcmp("DIRECT-", pstrNetworkInfo->au8ssid, 7) || + direct_scan) { bss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN, pstrNetworkInfo->au8bssid, pstrNetworkInfo->u64Tsf, pstrNetworkInfo->u16CapInfo, pstrNetworkInfo->u16BeaconPeriod, (const u8 *)pstrNetworkInfo->pu8IEs, (size_t)pstrNetworkInfo->u16IEsLen, (((s32)rssi) * 100), GFP_KERNEL); From ce3b1b5a85e846c3d5b307b7aa614ccbd19e9d52 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:25 +0900 Subject: [PATCH 583/843] staging: wilc1000: rename pstrNetworkInfo variable This patch renames pstrNetworkInfo variable to network_info to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 6f79662728f2..9416644a2e07 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -249,25 +249,24 @@ static void refresh_scan(void *user_void, u8 all, bool direct_scan) wiphy = priv->dev->ieee80211_ptr->wiphy; for (i = 0; i < last_scanned_cnt; i++) { - tstrNetworkInfo *pstrNetworkInfo; + tstrNetworkInfo *network_info; - pstrNetworkInfo = &last_scanned_shadow[i]; + network_info = &last_scanned_shadow[i]; - if ((!pstrNetworkInfo->u8Found) || all) { + if (!network_info->u8Found || all) { s32 s32Freq; struct ieee80211_channel *channel; - if (pstrNetworkInfo != NULL) { - - s32Freq = ieee80211_channel_to_frequency((s32)pstrNetworkInfo->u8channel, IEEE80211_BAND_2GHZ); + if (network_info) { + s32Freq = ieee80211_channel_to_frequency((s32)network_info->u8channel, IEEE80211_BAND_2GHZ); channel = ieee80211_get_channel(wiphy, s32Freq); - rssi = get_rssi_avg(pstrNetworkInfo); - if (memcmp("DIRECT-", pstrNetworkInfo->au8ssid, 7) || + rssi = get_rssi_avg(network_info); + if (memcmp("DIRECT-", network_info->au8ssid, 7) || direct_scan) { - bss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN, pstrNetworkInfo->au8bssid, pstrNetworkInfo->u64Tsf, pstrNetworkInfo->u16CapInfo, - pstrNetworkInfo->u16BeaconPeriod, (const u8 *)pstrNetworkInfo->pu8IEs, - (size_t)pstrNetworkInfo->u16IEsLen, (((s32)rssi) * 100), GFP_KERNEL); + bss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN, network_info->au8bssid, network_info->u64Tsf, network_info->u16CapInfo, + network_info->u16BeaconPeriod, (const u8 *)network_info->pu8IEs, + (size_t)network_info->u16IEsLen, (((s32)rssi) * 100), GFP_KERNEL); cfg80211_put_bss(wiphy, bss); } } From c6f5e3a67b8afdf8623114e9d2ff57b94e3b69b1 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:26 +0900 Subject: [PATCH 584/843] staging: wilc1000: rename s32Freq variable This patch renames s32Freq variable to freq to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 9416644a2e07..55cf444d3726 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -254,12 +254,12 @@ static void refresh_scan(void *user_void, u8 all, bool direct_scan) network_info = &last_scanned_shadow[i]; if (!network_info->u8Found || all) { - s32 s32Freq; + s32 freq; struct ieee80211_channel *channel; if (network_info) { - s32Freq = ieee80211_channel_to_frequency((s32)network_info->u8channel, IEEE80211_BAND_2GHZ); - channel = ieee80211_get_channel(wiphy, s32Freq); + freq = ieee80211_channel_to_frequency((s32)network_info->u8channel, IEEE80211_BAND_2GHZ); + channel = ieee80211_get_channel(wiphy, freq); rssi = get_rssi_avg(network_info); if (memcmp("DIRECT-", network_info->au8ssid, 7) || From 12b0138b2a3f6e526ab23f3e46a357910183534d Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:27 +0900 Subject: [PATCH 585/843] staging: wilc1000: reset_shadow_found: remove unused argument This patch removes pUserVoid that is first argument of reset_shadow_found function because it is not used in this function. Remove argument in the function call also. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 55cf444d3726..50327056ca86 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -276,7 +276,7 @@ static void refresh_scan(void *user_void, u8 all, bool direct_scan) } -static void reset_shadow_found(void *pUserVoid) +static void reset_shadow_found(void) { int i; @@ -731,9 +731,7 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) priv->u32RcvdChCount = 0; wilc_set_wfi_drv_handler(priv->hWILCWFIDrv); - - - reset_shadow_found(priv); + reset_shadow_found(); priv->bCfgScanning = true; if (request->n_channels <= MAX_NUM_SCANNED_NETWORKS) { /* TODO: mostafa: to be replaced by */ From 5e51d8ba0badb84cada670436dffb05761042ec3 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:28 +0900 Subject: [PATCH 586/843] staging: wilc1000: update_scan_time: remove unused argument This patch removes pUserVoid that is first argument of update_scan_time function because it is not used in this function. Remove argument in the function call also. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 50327056ca86..56005f6e5174 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -284,7 +284,7 @@ static void reset_shadow_found(void) last_scanned_shadow[i].u8Found = 0; } -static void update_scan_time(void *pUserVoid) +static void update_scan_time(void) { int i; @@ -523,8 +523,7 @@ static void CfgScanResult(enum scan_event enuScanEvent, tstrNetworkInfo *pstrNet PRINT_D(CFG80211_DBG, "Scan Aborted\n"); if (priv->pstrScanReq != NULL) { - - update_scan_time(priv); + update_scan_time(); refresh_scan(priv, 1, false); cfg80211_scan_done(priv->pstrScanReq, false); From 157814f07d994cd892da332f6ba0ab7f912b1a3a Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:29 +0900 Subject: [PATCH 587/843] staging: wilc1000: rename pUserVoid in is_network_in_shadow function This patch renames pUserVoid to user_void that is second argument of is_network_in_shadow function to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 56005f6e5174..5a9d0e23dffc 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -330,14 +330,15 @@ static void clear_duringIP(unsigned long arg) wilc_optaining_ip = false; } -static int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid) +static int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, + void *user_void) { int state = -1; int i; if (last_scanned_cnt == 0) { PRINT_D(CFG80211_DBG, "Starting Aging timer\n"); - hAgingTimer.data = (unsigned long)pUserVoid; + hAgingTimer.data = (unsigned long)user_void; mod_timer(&hAgingTimer, jiffies + msecs_to_jiffies(AGING_TIME)); state = -1; } else { From 5c4cf0dda6dc941a515a91c5c94a56546576f0e3 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:30 +0900 Subject: [PATCH 588/843] staging: wilc1000: rename pUserVoid in add_network_to_shadow function This patch renames pUserVoid to user_void that is second argument of add_network_to_shadow function to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 5a9d0e23dffc..7905f37c241b 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -354,9 +354,10 @@ static int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, return state; } -static void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, void *pJoinParams) +static void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, + void *user_void, void *pJoinParams) { - int ap_found = is_network_in_shadow(pstrNetworkInfo, pUserVoid); + int ap_found = is_network_in_shadow(pstrNetworkInfo, user_void); u32 ap_index = 0; u8 rssi_index = 0; From 1a4c8ce78438bc4a61dd3fce5dc5a52a0f356d80 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:31 +0900 Subject: [PATCH 589/843] staging: wilc1000: rename enuScanEvent in CfgScanResult function This patch renames enuScanEvent to scan_event that is first argument of CfgScanResult function to avoid camelcase. And, remove the relation comment. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 7905f37c241b..646beff5d73f 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -419,7 +419,10 @@ static void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, * @date * @version 1.0 */ -static void CfgScanResult(enum scan_event enuScanEvent, tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, void *pJoinParams) +static void CfgScanResult(enum scan_event scan_event, + tstrNetworkInfo *pstrNetworkInfo, + void *pUserVoid, + void *pJoinParams) { struct wilc_priv *priv; struct wiphy *wiphy; @@ -429,7 +432,7 @@ static void CfgScanResult(enum scan_event enuScanEvent, tstrNetworkInfo *pstrNet priv = (struct wilc_priv *)pUserVoid; if (priv->bCfgScanning) { - if (enuScanEvent == SCAN_EVENT_NETWORK_FOUND) { + if (scan_event == SCAN_EVENT_NETWORK_FOUND) { wiphy = priv->dev->ieee80211_ptr->wiphy; if (!wiphy) @@ -498,7 +501,7 @@ static void CfgScanResult(enum scan_event enuScanEvent, tstrNetworkInfo *pstrNet } } } - } else if (enuScanEvent == SCAN_EVENT_DONE) { + } else if (scan_event == SCAN_EVENT_DONE) { PRINT_D(CFG80211_DBG, "Scan Done[%p]\n", priv->dev); PRINT_D(CFG80211_DBG, "Refreshing Scan ...\n"); refresh_scan(priv, 1, false); @@ -517,10 +520,7 @@ static void CfgScanResult(enum scan_event enuScanEvent, tstrNetworkInfo *pstrNet priv->pstrScanReq = NULL; } up(&(priv->hSemScanReq)); - - } - /*Aborting any scan operation during mac close*/ - else if (enuScanEvent == SCAN_EVENT_ABORTED) { + } else if (scan_event == SCAN_EVENT_ABORTED) { down(&(priv->hSemScanReq)); PRINT_D(CFG80211_DBG, "Scan Aborted\n"); From 0551a72e6970b91451572c9328af0a33ee8f8bdc Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:32 +0900 Subject: [PATCH 590/843] staging: wilc1000: rename pstrNetworkInfo in CfgScanResult function This patch renames pstrNetworkInfo to network_info that is second argument of CfgScanResult function to avoid camelcase. And, remove the relation comment. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 41 ++++++++----------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 646beff5d73f..b0d1ed36b667 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -420,7 +420,7 @@ static void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, * @version 1.0 */ static void CfgScanResult(enum scan_event scan_event, - tstrNetworkInfo *pstrNetworkInfo, + tstrNetworkInfo *network_info, void *pUserVoid, void *pJoinParams) { @@ -438,33 +438,27 @@ static void CfgScanResult(enum scan_event scan_event, if (!wiphy) return; - if (wiphy->signal_type == CFG80211_SIGNAL_TYPE_UNSPEC - && - ((((s32)pstrNetworkInfo->s8rssi) * 100) < 0 - || - (((s32)pstrNetworkInfo->s8rssi) * 100) > 100) - ) { + if (wiphy->signal_type == CFG80211_SIGNAL_TYPE_UNSPEC && + (((s32)network_info->s8rssi * 100) < 0 || + ((s32)network_info->s8rssi * 100) > 100)) { PRINT_ER("wiphy signal type fial\n"); return; } - if (pstrNetworkInfo != NULL) { - s32Freq = ieee80211_channel_to_frequency((s32)pstrNetworkInfo->u8channel, IEEE80211_BAND_2GHZ); + if (network_info) { + s32Freq = ieee80211_channel_to_frequency((s32)network_info->u8channel, IEEE80211_BAND_2GHZ); channel = ieee80211_get_channel(wiphy, s32Freq); if (!channel) return; PRINT_INFO(CFG80211_DBG, "Network Info:: CHANNEL Frequency: %d, RSSI: %d, CapabilityInfo: %d," - "BeaconPeriod: %d\n", channel->center_freq, (((s32)pstrNetworkInfo->s8rssi) * 100), - pstrNetworkInfo->u16CapInfo, pstrNetworkInfo->u16BeaconPeriod); + "BeaconPeriod: %d\n", channel->center_freq, (((s32)network_info->s8rssi) * 100), + network_info->u16CapInfo, network_info->u16BeaconPeriod); - if (pstrNetworkInfo->bNewNetwork) { + if (network_info->bNewNetwork) { if (priv->u32RcvdChCount < MAX_NUM_SCANNED_NETWORKS) { /* TODO: mostafa: to be replaced by */ - /* max_scan_ssids */ - PRINT_D(CFG80211_DBG, "Network %s found\n", pstrNetworkInfo->au8ssid); - - + PRINT_D(CFG80211_DBG, "Network %s found\n", network_info->au8ssid); priv->u32RcvdChCount++; @@ -472,14 +466,13 @@ static void CfgScanResult(enum scan_event scan_event, if (pJoinParams == NULL) { PRINT_INFO(CORECONFIG_DBG, ">> Something really bad happened\n"); } - add_network_to_shadow(pstrNetworkInfo, priv, pJoinParams); + add_network_to_shadow(network_info, priv, pJoinParams); /*P2P peers are sent to WPA supplicant and added to shadow table*/ - - if (!(memcmp("DIRECT-", pstrNetworkInfo->au8ssid, 7))) { - bss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN, pstrNetworkInfo->au8bssid, pstrNetworkInfo->u64Tsf, pstrNetworkInfo->u16CapInfo, - pstrNetworkInfo->u16BeaconPeriod, (const u8 *)pstrNetworkInfo->pu8IEs, - (size_t)pstrNetworkInfo->u16IEsLen, (((s32)pstrNetworkInfo->s8rssi) * 100), GFP_KERNEL); + if (!(memcmp("DIRECT-", network_info->au8ssid, 7))) { + bss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN, network_info->au8bssid, network_info->u64Tsf, network_info->u16CapInfo, + network_info->u16BeaconPeriod, (const u8 *)network_info->pu8IEs, + (size_t)network_info->u16IEsLen, (((s32)network_info->s8rssi) * 100), GFP_KERNEL); cfg80211_put_bss(wiphy, bss); } @@ -491,10 +484,10 @@ static void CfgScanResult(enum scan_event scan_event, u32 i; /* So this network is discovered before, we'll just update its RSSI */ for (i = 0; i < priv->u32RcvdChCount; i++) { - if (memcmp(last_scanned_shadow[i].au8bssid, pstrNetworkInfo->au8bssid, 6) == 0) { + if (memcmp(last_scanned_shadow[i].au8bssid, network_info->au8bssid, 6) == 0) { PRINT_D(CFG80211_DBG, "Update RSSI of %s\n", last_scanned_shadow[i].au8ssid); - last_scanned_shadow[i].s8rssi = pstrNetworkInfo->s8rssi; + last_scanned_shadow[i].s8rssi = network_info->s8rssi; last_scanned_shadow[i].u32TimeRcvdInScan = jiffies; break; } From 30cd10c466a26c215e2a10b07d8a9c7e94ed519c Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:33 +0900 Subject: [PATCH 591/843] staging: wilc1000: rename pUserVoid in CfgScanResult function This patch renames pUserVoid to user_void that is third argument of CfgScanResult function to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index b0d1ed36b667..0b03e54f3568 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -421,7 +421,7 @@ static void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, */ static void CfgScanResult(enum scan_event scan_event, tstrNetworkInfo *network_info, - void *pUserVoid, + void *user_void, void *pJoinParams) { struct wilc_priv *priv; @@ -430,7 +430,7 @@ static void CfgScanResult(enum scan_event scan_event, struct ieee80211_channel *channel; struct cfg80211_bss *bss = NULL; - priv = (struct wilc_priv *)pUserVoid; + priv = (struct wilc_priv *)user_void; if (priv->bCfgScanning) { if (scan_event == SCAN_EVENT_NETWORK_FOUND) { wiphy = priv->dev->ieee80211_ptr->wiphy; From bdd3460f77452392b2e29932133f1b43c6d5eede Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:34 +0900 Subject: [PATCH 592/843] staging: wilc1000: rename pJoinParams in CfgScanResult function This patch renames pJoinParams to join_params that is fourth argument of CfgScanResult function to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 0b03e54f3568..a429167a9bf5 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -422,7 +422,7 @@ static void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, static void CfgScanResult(enum scan_event scan_event, tstrNetworkInfo *network_info, void *user_void, - void *pJoinParams) + void *join_params) { struct wilc_priv *priv; struct wiphy *wiphy; @@ -461,12 +461,9 @@ static void CfgScanResult(enum scan_event scan_event, PRINT_D(CFG80211_DBG, "Network %s found\n", network_info->au8ssid); priv->u32RcvdChCount++; - - - if (pJoinParams == NULL) { + if (!join_params) PRINT_INFO(CORECONFIG_DBG, ">> Something really bad happened\n"); - } - add_network_to_shadow(network_info, priv, pJoinParams); + add_network_to_shadow(network_info, priv, join_params); /*P2P peers are sent to WPA supplicant and added to shadow table*/ if (!(memcmp("DIRECT-", network_info->au8ssid, 7))) { From 0b8bea1cac363cd7de8b1a23b91b0b436cc03d15 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Thu, 19 Nov 2015 15:56:35 +0900 Subject: [PATCH 593/843] staging: wilc1000: rename pstrNetworkInfo in get_rssi_avg function This patch renames pstrNetworkInfo to network_info that is first argument of get_rssi_avg function to avoid camelcase. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index a429167a9bf5..bcfddbfe7e9b 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -224,14 +224,14 @@ static void clear_shadow_scan(void) } -static u32 get_rssi_avg(tstrNetworkInfo *pstrNetworkInfo) +static u32 get_rssi_avg(tstrNetworkInfo *network_info) { u8 i; int rssi_v = 0; - u8 num_rssi = (pstrNetworkInfo->strRssi.u8Full) ? NUM_RSSI : (pstrNetworkInfo->strRssi.u8Index); + u8 num_rssi = (network_info->strRssi.u8Full) ? NUM_RSSI : (network_info->strRssi.u8Index); for (i = 0; i < num_rssi; i++) - rssi_v += pstrNetworkInfo->strRssi.as8RSSI[i]; + rssi_v += network_info->strRssi.as8RSSI[i]; rssi_v /= num_rssi; return rssi_v; From 604f6e2dae1c502018c32dd9e8de92767268eaa5 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 20 Nov 2015 16:56:31 +0900 Subject: [PATCH 594/843] staging: wilc1000: remove unused variable wilc_sdio_func is not used anymore so just delete it. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan_sdio.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index 92633aa2c0bb..ae31f7d89693 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -11,8 +11,6 @@ #define SDIO_MODALIAS "wilc1000_sdio" -static struct sdio_func *wilc_sdio_func; - #define SDIO_VENDOR_ID_WILC 0x0296 #define SDIO_DEVICE_ID_WILC 0x5347 @@ -105,7 +103,6 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id } PRINT_D(INIT_DBG, "Initializing netdev\n"); - wilc_sdio_func = func; if (wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, gpio, &wilc_hif_sdio)) { PRINT_ER("Couldn't initialize netdev\n"); From c2ba8b2bc232721e8bddd86bfe22503b0bf5f2e5 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 20 Nov 2015 16:56:32 +0900 Subject: [PATCH 595/843] staging: wilc1000: return linux error value Return proper linux error value -ETIMEDOUT instead of -1. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 0cd2accf1a34..329477ab5adc 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -601,7 +601,7 @@ s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids, wids[counter].id, (counter == count - 1), drv)) { - ret = -1; + ret = -ETIMEDOUT; printk("[Sendconfigpkt]Get Timed out\n"); break; } @@ -622,7 +622,7 @@ s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids, wids[counter].size, (counter == count - 1), drv)) { - ret = -1; + ret = -ETIMEDOUT; printk("[Sendconfigpkt]Set Timed out\n"); break; } From 6f72ed75e5c572640ca45b439f27ffbb0a50e8c8 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Wed, 25 Nov 2015 11:59:40 +0900 Subject: [PATCH 596/843] staging: wilc1000: fix rmmod failure This patch fixes rmmod failure. wilc->firmware needs to be set to NULL because it is used again to check firmware is released when module exit. Fixes: 8b8ad7bc90bc ("staging: wilc1000: rename wilc_firmware in the struct wilc") Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 73954f468ae8..d1c3e4c10d02 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -506,6 +506,7 @@ static int wilc1000_firmware_download(struct net_device *dev) PRINT_D(INIT_DBG, "Freeing FW buffer ...\n"); PRINT_D(INIT_DBG, "Releasing firmware\n"); release_firmware(wilc->firmware); + wilc->firmware = NULL; PRINT_D(INIT_DBG, "Download Succeeded\n"); From a89f7c551af21058ee0a2d5a425d410fc1abfc13 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Wed, 25 Nov 2015 11:59:41 +0900 Subject: [PATCH 597/843] staging: wilc1000: wilc_wfi_cfgoperations.c: remove over-commenting There are over-commenting in the wilc_wfi_cfgoperations.c file and most of them are not helpful to explain what the code does and generate 80 ending line over warnings. So, all of comments are removed in this patch and the comments will later be added if necessary with the preferred Linux style. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 681 +----------------- 1 file changed, 23 insertions(+), 658 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index bcfddbfe7e9b..bfef022c315b 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1,20 +1,7 @@ -/*! - * @file wilc_wfi_cfgopertaions.c - * @brief CFG80211 Function Implementation functionality - * @author aabouzaeid - * mabubakr - * mdaftedar - * zsalah - * @sa wilc_wfi_cfgopertaions.h top level OS wrapper file - * @date 31 Aug 2010 - * @version 1.0 - */ - #include "wilc_wfi_cfgoperations.h" #include "host_interface.h" #include -/* The following macros describe the bitfield map used by the firmware to determine its 11i mode */ #define NO_ENCRYPT 0 #define ENCRYPT_ENABLED BIT(0) #define WEP BIT(1) @@ -24,13 +11,11 @@ #define AES BIT(5) #define TKIP BIT(6) -/*Public action frame index IDs*/ #define FRAME_TYPE_ID 0 #define ACTION_CAT_ID 24 #define ACTION_SUBTYPE_ID 25 #define P2P_PUB_ACTION_SUBTYPE 30 -/*Public action frame Attribute IDs*/ #define ACTION_FRAME 0xd0 #define GO_INTENT_ATTR_ID 0x04 #define CHANLIST_ATTR_ID 0x0b @@ -38,7 +23,6 @@ #define PUB_ACTION_ATTR_ID 0x04 #define P2PELEM_ATTR_ID 0xdd -/*Public action subtype values*/ #define GO_NEG_REQ 0x00 #define GO_NEG_RSP 0x01 #define GO_NEG_CONF 0x02 @@ -90,7 +74,6 @@ static const struct ieee80211_txrx_stypes } }; -/* Time to stay on the channel */ #define WILC_WFI_DWELL_PASSIVE 100 #define WILC_WFI_DWELL_ACTIVE 40 @@ -123,7 +106,6 @@ u8 wilc_initialized = 1; .max_power = 30, \ } -/*Frequency range for channels*/ static struct ieee80211_channel ieee80211_2ghz_channels[] = { CHAN2G(1, 2412, 0), CHAN2G(2, 2417, 0), @@ -147,8 +129,6 @@ static struct ieee80211_channel ieee80211_2ghz_channels[] = { .flags = (_flags), \ } - -/* Table 6 in section 3.2.1.1 */ static struct ieee80211_rate ieee80211_bitrates[] = { RATETAB_ENT(10, 0, 0), RATETAB_ENT(20, 1, 0), @@ -342,7 +322,6 @@ static int is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, mod_timer(&hAgingTimer, jiffies + msecs_to_jiffies(AGING_TIME)); state = -1; } else { - /* Linear search for now */ for (i = 0; i < last_scanned_cnt; i++) { if (memcmp(last_scanned_shadow[i].au8bssid, pstrNetworkInfo->au8bssid, 6) == 0) { @@ -394,7 +373,7 @@ static void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, if (ap_found != -1) kfree(last_scanned_shadow[ap_index].pu8IEs); last_scanned_shadow[ap_index].pu8IEs = - kmalloc(pstrNetworkInfo->u16IEsLen, GFP_KERNEL); /* will be deallocated by the WILC_WFI_CfgScan() function */ + kmalloc(pstrNetworkInfo->u16IEsLen, GFP_KERNEL); memcpy(last_scanned_shadow[ap_index].pu8IEs, pstrNetworkInfo->pu8IEs, pstrNetworkInfo->u16IEsLen); last_scanned_shadow[ap_index].u32TimeRcvdInScan = jiffies; @@ -405,20 +384,6 @@ static void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, last_scanned_shadow[ap_index].pJoinParams = pJoinParams; } - -/** - * @brief CfgScanResult - * @details Callback function which returns the scan results found - * - * @param[in] tenuScanEvent enuScanEvent: enum, indicating the scan event triggered, whether that is - * SCAN_EVENT_NETWORK_FOUND or SCAN_EVENT_DONE - * tstrNetworkInfo* pstrNetworkInfo: structure holding the scan results information - * void* pUserVoid: Private structure associated with the wireless interface - * @return NONE - * @author mabubakr - * @date - * @version 1.0 - */ static void CfgScanResult(enum scan_event scan_event, tstrNetworkInfo *network_info, void *user_void, @@ -457,7 +422,7 @@ static void CfgScanResult(enum scan_event scan_event, network_info->u16CapInfo, network_info->u16BeaconPeriod); if (network_info->bNewNetwork) { - if (priv->u32RcvdChCount < MAX_NUM_SCANNED_NETWORKS) { /* TODO: mostafa: to be replaced by */ + if (priv->u32RcvdChCount < MAX_NUM_SCANNED_NETWORKS) { PRINT_D(CFG80211_DBG, "Network %s found\n", network_info->au8ssid); priv->u32RcvdChCount++; @@ -465,7 +430,6 @@ static void CfgScanResult(enum scan_event scan_event, PRINT_INFO(CORECONFIG_DBG, ">> Something really bad happened\n"); add_network_to_shadow(network_info, priv, join_params); - /*P2P peers are sent to WPA supplicant and added to shadow table*/ if (!(memcmp("DIRECT-", network_info->au8ssid, 7))) { bss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN, network_info->au8bssid, network_info->u64Tsf, network_info->u16CapInfo, network_info->u16BeaconPeriod, (const u8 *)network_info->pu8IEs, @@ -479,7 +443,7 @@ static void CfgScanResult(enum scan_event scan_event, } } else { u32 i; - /* So this network is discovered before, we'll just update its RSSI */ + for (i = 0; i < priv->u32RcvdChCount; i++) { if (memcmp(last_scanned_shadow[i].au8bssid, network_info->au8bssid, 6) == 0) { PRINT_D(CFG80211_DBG, "Update RSSI of %s\n", last_scanned_shadow[i].au8ssid); @@ -527,21 +491,6 @@ static void CfgScanResult(enum scan_event scan_event, } } - -/** - * @brief CfgConnectResult - * @details - * @param[in] tenuConnDisconnEvent enuConnDisconnEvent: Type of connection response either - * connection response or disconnection notification. - * tstrConnectInfo* pstrConnectInfo: COnnection information. - * u8 u8MacStatus: Mac Status from firmware - * tstrDisconnectNotifInfo* pstrDisconnectNotifInfo: Disconnection Notification - * void* pUserVoid: Private data associated with wireless interface - * @return NONE - * @author mabubakr - * @date 01 MAR 2012 - * @version 1.0 - */ int wilc_connecting; static void CfgConnectResult(enum conn_event enuConnDisconnEvent, @@ -566,7 +515,6 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv; if (enuConnDisconnEvent == CONN_DISCONN_EVENT_CONN_RESP) { - /*Initialization*/ u16 u16ConnectStatus; u16ConnectStatus = pstrConnectInfo->u16ConnectStatus; @@ -575,8 +523,6 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, if ((u8MacStatus == MAC_DISCONNECTED) && (pstrConnectInfo->u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { - /* The case here is that our station was waiting for association response frame and has just received it containing status code - * = SUCCESSFUL_STATUSCODE, while mac status is MAC_DISCONNECTED (which means something wrong happened) */ u16ConnectStatus = WLAN_STATUS_UNSPECIFIED_FAILURE; wilc_wlan_set_bssid(priv->dev, NullBssid); eth_zero_addr(wilc_connected_ssid); @@ -610,12 +556,8 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, } } - if (bNeedScanRefresh) { - /*Also, refrsh DIRECT- results if */ + if (bNeedScanRefresh) refresh_scan(priv, 1, true); - - } - } @@ -626,8 +568,7 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, cfg80211_connect_result(dev, pstrConnectInfo->au8bssid, pstrConnectInfo->pu8ReqIEs, pstrConnectInfo->ReqIEsLen, pstrConnectInfo->pu8RespIEs, pstrConnectInfo->u16RespIEsLen, - u16ConnectStatus, GFP_KERNEL); /* TODO: mostafa: u16ConnectStatus to */ - /* be replaced by pstrConnectInfo->u16ConnectStatus */ + u16ConnectStatus, GFP_KERNEL); } else if (enuConnDisconnEvent == CONN_DISCONN_EVENT_DISCONN_NOTIF) { wilc_optaining_ip = false; PRINT_ER("Received MAC_DISCONNECTED from firmware with reason %d on dev [%p]\n", @@ -641,14 +582,9 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, if (!pstrWFIDrv->p2p_connect) wlan_channel = INVALID_CHANNEL; - /*Incase "P2P CLIENT Connected" send deauthentication reason by 3 to force the WPA_SUPPLICANT to directly change - * virtual interface to station*/ if ((pstrWFIDrv->IFC_UP) && (dev == wl->vif[1].ndev)) { pstrDisconnectNotifInfo->u16reason = 3; - } - /*Incase "P2P CLIENT during connection(not connected)" send deauthentication reason by 1 to force the WPA_SUPPLICANT - * to scan again and retry the connection*/ - else if ((!pstrWFIDrv->IFC_UP) && (dev == wl->vif[1].ndev)) { + } else if ((!pstrWFIDrv->IFC_UP) && (dev == wl->vif[1].ndev)) { pstrDisconnectNotifInfo->u16reason = 1; } cfg80211_disconnected(dev, pstrDisconnectNotifInfo->u16reason, pstrDisconnectNotifInfo->ie, @@ -659,20 +595,6 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, } - -/** - * @brief set_channel - * @details Set channel for a given wireless interface. Some devices - * may support multi-channel operation (by channel hopping) so cfg80211 - * doesn't verify much. Note, however, that the passed netdev may be - * %NULL as well if the user requested changing the channel for the - * device itself, or for a monitor interface. - * @param[in] - * @return int : Return 0 on Success - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ static int set_channel(struct wiphy *wiphy, struct cfg80211_chan_def *chandef) { @@ -694,19 +616,6 @@ static int set_channel(struct wiphy *wiphy, return result; } -/** - * @brief scan - * @details Request to do a scan. If returning zero, the scan request is given - * the driver, and will be valid until passed to cfg80211_scan_done(). - * For scan results, call cfg80211_inform_bss(); you can call this outside - * the scan/scan_done bracket too. - * @param[in] - * @return int : Return 0 on Success - * @author mabubakr - * @date 01 MAR 2012 - * @version 1.0 - */ - static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) { struct wilc_priv *priv; @@ -725,8 +634,7 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) reset_shadow_found(); priv->bCfgScanning = true; - if (request->n_channels <= MAX_NUM_SCANNED_NETWORKS) { /* TODO: mostafa: to be replaced by */ - /* max_scan_ssids */ + if (request->n_channels <= MAX_NUM_SCANNED_NETWORKS) { for (i = 0; i < request->n_channels; i++) { au8ScanChanList[i] = (u8)ieee80211_frequency_to_channel(request->channels[i]->center_freq); PRINT_INFO(CFG80211_DBG, "ScanChannel List[%d] = %d,", i, au8ScanChanList[i]); @@ -781,18 +689,6 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) return s32Error; } -/** - * @brief connect - * @details Connect to the ESS with the specified parameters. When connected, - * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS. - * If the connection fails for some reason, call cfg80211_connect_result() - * with the status from the AP. - * @param[in] - * @return int : Return 0 on Success - * @author mabubakr - * @date 01 MAR 2012 - * @version 1.0 - */ static int connect(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_connect_params *sme) { @@ -831,13 +727,9 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, sme->ssid_len) == 0) { PRINT_INFO(CFG80211_DBG, "Network with required SSID is found %s\n", sme->ssid); if (sme->bssid == NULL) { - /* BSSID is not passed from the user, so decision of matching - * is done by SSID only */ PRINT_INFO(CFG80211_DBG, "BSSID is not passed from the user\n"); break; } else { - /* BSSID is also passed from the user, so decision of matching - * should consider also this passed BSSID */ if (memcmp(last_scanned_shadow[i].au8bssid, sme->bssid, ETH_ALEN) == 0) { @@ -882,8 +774,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, } if (sme->crypto.cipher_group != NO_ENCRYPT) { - /* To determine the u8security value, first we check the group cipher suite then {in case of WPA or WPA2} - * we will add to it the pairwise cipher suite(s) */ pcwpa_version = "Default"; PRINT_D(CORECONFIG_DBG, ">> sme->crypto.wpa_versions: %x\n", sme->crypto.wpa_versions); if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_WEP40) { @@ -930,8 +820,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, u8security = ENCRYPT_ENABLED | WPA2 | TKIP; pcgroup_encrypt_val = "WPA2_TKIP"; pccipher_group = "TKIP"; - } else { /* TODO: mostafa: here we assume that any other encryption type is AES */ - /* tenuSecurity_t = WPA2_AES; */ + } else { u8security = ENCRYPT_ENABLED | WPA2 | AES; pcgroup_encrypt_val = "WPA2_AES"; pccipher_group = "AES"; @@ -942,8 +831,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, u8security = ENCRYPT_ENABLED | WPA | TKIP; pcgroup_encrypt_val = "WPA_TKIP"; pccipher_group = "TKIP"; - } else { /* TODO: mostafa: here we assume that any other encryption type is AES */ - /* tenuSecurity_t = WPA_AES; */ + } else { u8security = ENCRYPT_ENABLED | WPA | AES; pcgroup_encrypt_val = "WPA_AES"; pccipher_group = "AES"; @@ -960,14 +848,12 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, } - /* After we set the u8security value from checking the group cipher suite, {in case of WPA or WPA2} we will - * add to it the pairwise cipher suite(s) */ if ((sme->crypto.wpa_versions & NL80211_WPA_VERSION_1) || (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2)) { for (i = 0; i < sme->crypto.n_ciphers_pairwise; i++) { if (sme->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_TKIP) { u8security = u8security | TKIP; - } else { /* TODO: mostafa: here we assume that any other encryption type is AES */ + } else { u8security = u8security | AES; } } @@ -991,8 +877,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, PRINT_D(CFG80211_DBG, "Automatic Authentation type = %d\n", sme->auth_type); } - - /* ai: key_mgmt: enterprise case */ if (sme->crypto.n_akm_suites) { switch (sme->crypto.akm_suites[0]) { case WLAN_AKM_SUITE_8021X: @@ -1033,16 +917,6 @@ done: return s32Error; } - -/** - * @brief disconnect - * @details Disconnect from the BSS/ESS. - * @param[in] - * @return int : Return 0 on Success - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_code) { s32 s32Error = 0; @@ -1074,16 +948,6 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co return s32Error; } -/** - * @brief add_key - * @details Add a key with the given parameters. @mac_addr will be %NULL - * when adding a group key. - * @param[in] key : key buffer; TKIP: 16-byte temporal key, 8-byte Tx Mic key, 8-byte Rx Mic Key - * @return int : Return 0 on Success - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, bool pairwise, const u8 *mac_addr, struct key_params *params) @@ -1187,13 +1051,10 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, pu8RxMic = params->key + 16; KeyLen = params->key_len - 16; } - /* if there has been previous allocation for the same index through its key, free that memory and allocate again*/ kfree(priv->wilc_gtk[key_index]->key); priv->wilc_gtk[key_index]->key = kmalloc(params->key_len, GFP_KERNEL); memcpy(priv->wilc_gtk[key_index]->key, params->key, params->key_len); - - /* if there has been previous allocation for the same index through its seq, free that memory and allocate again*/ kfree(priv->wilc_gtk[key_index]->seq); if ((params->seq_len) > 0) { @@ -1268,13 +1129,11 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, u8mode = 0; if (!pairwise) { if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) { - /* swap the tx mic by rx mic */ pu8RxMic = params->key + 24; pu8TxMic = params->key + 16; KeyLen = params->key_len - 16; } - /*save keys only on interface 0 (wifi interface)*/ if (!g_gtk_keys_saved && netdev == wl->vif[0].ndev) { g_add_gtk_key_params.key_idx = key_index; g_add_gtk_key_params.pairwise = pairwise; @@ -1304,13 +1163,11 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, key_index, params->seq_len, params->seq, pu8RxMic, pu8TxMic, STATION_MODE, u8mode); } else { if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) { - /* swap the tx mic by rx mic */ pu8RxMic = params->key + 24; pu8TxMic = params->key + 16; KeyLen = params->key_len - 16; } - /*save keys only on interface 0 (wifi interface)*/ if (!g_ptk_keys_saved && netdev == wl->vif[0].ndev) { g_add_ptk_key_params.key_idx = key_index; g_add_ptk_key_params.pairwise = pairwise; @@ -1356,16 +1213,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, return s32Error; } -/** - * @brief del_key - * @details Remove a key given the @mac_addr (%NULL for a group key) - * and @key_index, return -ENOENT if the key doesn't exist. - * @param[in] - * @return int : Return 0 on Success - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ static int del_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, bool pairwise, @@ -1379,18 +1226,14 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev, nic = netdev_priv(netdev); wl = nic->wilc; - /*delete saved keys, if any*/ if (netdev == wl->vif[0].ndev) { g_ptk_keys_saved = false; g_gtk_keys_saved = false; g_wep_keys_saved = false; - /*Delete saved WEP keys params, if any*/ kfree(g_key_wep_params.key); g_key_wep_params.key = NULL; - /*freeing memory allocated by "wilc_gtk" and "wilc_ptk" in "WILC_WIFI_ADD_KEY"*/ - if ((priv->wilc_gtk[key_index]) != NULL) { kfree(priv->wilc_gtk[key_index]->key); @@ -1413,7 +1256,6 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev, priv->wilc_ptk[key_index] = NULL; } - /*Delete saved PTK and GTK keys params, if any*/ kfree(g_key_ptk_params.key); g_key_ptk_params.key = NULL; kfree(g_key_ptk_params.seq); @@ -1424,7 +1266,6 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev, kfree(g_key_gtk_params.seq); g_key_gtk_params.seq = NULL; - /*Reset WILC_CHANGING_VIR_IF register to allow adding futrue keys to CE H/W*/ wilc_set_machw_change_vir_if(netdev, false); } @@ -1442,19 +1283,6 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev, return 0; } -/** - * @brief get_key - * @details Get information about the key with the given parameters. - * @mac_addr will be %NULL when requesting information for a group - * key. All pointers given to the @callback function need not be valid - * after it returns. This function should return an error if it is - * not possible to retrieve the key, -ENOENT if it doesn't exist. - * @param[in] - * @return int : Return 0 on Success - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ static int get_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, bool pairwise, const u8 *mac_addr, void *cookie, void (*callback)(void *cookie, struct key_params *)) @@ -1490,18 +1318,9 @@ static int get_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, callback(cookie, &key_params); - return 0; /* priv->wilc_gtk->key_len ?0 : -ENOENT; */ + return 0; } -/** - * @brief set_default_key - * @details Set the default management frame key on an interface - * @param[in] - * @return int : Return 0 on Success. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ static int set_default_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, bool unicast, bool multicast) { @@ -1520,16 +1339,6 @@ static int set_default_key(struct wiphy *wiphy, struct net_device *netdev, u8 ke return 0; } -/** - * @brief get_station - * @details Get station information for the station identified by @mac - * @param[in] NONE - * @return int : Return 0 on Success. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ - static int get_station(struct wiphy *wiphy, struct net_device *dev, const u8 *mac, struct station_info *sinfo) { @@ -1597,28 +1406,6 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, return 0; } - -/** - * @brief change_bss - * @details Modify parameters for a given BSS. - * @param[in] - * -use_cts_prot: Whether to use CTS protection - * (0 = no, 1 = yes, -1 = do not change) - * -use_short_preamble: Whether the use of short preambles is allowed - * (0 = no, 1 = yes, -1 = do not change) - * -use_short_slot_time: Whether the use of short slot time is allowed - * (0 = no, 1 = yes, -1 = do not change) - * -basic_rates: basic rates in IEEE 802.11 format - * (or NULL for no change) - * -basic_rates_len: number of basic rates - * -ap_isolate: do not forward packets between connected stations - * -ht_opmode: HT Operation mode - * (u16 = opmode, -1 = do not change) - * @return int : Return 0 on Success. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ static int change_bss(struct wiphy *wiphy, struct net_device *dev, struct bss_parameters *params) { @@ -1626,16 +1413,6 @@ static int change_bss(struct wiphy *wiphy, struct net_device *dev, return 0; } -/** - * @brief set_wiphy_params - * @details Notify that wiphy parameters have changed; - * @param[in] Changed bitfield (see &enum wiphy_params_flags) describes which values - * have changed. - * @return int : Return 0 on Success - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ static int set_wiphy_params(struct wiphy *wiphy, u32 changed) { s32 s32Error = 0; @@ -1684,17 +1461,6 @@ static int set_wiphy_params(struct wiphy *wiphy, u32 changed) return s32Error; } -/** - * @brief set_pmksa - * @details Cache a PMKID for a BSSID. This is mostly useful for fullmac - * devices running firmwares capable of generating the (re) association - * RSN IE. It allows for faster roaming between WPA2 BSSIDs. - * @param[in] - * @return int : Return 0 on Success - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev, struct cfg80211_pmksa *pmksa) { @@ -1710,7 +1476,6 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev, for (i = 0; i < priv->pmkid_list.numpmkid; i++) { if (!memcmp(pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid, ETH_ALEN)) { - /*If bssid already exists and pmkid value needs to reset*/ flag = PMKID_FOUND; PRINT_D(CFG80211_DBG, "PMKID already exists\n"); break; @@ -1736,15 +1501,6 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev, return s32Error; } -/** - * @brief del_pmksa - * @details Delete a cached PMKID. - * @param[in] - * @return int : Return 0 on Success - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev, struct cfg80211_pmksa *pmksa) { @@ -1759,7 +1515,6 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev, for (i = 0; i < priv->pmkid_list.numpmkid; i++) { if (!memcmp(pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid, ETH_ALEN)) { - /*If bssid is found, reset the values*/ PRINT_D(CFG80211_DBG, "Reseting PMKID values\n"); memset(&priv->pmkid_list.pmkidlist[i], 0, sizeof(struct host_if_pmkid)); break; @@ -1783,42 +1538,17 @@ static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev, return s32Error; } -/** - * @brief flush_pmksa - * @details Flush all cached PMKIDs. - * @param[in] - * @return int : Return 0 on Success - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ static int flush_pmksa(struct wiphy *wiphy, struct net_device *netdev) { struct wilc_priv *priv = wiphy_priv(wiphy); PRINT_D(CFG80211_DBG, "Flushing PMKID key values\n"); - /*Get cashed Pmkids and set all with zeros*/ memset(&priv->pmkid_list, 0, sizeof(struct host_if_pmkid_attr)); return 0; } - -/** - * @brief WILC_WFI_CfgParseRxAction - * @details Function parses the received frames and modifies the following attributes: - * -GO Intent - * -Channel list - * -Operating Channel - * - * @param[in] u8* Buffer, u32 length - * @return NONE. - * @author mdaftedar - * @date 12 DEC 2012 - * @version - */ - static void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len) { u32 index = 0; @@ -1836,10 +1566,9 @@ static void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len) channel_list_attr_index = index; else if (buf[index] == OPERCHAN_ATTR_ID) op_channel_attr_index = index; - index += buf[index + 1] + 3; /* ID,Length byte */ + index += buf[index + 1] + 3; } if (wlan_channel != INVALID_CHANNEL) { - /*Modify channel list attribute*/ if (channel_list_attr_index) { PRINT_D(GENERIC_DBG, "Modify channel list attribute\n"); for (i = channel_list_attr_index + 3; i < ((channel_list_attr_index + 3) + buf[channel_list_attr_index + 1]); i++) { @@ -1851,7 +1580,7 @@ static void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len) } } } - /*Modify operating channel attribute*/ + if (op_channel_attr_index) { PRINT_D(GENERIC_DBG, "Modify operating channel attribute\n"); buf[op_channel_attr_index + 6] = 0x51; @@ -1860,16 +1589,6 @@ static void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len) } } -/** - * @brief WILC_WFI_CfgParseTxAction - * @details Function parses the transmitted action frames and modifies the - * GO Intent attribute - * @param[in] u8* Buffer, u32 length, bool bOperChan, u8 iftype - * @return NONE. - * @author mdaftedar - * @date 12 DEC 2012 - * @version - */ static void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftype) { u32 index = 0; @@ -1889,10 +1608,9 @@ static void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftyp channel_list_attr_index = index; else if (buf[index] == OPERCHAN_ATTR_ID) op_channel_attr_index = index; - index += buf[index + 1] + 3; /* ID,Length byte */ + index += buf[index + 1] + 3; } if (wlan_channel != INVALID_CHANNEL && bOperChan) { - /*Modify channel list attribute*/ if (channel_list_attr_index) { PRINT_D(GENERIC_DBG, "Modify channel list attribute\n"); for (i = channel_list_attr_index + 3; i < ((channel_list_attr_index + 3) + buf[channel_list_attr_index + 1]); i++) { @@ -1904,7 +1622,7 @@ static void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftyp } } } - /*Modify operating channel attribute*/ + if (op_channel_attr_index) { PRINT_D(GENERIC_DBG, "Modify operating channel attribute\n"); buf[op_channel_attr_index + 6] = 0x51; @@ -1913,16 +1631,6 @@ static void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftyp } } -/* @brief WILC_WFI_p2p_rx - * @details - * @param[in] - * - * @return None - * @author Mai Daftedar - * @date 2 JUN 2013 - * @version 1.0 - */ - void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size) { @@ -1935,11 +1643,8 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size) priv = wiphy_priv(dev->ieee80211_ptr->wiphy); pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv; - /* Get WILC header */ memcpy(&header, (buff - HOST_HDR_OFFSET), HOST_HDR_OFFSET); - /* The packet offset field conain info about what type of managment frame */ - /* we are dealing with and ack status */ pkt_offset = GET_PKT_OFFSET(header); if (pkt_offset & IS_MANAGMEMENT_CALLBACK) { @@ -1963,7 +1668,6 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size) PRINT_D(GENERIC_DBG, "Rx Frame Type:%x\n", buff[FRAME_TYPE_ID]); - /*Upper layer is informed that the frame is received on this freq*/ s32Freq = ieee80211_channel_to_frequency(curr_channel, IEEE80211_BAND_2GHZ); if (ieee80211_is_action(buff[FRAME_TYPE_ID])) { @@ -2016,7 +1720,6 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size) if ((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP) && (wilc_ie)) { PRINT_D(GENERIC_DBG, "Sending P2P to host without extra elemnt\n"); - /* extra attribute for sig_dbm: signal strength in mBm, or 0 if unknown */ cfg80211_rx_mgmt(priv->wdev, s32Freq, 0, buff, size - 7, 0); return; } @@ -2033,16 +1736,6 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size) } } -/** - * @brief WILC_WFI_mgmt_tx_complete - * @details Returns result of writing mgmt frame to VMM (Tx buffers are freed here) - * @param[in] priv - * transmitting status - * @return None - * @author Amr Abdelmoghny - * @date 20 MAY 2013 - * @version 1.0 - */ static void WILC_WFI_mgmt_tx_complete(void *priv, int status) { struct p2p_mgmt_data *pv_data = (struct p2p_mgmt_data *)priv; @@ -2052,16 +1745,6 @@ static void WILC_WFI_mgmt_tx_complete(void *priv, int status) kfree(pv_data); } -/** - * @brief WILC_WFI_RemainOnChannelReady - * @details Callback function, called from handle_remain_on_channel on being ready on channel - * @param - * @return none - * @author Amr abdelmoghny - * @date 9 JUNE 2013 - * @version - */ - static void WILC_WFI_RemainOnChannelReady(void *pUserVoid) { struct wilc_priv *priv; @@ -2079,16 +1762,6 @@ static void WILC_WFI_RemainOnChannelReady(void *pUserVoid) GFP_KERNEL); } -/** - * @brief WILC_WFI_RemainOnChannelExpired - * @details Callback function, called on expiration of remain-on-channel duration - * @param - * @return none - * @author Amr abdelmoghny - * @date 15 MAY 2013 - * @version - */ - static void WILC_WFI_RemainOnChannelExpired(void *pUserVoid, u32 u32SessionID) { struct wilc_priv *priv; @@ -2100,7 +1773,6 @@ static void WILC_WFI_RemainOnChannelExpired(void *pUserVoid, u32 u32SessionID) priv->bInP2PlistenState = false; - /*Inform wpas of remain-on-channel expiration*/ cfg80211_remain_on_channel_expired(priv->wdev, priv->strRemainOnChanParams.u64ListenCookie, priv->strRemainOnChanParams.pstrListenChan, @@ -2111,20 +1783,6 @@ static void WILC_WFI_RemainOnChannelExpired(void *pUserVoid, u32 u32SessionID) } } - -/** - * @brief remain_on_channel - * @details Request the driver to remain awake on the specified - * channel for the specified duration to complete an off-channel - * operation (e.g., public action frame exchange). When the driver is - * ready on the requested channel, it must indicate this with an event - * notification by calling cfg80211_ready_on_channel(). - * @param[in] - * @return int : Return 0 on Success - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ static int remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev, struct ieee80211_channel *chan, @@ -2145,7 +1803,6 @@ static int remain_on_channel(struct wiphy *wiphy, curr_channel = chan->hw_value; - /*Setting params needed by WILC_WFI_RemainOnChannelExpired()*/ priv->strRemainOnChanParams.pstrListenChan = chan; priv->strRemainOnChanParams.u64ListenCookie = *cookie; priv->strRemainOnChanParams.u32ListenDuration = duration; @@ -2162,19 +1819,6 @@ static int remain_on_channel(struct wiphy *wiphy, return s32Error; } -/** - * @brief cancel_remain_on_channel - * @details Cancel an on-going remain-on-channel operation. - * This allows the operation to be terminated prior to timeout based on - * the duration value. - * @param[in] struct wiphy *wiphy, - * @param[in] struct net_device *dev - * @param[in] u64 cookie, - * @return int : Return 0 on Success - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ static int cancel_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev, u64 cookie) @@ -2189,16 +1833,7 @@ static int cancel_remain_on_channel(struct wiphy *wiphy, s32Error = wilc_listen_state_expired(priv->hWILCWFIDrv, priv->strRemainOnChanParams.u32ListenSessionID); return s32Error; } -/** - * @brief WILC_WFI_mgmt_tx_frame - * @details - * - * @param[in] - * @return NONE. - * @author mdaftedar - * @date 01 JUL 2012 - * @version - */ + static int mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, struct cfg80211_mgmt_tx_params *params, @@ -2225,8 +1860,6 @@ static int mgmt_tx(struct wiphy *wiphy, mgmt = (const struct ieee80211_mgmt *) buf; if (ieee80211_is_mgmt(mgmt->frame_control)) { - - /*mgmt frame allocation*/ mgmt_tx = kmalloc(sizeof(struct p2p_mgmt_data), GFP_KERNEL); if (mgmt_tx == NULL) { PRINT_ER("Failed to allocate memory for mgmt_tx structure\n"); @@ -2246,22 +1879,16 @@ static int mgmt_tx(struct wiphy *wiphy, PRINT_D(GENERIC_DBG, "TX: Probe Response\n"); PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value); wilc_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value); - /*Save the current channel after we tune to it*/ curr_channel = chan->hw_value; } else if (ieee80211_is_action(mgmt->frame_control)) { PRINT_D(GENERIC_DBG, "ACTION FRAME:%x\n", (u16)mgmt->frame_control); if (buf[ACTION_CAT_ID] == PUB_ACTION_ATTR_ID) { - /*Only set the channel, if not a negotiation confirmation frame - * (If Negotiation confirmation frame, force it - * to be transmitted on the same negotiation channel)*/ - if (buf[ACTION_SUBTYPE_ID] != PUBLIC_ACT_VENDORSPEC || buf[P2P_PUB_ACTION_SUBTYPE] != GO_NEG_CONF) { PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value); wilc_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value); - /*Save the current channel after we tune to it*/ curr_channel = chan->hw_value; } switch (buf[ACTION_SUBTYPE_ID]) { @@ -2280,7 +1907,6 @@ static int mgmt_tx(struct wiphy *wiphy, case PUBLIC_ACT_VENDORSPEC: { if (!memcmp(p2p_oui, &buf[ACTION_SUBTYPE_ID + 1], 4)) { - /*For the connection of two WILC's connection generate a rand number to determine who will be a GO*/ if ((buf[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP)) { if (p2p_local_random == 1 && p2p_recv_random < p2p_local_random) { get_random_bytes(&p2p_local_random, 1); @@ -2293,14 +1919,10 @@ static int mgmt_tx(struct wiphy *wiphy, if (p2p_local_random > p2p_recv_random) { PRINT_D(GENERIC_DBG, "LOCAL WILL BE GO LocaRand=%02x RecvRand %02x\n", p2p_local_random, p2p_recv_random); - /*Search for the p2p information information element , after the Public action subtype theres a byte for teh dialog token, skip that*/ for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < len; i++) { if (buf[i] == P2PELEM_ATTR_ID && !(memcmp(p2p_oui, &buf[i + 2], 4))) { if (buf[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_RSP) WILC_WFI_CfgParseTxAction(&mgmt_tx->buff[i + 6], len - (i + 6), true, nic->iftype); - - /*If using supplicant go intent, no need at all*/ - /*to parse transmitted negotiation frames*/ else WILC_WFI_CfgParseTxAction(&mgmt_tx->buff[i + 6], len - (i + 6), false, nic->iftype); break; @@ -2308,10 +1930,6 @@ static int mgmt_tx(struct wiphy *wiphy, } if (buf[P2P_PUB_ACTION_SUBTYPE] != P2P_INV_REQ && buf[P2P_PUB_ACTION_SUBTYPE] != P2P_INV_RSP) { - /* - * Adding WILC information element to allow two WILC devices to - * identify each other and connect - */ memcpy(&mgmt_tx->buff[len], p2p_vendor_spec, sizeof(p2p_vendor_spec)); mgmt_tx->buff[len + sizeof(p2p_vendor_spec)] = p2p_local_random; mgmt_tx->size = buf_len; @@ -2377,17 +1995,6 @@ static int mgmt_tx_cancel_wait(struct wiphy *wiphy, return 0; } -/** - * @brief wilc_mgmt_frame_register - * @details Notify driver that a management frame type was - * registered. Note that this callback may not sleep, and cannot run - * concurrently with itself. - * @param[in] - * @return NONE. - * @author mdaftedar - * @date 01 JUL 2012 - * @version - */ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev, u16 frame_type, bool reg) { @@ -2425,7 +2032,7 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev, } } - /*If mac is closed, then return*/ + if (!wl->initialized) { PRINT_D(GENERIC_DBG, "Return since mac is closed\n"); return; @@ -2435,18 +2042,6 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev, } -/** - * @brief set_cqm_rssi_config - * @details Configure connection quality monitor RSSI threshold. - * @param[in] struct wiphy *wiphy: - * @param[in] struct net_device *dev: - * @param[in] s32 rssi_thold: - * @param[in] u32 rssi_hyst: - * @return int : Return 0 on Success - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ static int set_cqm_rssi_config(struct wiphy *wiphy, struct net_device *dev, s32 rssi_thold, u32 rssi_hyst) { @@ -2454,19 +2049,7 @@ static int set_cqm_rssi_config(struct wiphy *wiphy, struct net_device *dev, return 0; } -/** - * @brief dump_station - * @details Configure connection quality monitor RSSI threshold. - * @param[in] struct wiphy *wiphy: - * @param[in] struct net_device *dev - * @param[in] int idx - * @param[in] u8 *mac - * @param[in] struct station_info *sinfo - * @return int : Return 0 on Success - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ + static int dump_station(struct wiphy *wiphy, struct net_device *dev, int idx, u8 *mac, struct station_info *sinfo) { @@ -2487,16 +2070,6 @@ static int dump_station(struct wiphy *wiphy, struct net_device *dev, } - -/** - * @brief set_power_mgmt - * @details - * @param[in] - * @return int : Return 0 on Success. - * @author mdaftedar - * @date 01 JUL 2012 - * @version 1.0 - */ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, bool enabled, int timeout) { @@ -2521,16 +2094,6 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, } -/** - * @brief change_virtual_intf - * @details Change type/configuration of virtual interface, - * keep the struct wireless_dev's iftype updated. - * @param[in] NONE - * @return int : Return 0 on Success. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, enum nl80211_iftype type, u32 *flags, struct vif_params *params) { @@ -2553,7 +2116,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, wilc_optaining_ip = false; del_timer(&wilc_during_ip_timer); PRINT_D(GENERIC_DBG, "Changing virtual interface, enable scan\n"); - /*Set WILC_CHANGING_VIR_IF register to disallow adding futrue keys to CE H/W*/ + if (g_ptk_keys_saved && g_gtk_keys_saved) { wilc_set_machw_change_vir_if(dev, true); } @@ -2563,15 +2126,11 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, wilc_connecting = 0; PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_STATION\n"); - /* send delba over wlan interface */ - - dev->ieee80211_ptr->iftype = type; priv->wdev->iftype = type; nic->monitor_flag = 0; nic->iftype = STATION_MODE; - /*Remove the enteries of the previously connected clients*/ memset(priv->assoc_stainfo.au8Sta_AssociatedBss, 0, MAX_NUM_STA * ETH_ALEN); interface_type = nic->iftype; nic->iftype = STATION_MODE; @@ -2579,10 +2138,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, if (wl->initialized) { wilc_del_all_rx_ba_session(priv->hWILCWFIDrv, wl->vif[0].bssid, TID); - /* ensure that the message Q is empty */ wilc_wait_msg_queue_idle(); - /*Eliminate host interface blocking state*/ up(&wl->cfg_event); wilc1000_wlan_deinit(dev); @@ -2590,13 +2147,11 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, wilc_initialized = 1; nic->iftype = interface_type; - /*Setting interface 1 drv handler and mac address in newly downloaded FW*/ wilc_set_wfi_drv_handler(wl->vif[0].hif_drv); wilc_set_mac_address(wl->vif[0].hif_drv, wl->vif[0].src_addr); wilc_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE); - /*Add saved WEP keys, if any*/ if (g_wep_keys_saved) { wilc_set_wep_default_keyid(wl->vif[0].hif_drv, g_key_wep_params.key_idx); @@ -2606,11 +2161,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, g_key_wep_params.key_idx); } - /*No matter the driver handler passed here, it will be overwriiten*/ - /*in Handle_FlushConnect() with gu8FlushedJoinReqDrvHandler*/ wilc_flush_join_req(priv->hWILCWFIDrv); - /*Add saved PTK and GTK keys, if any*/ if (g_ptk_keys_saved && g_gtk_keys_saved) { PRINT_D(CFG80211_DBG, "ptk %x %x %x\n", g_key_ptk_params.key[0], g_key_ptk_params.key[1], @@ -2666,7 +2218,6 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, if (wl->initialized) { - /* ensure that the message Q is empty */ wilc_wait_msg_queue_idle(); wilc1000_wlan_deinit(dev); @@ -2678,7 +2229,6 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, wl->vif[0].src_addr); wilc_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE); - /*Add saved WEP keys, if any*/ if (g_wep_keys_saved) { wilc_set_wep_default_keyid(wl->vif[0].hif_drv, g_key_wep_params.key_idx); @@ -2688,11 +2238,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, g_key_wep_params.key_idx); } - /*No matter the driver handler passed here, it will be overwriiten*/ - /*in Handle_FlushConnect() with gu8FlushedJoinReqDrvHandler*/ wilc_flush_join_req(priv->hWILCWFIDrv); - /*Add saved PTK and GTK keys, if any*/ if (g_ptk_keys_saved && g_gtk_keys_saved) { PRINT_D(CFG80211_DBG, "ptk %x %x %x\n", g_key_ptk_params.key[0], g_key_ptk_params.key[1], @@ -2715,7 +2262,6 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, (struct key_params *)(&g_key_gtk_params)); } - /*Refresh scan, to refresh the scan results to the wpa_supplicant. Set MachHw to false to enable further key installments*/ refresh_scan(priv, 1, true); wilc_set_machw_change_vir_if(dev, false); @@ -2741,7 +2287,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, PRINT_D(HOSTAPD_DBG, "Downloading AP firmware\n"); wilc_wlan_get_firmware(dev); - /*If wilc is running, then close-open to actually get new firmware running (serves P2P)*/ + if (wl->initialized) { nic->iftype = AP_MODE; wilc_mac_close(dev); @@ -2764,10 +2310,6 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, mod_timer(&wilc_during_ip_timer, jiffies + msecs_to_jiffies(during_ip_time)); wilc_set_power_mgmt(priv->hWILCWFIDrv, 0, 0); - /*Delete block ack has to be the latest config packet*/ - /*sent before downloading new FW. This is because it blocks on*/ - /*hWaitResponse semaphore, which allows previous config*/ - /*packets to actually take action on old FW*/ wilc_del_all_rx_ba_session(priv->hWILCWFIDrv, wl->vif[0].bssid, TID); wilc_enable_ps = false; @@ -2782,20 +2324,16 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, nic->iftype = GO_MODE; - /* ensure that the message Q is empty */ wilc_wait_msg_queue_idle(); wilc1000_wlan_deinit(dev); wilc1000_wlan_init(dev, nic); wilc_initialized = 1; - - /*Setting interface 1 drv handler and mac address in newly downloaded FW*/ wilc_set_wfi_drv_handler(wl->vif[0].hif_drv); wilc_set_mac_address(wl->vif[0].hif_drv, wl->vif[0].src_addr); wilc_set_operation_mode(priv->hWILCWFIDrv, AP_MODE); - /*Add saved WEP keys, if any*/ if (g_wep_keys_saved) { wilc_set_wep_default_keyid(wl->vif[0].hif_drv, g_key_wep_params.key_idx); @@ -2805,11 +2343,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, g_key_wep_params.key_idx); } - /*No matter the driver handler passed here, it will be overwriiten*/ - /*in Handle_FlushConnect() with gu8FlushedJoinReqDrvHandler*/ wilc_flush_join_req(priv->hWILCWFIDrv); - /*Add saved PTK and GTK keys, if any*/ if (g_ptk_keys_saved && g_gtk_keys_saved) { PRINT_D(CFG80211_DBG, "ptk %x %x %x cipher %x\n", g_key_ptk_params.key[0], g_key_ptk_params.key[1], @@ -2853,32 +2388,6 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, return 0; } -/* (austin.2013-07-23) - * - * To support revised cfg80211_ops - * - * add_beacon --> start_ap - * set_beacon --> change_beacon - * del_beacon --> stop_ap - * - * beacon_parameters --> cfg80211_ap_settings - * cfg80211_beacon_data - * - * applicable for linux kernel 3.4+ - */ - -/** - * @brief start_ap - * @details Add a beacon with given parameters, @head, @interval - * and @dtim_period will be valid, @tail is optional. - * @param[in] wiphy - * @param[in] dev The net device structure - * @param[in] settings cfg80211_ap_settings parameters for the beacon to be added - * @return int : Return 0 on Success. - * @author austin - * @date 23 JUL 2013 - * @version 1.0 - */ static int start_ap(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_ap_settings *settings) { @@ -2912,18 +2421,6 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev, return s32Error; } -/** - * @brief change_beacon - * @details Add a beacon with given parameters, @head, @interval - * and @dtim_period will be valid, @tail is optional. - * @param[in] wiphy - * @param[in] dev The net device structure - * @param[in] beacon cfg80211_beacon_data for the beacon to be changed - * @return int : Return 0 on Success. - * @author austin - * @date 23 JUL 2013 - * @version 1.0 - */ static int change_beacon(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_beacon_data *beacon) { @@ -2943,15 +2440,6 @@ static int change_beacon(struct wiphy *wiphy, struct net_device *dev, return s32Error; } -/** - * @brief stop_ap - * @details Remove beacon configuration and stop sending the beacon. - * @param[in] - * @return int : Return 0 on Success. - * @author austin - * @date 23 JUL 2013 - * @version 1.0 - */ static int stop_ap(struct wiphy *wiphy, struct net_device *dev) { s32 s32Error = 0; @@ -2975,15 +2463,6 @@ static int stop_ap(struct wiphy *wiphy, struct net_device *dev) return s32Error; } -/** - * @brief add_station - * @details Add a new station. - * @param[in] - * @return int : Return 0 on Success. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ static int add_station(struct wiphy *wiphy, struct net_device *dev, const u8 *mac, struct station_parameters *params) { @@ -3055,15 +2534,6 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, return s32Error; } -/** - * @brief del_station - * @details Remove a station; @mac may be NULL to remove all stations. - * @param[in] - * @return int : Return 0 on Success. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ static int del_station(struct wiphy *wiphy, struct net_device *dev, struct station_del_parameters *params) { @@ -3097,15 +2567,6 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev, return s32Error; } -/** - * @brief change_station - * @details Modify a given station. - * @param[in] - * @return int : Return 0 on Success. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ static int change_station(struct wiphy *wiphy, struct net_device *dev, const u8 *mac, struct station_parameters *params) { @@ -3178,16 +2639,6 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, return s32Error; } - -/** - * @brief add_virtual_intf - * @details - * @param[in] - * @return int : Return 0 on Success. - * @author mdaftedar - * @date 01 JUL 2012 - * @version 1.0 - */ static struct wireless_dev *add_virtual_intf(struct wiphy *wiphy, const char *name, unsigned char name_assign_type, @@ -3222,15 +2673,6 @@ static struct wireless_dev *add_virtual_intf(struct wiphy *wiphy, return priv->wdev; } -/** - * @brief del_virtual_intf - * @details - * @param[in] - * @return int : Return 0 on Success. - * @author mdaftedar - * @date 01 JUL 2012 - * @version 1.0 - */ static int del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev) { PRINT_D(HOSTAPD_DBG, "Deleting virtual interface\n"); @@ -3275,19 +2717,6 @@ static struct cfg80211_ops wilc_cfg80211_ops = { }; - - - - -/** - * @brief WILC_WFI_update_stats - * @details Modify parameters for a given BSS. - * @param[in] - * @return int : Return 0 on Success. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed) { @@ -3319,16 +2748,6 @@ int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed) return 0; } -/** - * @brief WILC_WFI_CfgAlloc - * @details Allocation of the wireless device structure and assigning it - * to the cfg80211 operations structure. - * @param[in] NONE - * @return wireless_dev : Returns pointer to wireless_dev structure. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ static struct wireless_dev *WILC_WFI_CfgAlloc(void) { @@ -3336,14 +2755,13 @@ static struct wireless_dev *WILC_WFI_CfgAlloc(void) PRINT_D(CFG80211_DBG, "Allocating wireless device\n"); - /*Allocating the wireless device structure*/ + wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); if (!wdev) { PRINT_ER("Cannot allocate wireless device\n"); goto _fail_; } - /*Creating a new wiphy, linking wireless structure with the wiphy structure*/ wdev->wiphy = wiphy_new(&wilc_cfg80211_ops, sizeof(struct wilc_priv)); if (!wdev->wiphy) { PRINT_ER("Cannot allocate wiphy\n"); @@ -3351,14 +2769,12 @@ static struct wireless_dev *WILC_WFI_CfgAlloc(void) } - /* enable 802.11n HT */ WILC_WFI_band_2ghz.ht_cap.ht_supported = 1; WILC_WFI_band_2ghz.ht_cap.cap |= (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT); WILC_WFI_band_2ghz.ht_cap.mcs.rx_mask[0] = 0xff; WILC_WFI_band_2ghz.ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_8K; WILC_WFI_band_2ghz.ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE; - /*wiphy bands*/ wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &WILC_WFI_band_2ghz; return wdev; @@ -3369,15 +2785,7 @@ _fail_: return NULL; } -/** - * @brief wilc_create_wiphy - * @details Registering of the wiphy structure and interface modes - * @param[in] NONE - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ + struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *dev) { struct wilc_priv *priv; @@ -3392,33 +2800,20 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *de return NULL; } - - /*Return hardware description structure (wiphy)'s priv*/ priv = wdev_priv(wdev); sema_init(&(priv->SemHandleUpdateStats), 1); - - /*Link the wiphy with wireless structure*/ priv->wdev = wdev; - - /*Maximum number of probed ssid to be added by user for the scan request*/ wdev->wiphy->max_scan_ssids = MAX_NUM_PROBED_SSID; - /*Maximum number of pmkids to be cashed*/ wdev->wiphy->max_num_pmkids = WILC_MAX_NUM_PMKIDS; PRINT_INFO(CFG80211_DBG, "Max number of PMKIDs = %d\n", wdev->wiphy->max_num_pmkids); wdev->wiphy->max_scan_ie_len = 1000; - - /*signal strength in mBm (100*dBm) */ wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; - - /*Set the availaible cipher suites*/ wdev->wiphy->cipher_suites = cipher_suites; wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); - /*Setting default managment types: for register action frame: */ wdev->wiphy->mgmt_stypes = wilc_wfi_cfg80211_mgmt_types; wdev->wiphy->max_remain_on_channel_duration = 500; - /*Setting the wiphy interfcae mode and type before registering the wiphy*/ wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_AP) | BIT(NL80211_IFTYPE_MONITOR) | BIT(NL80211_IFTYPE_P2P_GO) | BIT(NL80211_IFTYPE_P2P_CLIENT); wdev->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; @@ -3432,11 +2827,9 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *de set_wiphy_dev(wdev->wiphy, dev); - /*Register wiphy structure*/ s32Error = wiphy_register(wdev->wiphy); if (s32Error) { PRINT_ER("Cannot register wiphy device\n"); - /*should define what action to be taken in such failure*/ } else { PRINT_D(CFG80211_DBG, "Successful Registering\n"); } @@ -3446,15 +2839,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *de } -/** - * @brief WILC_WFI_WiphyFree - * @details Freeing allocation of the wireless device structure - * @param[in] NONE - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ + int wilc_init_host_int(struct net_device *net) { @@ -3486,15 +2871,6 @@ int wilc_init_host_int(struct net_device *net) return s32Error; } -/** - * @brief WILC_WFI_WiphyFree - * @details Freeing allocation of the wireless device structure - * @param[in] NONE - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ int wilc_deinit_host_int(struct net_device *net) { int s32Error = 0; @@ -3511,7 +2887,6 @@ int wilc_deinit_host_int(struct net_device *net) s32Error = wilc_deinit(priv->hWILCWFIDrv); - /* Clear the Shadow scan */ clear_shadow_scan(); if (op_ifcs == 0) { PRINT_D(CORECONFIG_DBG, "destroy during ip\n"); @@ -3524,16 +2899,6 @@ int wilc_deinit_host_int(struct net_device *net) return s32Error; } - -/** - * @brief WILC_WFI_WiphyFree - * @details Freeing allocation of the wireless device structure - * @param[in] NONE - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ void wilc_free_wiphy(struct net_device *net) { PRINT_D(CFG80211_DBG, "Unregistering wiphy\n"); From da537229b6d324dba7788070afb0a64c1af468e5 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Wed, 25 Nov 2015 11:59:42 +0900 Subject: [PATCH 598/843] staging: wilc1000: fixes blank lines aren't necessary brace This patch fixes the checks reported by checkpatch.pl for Blank lines aren't necessary after an open brace '{' and Blank lines aren't necessary before a close brace '}'. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 50 ------------------- 1 file changed, 50 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index bfef022c315b..71038b1c202d 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -201,7 +201,6 @@ static void clear_shadow_scan(void) } last_scanned_cnt = 0; } - } static u32 get_rssi_avg(tstrNetworkInfo *network_info) @@ -250,10 +249,8 @@ static void refresh_scan(void *user_void, u8 all, bool direct_scan) cfg80211_put_bss(wiphy, bss); } } - } } - } static void reset_shadow_found(void) @@ -347,7 +344,6 @@ static void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, if (ap_found == -1) { ap_index = last_scanned_cnt; last_scanned_cnt++; - } else { ap_index = ap_found; } @@ -590,9 +586,7 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, cfg80211_disconnected(dev, pstrDisconnectNotifInfo->u16reason, pstrDisconnectNotifInfo->ie, pstrDisconnectNotifInfo->ie_len, false, GFP_KERNEL); - } - } static int set_channel(struct wiphy *wiphy, @@ -646,14 +640,11 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) PRINT_D(CFG80211_DBG, "Number of SSIDs %d\n", request->n_ssids); if (request->n_ssids >= 1) { - - strHiddenNetwork.pstrHiddenNetworkInfo = kmalloc(request->n_ssids * sizeof(struct hidden_network), GFP_KERNEL); strHiddenNetwork.u8ssidnum = request->n_ssids; for (i = 0; i < request->n_ssids; i++) { - if (request->ssids[i].ssid != NULL && request->ssids[i].ssid_len != 0) { strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid = kmalloc(request->ssids[i].ssid_len, GFP_KERNEL); memcpy(strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, request->ssids[i].ssid, request->ssids[i].ssid_len); @@ -675,7 +666,6 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) (const u8 *)request->ie, request->ie_len, CfgScanResult, (void *)priv, NULL); } - } else { PRINT_ER("Requested num of scanned channels is greater than the max, supported" " channels\n"); @@ -835,7 +825,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, u8security = ENCRYPT_ENABLED | WPA | AES; pcgroup_encrypt_val = "WPA_AES"; pccipher_group = "AES"; - } pcwpa_version = "WPA_VERSION_1"; @@ -845,7 +834,6 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, goto done; } - } if ((sme->crypto.wpa_versions & NL80211_WPA_VERSION_1) @@ -982,7 +970,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, case WLAN_CIPHER_SUITE_WEP40: case WLAN_CIPHER_SUITE_WEP104: if (priv->wdev->iftype == NL80211_IFTYPE_AP) { - priv->WILC_WFI_wep_default = key_index; priv->WILC_WFI_wep_key_len[key_index] = params->key_len; memcpy(priv->WILC_WFI_wep_key[key_index], params->key, params->key_len); @@ -1022,12 +1009,10 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, case WLAN_CIPHER_SUITE_TKIP: case WLAN_CIPHER_SUITE_CCMP: if (priv->wdev->iftype == NL80211_IFTYPE_AP || priv->wdev->iftype == NL80211_IFTYPE_P2P_GO) { - if (priv->wilc_gtk[key_index] == NULL) { priv->wilc_gtk[key_index] = kmalloc(sizeof(struct wilc_wfi_key), GFP_KERNEL); priv->wilc_gtk[key_index]->key = NULL; priv->wilc_gtk[key_index]->seq = NULL; - } if (priv->wilc_ptk[key_index] == NULL) { priv->wilc_ptk[key_index] = kmalloc(sizeof(struct wilc_wfi_key), GFP_KERNEL); @@ -1046,7 +1031,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, priv->wilc_groupkey = u8gmode; if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) { - pu8TxMic = params->key + 24; pu8RxMic = params->key + 16; KeyLen = params->key_len - 16; @@ -1087,7 +1071,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) { - pu8TxMic = params->key + 24; pu8RxMic = params->key + 16; KeyLen = params->key_len - 16; @@ -1207,7 +1190,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, default: PRINT_ER("Not supported cipher: Error(%d)\n", s32Error); s32Error = -ENOTSUPP; - } return s32Error; @@ -1235,7 +1217,6 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev, g_key_wep_params.key = NULL; if ((priv->wilc_gtk[key_index]) != NULL) { - kfree(priv->wilc_gtk[key_index]->key); priv->wilc_gtk[key_index]->key = NULL; kfree(priv->wilc_gtk[key_index]->seq); @@ -1243,11 +1224,9 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev, kfree(priv->wilc_gtk[key_index]); priv->wilc_gtk[key_index] = NULL; - } if ((priv->wilc_ptk[key_index]) != NULL) { - kfree(priv->wilc_ptk[key_index]->key); priv->wilc_ptk[key_index]->key = NULL; kfree(priv->wilc_ptk[key_index]->seq); @@ -1332,7 +1311,6 @@ static int set_default_key(struct wiphy *wiphy, struct net_device *netdev, u8 ke PRINT_D(CFG80211_DBG, "Setting default key with idx = %d\n", key_index); if (key_index != priv->WILC_WFI_wep_default) { - wilc_set_wep_default_keyid(priv->hWILCWFIDrv, key_index); } @@ -1356,12 +1334,10 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, PRINT_INFO(HOSTAPD_DBG, ": %x%x%x%x%x\n", mac[0], mac[1], mac[2], mac[3], mac[4]); for (i = 0; i < NUM_STA_ASSOCIATED; i++) { - if (!(memcmp(mac, priv->assoc_stainfo.au8Sta_AssociatedBss[i], ETH_ALEN))) { associatedsta = i; break; } - } if (associatedsta == -1) { @@ -1374,7 +1350,6 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, wilc_get_inactive_time(priv->hWILCWFIDrv, mac, &(inactive_time)); sinfo->inactive_time = 1000 * inactive_time; PRINT_D(CFG80211_DBG, "Inactive time %d\n", sinfo->inactive_time); - } if (nic->iftype == STATION_MODE) { @@ -1431,17 +1406,14 @@ static int set_wiphy_params(struct wiphy *wiphy, u32 changed) pstrCfgParamVal.short_retry_limit = priv->dev->ieee80211_ptr->wiphy->retry_short; } if (changed & WIPHY_PARAM_RETRY_LONG) { - PRINT_D(CFG80211_DBG, "Setting WIPHY_PARAM_RETRY_LONG %d\n", priv->dev->ieee80211_ptr->wiphy->retry_long); pstrCfgParamVal.flag |= RETRY_LONG; pstrCfgParamVal.long_retry_limit = priv->dev->ieee80211_ptr->wiphy->retry_long; - } if (changed & WIPHY_PARAM_FRAG_THRESHOLD) { PRINT_D(CFG80211_DBG, "Setting WIPHY_PARAM_FRAG_THRESHOLD %d\n", priv->dev->ieee80211_ptr->wiphy->frag_threshold); pstrCfgParamVal.flag |= FRAG_THRESHOLD; pstrCfgParamVal.frag_threshold = priv->dev->ieee80211_ptr->wiphy->frag_threshold; - } if (changed & WIPHY_PARAM_RTS_THRESHOLD) { @@ -1449,7 +1421,6 @@ static int set_wiphy_params(struct wiphy *wiphy, u32 changed) pstrCfgParamVal.flag |= RTS_THRESHOLD; pstrCfgParamVal.rts_threshold = priv->dev->ieee80211_ptr->wiphy->rts_threshold; - } PRINT_D(CFG80211_DBG, "Setting CFG params in the host interface\n"); @@ -1504,7 +1475,6 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev, static int del_pmksa(struct wiphy *wiphy, struct net_device *netdev, struct cfg80211_pmksa *pmksa) { - u32 i; s32 s32Error = 0; @@ -1633,7 +1603,6 @@ static void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftyp void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size) { - struct wilc_priv *priv; u32 header, pkt_offset; struct host_if_drv *pstrWFIDrv; @@ -1665,7 +1634,6 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size) return; } } else { - PRINT_D(GENERIC_DBG, "Rx Frame Type:%x\n", buff[FRAME_TYPE_ID]); s32Freq = ieee80211_channel_to_frequency(curr_channel, IEEE80211_BAND_2GHZ); @@ -1678,7 +1646,6 @@ void WILC_WFI_p2p_rx (struct net_device *dev, u8 *buff, u32 size) return; } if (buff[ACTION_CAT_ID] == PUB_ACTION_ATTR_ID) { - switch (buff[ACTION_SUBTYPE_ID]) { case GAS_INTIAL_REQ: PRINT_D(GENERIC_DBG, "GAS INITIAL REQ %x\n", buff[ACTION_SUBTYPE_ID]); @@ -1952,7 +1919,6 @@ static int mgmt_tx(struct wiphy *wiphy, break; } } - } PRINT_D(GENERIC_DBG, "TX: ACTION FRAME Type:%x : Chan:%d\n", buf[ACTION_SUBTYPE_ID], chan->hw_value); @@ -1998,7 +1964,6 @@ static int mgmt_tx_cancel_wait(struct wiphy *wiphy, void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev, u16 frame_type, bool reg) { - struct wilc_priv *priv; perInterface_wlan_t *nic; struct wilc *wl; @@ -2030,7 +1995,6 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev, { break; } - } if (!wl->initialized) { @@ -2038,8 +2002,6 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev, return; } wilc_frame_register(priv->hWILCWFIDrv, frame_type, reg); - - } static int set_cqm_rssi_config(struct wiphy *wiphy, struct net_device *dev, @@ -2047,7 +2009,6 @@ static int set_cqm_rssi_config(struct wiphy *wiphy, struct net_device *dev, { PRINT_D(CFG80211_DBG, "Setting CQM RSSi Function\n"); return 0; - } static int dump_station(struct wiphy *wiphy, struct net_device *dev, @@ -2067,7 +2028,6 @@ static int dump_station(struct wiphy *wiphy, struct net_device *dev, wilc_get_rssi(priv->hWILCWFIDrv, &(sinfo->signal)); return 0; - } static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, @@ -2091,7 +2051,6 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, return 0; - } static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, @@ -2680,7 +2639,6 @@ static int del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev) } static struct cfg80211_ops wilc_cfg80211_ops = { - .set_monitor_channel = set_channel, .scan = scan, .connect = connect, @@ -2719,12 +2677,10 @@ static struct cfg80211_ops wilc_cfg80211_ops = { int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed) { - struct wilc_priv *priv; priv = wiphy_priv(wiphy); switch (changed) { - case WILC_WFI_RX_PKT: { priv->netstats.rx_packets++; @@ -2750,7 +2706,6 @@ int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed) static struct wireless_dev *WILC_WFI_CfgAlloc(void) { - struct wireless_dev *wdev; @@ -2766,7 +2721,6 @@ static struct wireless_dev *WILC_WFI_CfgAlloc(void) if (!wdev->wiphy) { PRINT_ER("Cannot allocate wiphy\n"); goto _fail_mem_; - } WILC_WFI_band_2ghz.ht_cap.ht_supported = 1; @@ -2783,7 +2737,6 @@ _fail_mem_: kfree(wdev); _fail_: return NULL; - } struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *dev) @@ -2836,13 +2789,10 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *de priv->dev = net; return wdev; - - } int wilc_init_host_int(struct net_device *net) { - int s32Error = 0; struct wilc_priv *priv; From b0b9f3e4d24baa62dda7cd48284fd2842164974f Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Wed, 25 Nov 2015 11:59:47 +0900 Subject: [PATCH 599/843] staging: wilc1000: Handle_AddBASession: remove unused function This patch removes unused a function Handle_AddBASession. And, removes the relation define. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 69 ----------------------- 1 file changed, 69 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 900b7ca2870f..e6c4ce5b3178 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -43,7 +43,6 @@ #define HOST_IF_MSG_FLUSH_CONNECT 30 #define HOST_IF_MSG_GET_STATISTICS 31 #define HOST_IF_MSG_SET_MULTICAST_FILTER 32 -#define HOST_IF_MSG_ADD_BA_SESSION 33 #define HOST_IF_MSG_DEL_BA_SESSION 34 #define HOST_IF_MSG_Q_IDLE 35 #define HOST_IF_MSG_DEL_ALL_STA 36 @@ -2739,70 +2738,6 @@ ERRORHANDLER: kfree(wid.val); } -static s32 Handle_AddBASession(struct host_if_drv *hif_drv, - struct ba_session_info *strHostIfBASessionInfo) -{ - s32 result = 0; - struct wid wid; - int AddbaTimeout = 100; - char *ptr = NULL; - - PRINT_D(HOSTINF_DBG, "Opening Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\nBufferSize == %d\nSessionTimeOut = %d\n", - strHostIfBASessionInfo->bssid[0], - strHostIfBASessionInfo->bssid[1], - strHostIfBASessionInfo->bssid[2], - strHostIfBASessionInfo->buf_size, - strHostIfBASessionInfo->time_out, - strHostIfBASessionInfo->tid); - - wid.id = (u16)WID_11E_P_ACTION_REQ; - wid.type = WID_STR; - wid.val = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); - wid.size = BLOCK_ACK_REQ_SIZE; - ptr = wid.val; - *ptr++ = 0x14; - *ptr++ = 0x3; - *ptr++ = 0x0; - memcpy(ptr, strHostIfBASessionInfo->bssid, ETH_ALEN); - ptr += ETH_ALEN; - *ptr++ = strHostIfBASessionInfo->tid; - *ptr++ = 1; - *ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF); - *ptr++ = ((strHostIfBASessionInfo->buf_size >> 16) & 0xFF); - *ptr++ = (strHostIfBASessionInfo->time_out & 0xFF); - *ptr++ = ((strHostIfBASessionInfo->time_out >> 16) & 0xFF); - *ptr++ = (AddbaTimeout & 0xFF); - *ptr++ = ((AddbaTimeout >> 16) & 0xFF); - *ptr++ = 8; - *ptr++ = 0; - - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); - if (result) - PRINT_D(HOSTINF_DBG, "Couldn't open BA Session\n"); - - wid.id = (u16)WID_11E_P_ACTION_REQ; - wid.type = WID_STR; - wid.size = 15; - ptr = wid.val; - *ptr++ = 15; - *ptr++ = 7; - *ptr++ = 0x2; - memcpy(ptr, strHostIfBASessionInfo->bssid, ETH_ALEN); - ptr += ETH_ALEN; - *ptr++ = strHostIfBASessionInfo->tid; - *ptr++ = 8; - *ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF); - *ptr++ = ((strHostIfBASessionInfo->time_out >> 16) & 0xFF); - *ptr++ = 3; - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); - - kfree(wid.val); - - return result; -} - static s32 Handle_DelAllRxBASessions(struct host_if_drv *hif_drv, struct ba_session_info *strHostIfBASessionInfo) { @@ -3033,10 +2968,6 @@ static int hostIFthread(void *pvArg) Handle_SetMulticastFilter(msg.drv, &msg.body.multicast_info); break; - case HOST_IF_MSG_ADD_BA_SESSION: - Handle_AddBASession(msg.drv, &msg.body.session_info); - break; - case HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS: Handle_DelAllRxBASessions(msg.drv, &msg.body.session_info); break; From 9edaa5f3c28e529c98fcb26035630fa64d140ffb Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Wed, 25 Nov 2015 11:59:48 +0900 Subject: [PATCH 600/843] staging: wilc1000: change if with else if The if statement should be else if since it is part of whole if condition. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index e6c4ce5b3178..2408858c8a4c 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1764,9 +1764,7 @@ static int Handle_Key(struct host_if_drv *hif_drv, strWIDList, 4, get_id_from_handler(hif_drv)); kfree(pu8keybuf); - } - - if (pstrHostIFkeyAttr->action & ADDKEY) { + } else if (pstrHostIFkeyAttr->action & ADDKEY) { PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); pu8keybuf = kmalloc(pstrHostIFkeyAttr->attr.wep.key_len + 2, GFP_KERNEL); if (!pu8keybuf) { @@ -1848,9 +1846,7 @@ static int Handle_Key(struct host_if_drv *hif_drv, kfree(pu8keybuf); up(&hif_drv->sem_test_key_block); - } - - if (pstrHostIFkeyAttr->action & ADDKEY) { + } else if (pstrHostIFkeyAttr->action & ADDKEY) { PRINT_D(HOSTINF_DBG, "Handling group key(Rx) function\n"); pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); @@ -1921,8 +1917,7 @@ _WPARxGtk_end_case_: get_id_from_handler(hif_drv)); kfree(pu8keybuf); up(&hif_drv->sem_test_key_block); - } - if (pstrHostIFkeyAttr->action & ADDKEY) { + } else if (pstrHostIFkeyAttr->action & ADDKEY) { pu8keybuf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL); if (!pu8keybuf) { PRINT_ER("No buffer to send PTK Key\n"); From c8751ad7d22459b973b26c5bd37b444cf77d6412 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Wed, 25 Nov 2015 11:59:49 +0900 Subject: [PATCH 601/843] staging: wilc1000: Handle_SetMulticastFilter(): fixes right shifting more than type allows This patch fixes the warning reported by smatch. - Handle_SetMulticastFilter() warn: right shifting more than type allows That is unnecessary action of boolean type. just assign 0. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 2408858c8a4c..772d524bc2b4 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2711,9 +2711,9 @@ static void Handle_SetMulticastFilter(struct host_if_drv *hif_drv, pu8CurrByte = wid.val; *pu8CurrByte++ = (strHostIfSetMulti->enabled & 0xFF); - *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 8) & 0xFF); - *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 16) & 0xFF); - *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 24) & 0xFF); + *pu8CurrByte++ = 0; + *pu8CurrByte++ = 0; + *pu8CurrByte++ = 0; *pu8CurrByte++ = (strHostIfSetMulti->cnt & 0xFF); *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 8) & 0xFF); From cc28e4bf6e5279728c4b03497e95b9a5f5054f9c Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Fri, 18 Dec 2015 18:26:02 +0900 Subject: [PATCH 602/843] staging: wilc1000: fix a bug when unload driver kernel crashes when load and unload driver several times. I used git bisect to track down and found that removing NULL setting caused the panic. This reverts only related codes of the patch(a4ab1ade75a3). Fixes: a4ab1ade75a3 ("staging: wilc1000: replace drvHandler and hWFIDrv with hif_drv") Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 772d524bc2b4..36303c310c2c 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1385,9 +1385,12 @@ static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv) hif_drv->usr_conn_req.ssid_len = 0; kfree(hif_drv->usr_conn_req.pu8ssid); + hif_drv->usr_conn_req.pu8ssid = NULL; kfree(hif_drv->usr_conn_req.pu8bssid); + hif_drv->usr_conn_req.pu8bssid = NULL; hif_drv->usr_conn_req.ies_len = 0; kfree(hif_drv->usr_conn_req.ies); + hif_drv->usr_conn_req.ies = NULL; eth_zero_addr(wilc_connected_ssid); @@ -1641,9 +1644,12 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, strConnectInfo.pu8ReqIEs = NULL; hif_drv->usr_conn_req.ssid_len = 0; kfree(hif_drv->usr_conn_req.pu8ssid); + hif_drv->usr_conn_req.pu8ssid = NULL; kfree(hif_drv->usr_conn_req.pu8bssid); + hif_drv->usr_conn_req.pu8bssid = NULL; hif_drv->usr_conn_req.ies_len = 0; kfree(hif_drv->usr_conn_req.ies); + hif_drv->usr_conn_req.ies = NULL; } else if ((u8MacStatus == MAC_DISCONNECTED) && (hif_drv->hif_state == HOST_IF_CONNECTED)) { PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW\n"); @@ -1677,9 +1683,12 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, hif_drv->usr_conn_req.ssid_len = 0; kfree(hif_drv->usr_conn_req.pu8ssid); + hif_drv->usr_conn_req.pu8ssid = NULL; kfree(hif_drv->usr_conn_req.pu8bssid); + hif_drv->usr_conn_req.pu8bssid = NULL; hif_drv->usr_conn_req.ies_len = 0; kfree(hif_drv->usr_conn_req.ies); + hif_drv->usr_conn_req.ies = NULL; if (join_req && join_req_drv == hif_drv) { kfree(join_req); @@ -2049,9 +2058,12 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv) hif_drv->usr_conn_req.ssid_len = 0; kfree(hif_drv->usr_conn_req.pu8ssid); + hif_drv->usr_conn_req.pu8ssid = NULL; kfree(hif_drv->usr_conn_req.pu8bssid); + hif_drv->usr_conn_req.pu8bssid = NULL; hif_drv->usr_conn_req.ies_len = 0; kfree(hif_drv->usr_conn_req.ies); + hif_drv->usr_conn_req.ies = NULL; if (join_req && join_req_drv == hif_drv) { kfree(join_req); From ff5d40a4d3b6319cbc4ac9b454205cf662eb42b1 Mon Sep 17 00:00:00 2001 From: Chandra S Gorentla Date: Sun, 15 Nov 2015 09:36:58 +0530 Subject: [PATCH 603/843] staging: wilc1000: Remove 'if' statement, which is always false - 'if' which is always false is removed - variable associated with this 'if' is deleted Signed-off-by: Chandra S Gorentla Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_msgqueue.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c b/drivers/staging/wilc1000/wilc_msgqueue.c index 0eff121b8291..098390cdf319 100644 --- a/drivers/staging/wilc1000/wilc_msgqueue.c +++ b/drivers/staging/wilc1000/wilc_msgqueue.c @@ -115,7 +115,6 @@ int wilc_mq_recv(WILC_MsgQueueHandle *pHandle, u32 *pu32ReceivedLength) { Message *pstrMessage; - int result = 0; unsigned long flags; if ((!pHandle) || (u32RecvBufferSize == 0) @@ -135,12 +134,6 @@ int wilc_mq_recv(WILC_MsgQueueHandle *pHandle, down(&pHandle->hSem); - /* other non-timeout scenarios */ - if (result) { - PRINT_ER("Non-timeout\n"); - return result; - } - if (pHandle->bExiting) { PRINT_ER("pHandle fail\n"); return -EFAULT; @@ -174,5 +167,5 @@ int wilc_mq_recv(WILC_MsgQueueHandle *pHandle, spin_unlock_irqrestore(&pHandle->strCriticalSection, flags); - return result; + return 0; } From f6e0e2a5649d56d308212583a8ca1b9d7a26c64c Mon Sep 17 00:00:00 2001 From: Bogicevic Sasa Date: Wed, 18 Nov 2015 12:45:05 +0100 Subject: [PATCH 604/843] drivers:staging:wilc1000 Fix all comparison to NULL could be written ... This fixes all "comparison to NULL could be written like ..." Signed-off-by: Bogicevic Sasa Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 329477ab5adc..2d4d3f190c01 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -436,7 +436,7 @@ s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo /* Get DTIM Period */ pu8TimElm = get_tim_elm(pu8msa, u16RxLen + FCS_LEN, u8index); - if (pu8TimElm != NULL) + if (pu8TimElm) pstrNetworkInfo->u8DtimPeriod = pu8TimElm[3]; pu8IEs = &pu8msa[MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN]; u16IEsLen = u16RxLen - (MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN); @@ -470,8 +470,8 @@ s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo) { s32 s32Error = 0; - if (pstrNetworkInfo != NULL) { - if (pstrNetworkInfo->pu8IEs != NULL) { + if (pstrNetworkInfo) { + if (pstrNetworkInfo->pu8IEs) { kfree(pstrNetworkInfo->pu8IEs); pstrNetworkInfo->pu8IEs = NULL; } else { @@ -555,8 +555,8 @@ s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo) { s32 s32Error = 0; - if (pstrConnectRespInfo != NULL) { - if (pstrConnectRespInfo->pu8RespIEs != NULL) { + if (pstrConnectRespInfo) { + if (pstrConnectRespInfo->pu8RespIEs) { kfree(pstrConnectRespInfo->pu8RespIEs); pstrConnectRespInfo->pu8RespIEs = NULL; } else { From 6b05fcc9c6ec08f4bd53e585afe4ec2f2f5b4ffb Mon Sep 17 00:00:00 2001 From: Masanari Iida Date: Mon, 23 Nov 2015 22:41:17 +0900 Subject: [PATCH 605/843] staging: wilc1000: Fix typo in wilc_msgqueue.h This patch fix some spelling typo in wilc_msgqueue.h Signed-off-by: Masanari Iida Acked-by: Randy Dunlap Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_msgqueue.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_msgqueue.h b/drivers/staging/wilc1000/wilc_msgqueue.h index d231c334ed93..d7e0328bacee 100644 --- a/drivers/staging/wilc1000/wilc_msgqueue.h +++ b/drivers/staging/wilc1000/wilc_msgqueue.h @@ -35,7 +35,7 @@ typedef struct __MessageQueue_struct { * any other message queue having the same name in the system * @param[in,out] pHandle handle to the message queue object * @param[in] pstrAttrs Optional attributes, NULL for default - * @return Error code indicating sucess/failure + * @return Error code indicating success/failure * @author syounan * @date 30 Aug 2010 * @version 1.0 @@ -44,7 +44,7 @@ int wilc_mq_create(WILC_MsgQueueHandle *pHandle); /*! * @brief Sends a message - * @details Sends a message, this API will block unil the message is + * @details Sends a message, this API will block until the message is * actually sent or until it is timedout (as long as the feature * CONFIG_WILC_MSG_QUEUE_TIMEOUT is enabled and pstrAttrs->u32Timeout * is not set to WILC_OS_INFINITY), zero timeout is a valid value @@ -52,7 +52,7 @@ int wilc_mq_create(WILC_MsgQueueHandle *pHandle); * @param[in] pvSendBuffer pointer to the data to send * @param[in] u32SendBufferSize the size of the data to send * @param[in] pstrAttrs Optional attributes, NULL for default - * @return Error code indicating sucess/failure + * @return Error code indicating success/failure * @author syounan * @date 30 Aug 2010 * @version 1.0 @@ -62,7 +62,7 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle, /*! * @brief Receives a message - * @details Receives a message, this API will block unil a message is + * @details Receives a message, this API will block until a message is * received or until it is timedout (as long as the feature * CONFIG_WILC_MSG_QUEUE_TIMEOUT is enabled and pstrAttrs->u32Timeout * is not set to WILC_OS_INFINITY), zero timeout is a valid value @@ -71,7 +71,7 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle, * @param[in] u32RecvBufferSize the size of the receive buffer * @param[out] pu32ReceivedLength the length of received data * @param[in] pstrAttrs Optional attributes, NULL for default - * @return Error code indicating sucess/failure + * @return Error code indicating success/failure * @author syounan * @date 30 Aug 2010 * @version 1.0 @@ -84,7 +84,7 @@ int wilc_mq_recv(WILC_MsgQueueHandle *pHandle, * @brief Destroys an existing Message queue * @param[in] pHandle handle to the message queue object * @param[in] pstrAttrs Optional attributes, NULL for default - * @return Error code indicating sucess/failure + * @return Error code indicating success/failure * @author syounan * @date 30 Aug 2010 * @version 1.0 From 7cf8e59e54b322a1663a3e2beaab8324240e1801 Mon Sep 17 00:00:00 2001 From: "Mario J. Rugiero" Date: Thu, 3 Dec 2015 13:24:05 -0300 Subject: [PATCH 606/843] staging: wilc1000: replace 'ptr > 0' check by 'ptr' check. This silences a sparse warning about incompatible comparisons, while making the intent of the check a bit clearer. Signed-off-by: Mario J. Rugiero Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 36303c310c2c..d1707f6f0dcc 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2292,7 +2292,7 @@ static void Handle_AddBeacon(struct host_if_drv *hif_drv, *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 16) & 0xFF); *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 24) & 0xFF); - if (pstrSetBeaconParam->tail > 0) + if (pstrSetBeaconParam->tail) memcpy(pu8CurrByte, pstrSetBeaconParam->tail, pstrSetBeaconParam->tail_len); pu8CurrByte += pstrSetBeaconParam->tail_len; From 14b93bb6bbf08c5002eddda1af1916e72e542eb8 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 12:39:26 -0700 Subject: [PATCH 607/843] staging: comedi: adv_pci_dio: separate out PCI-1760 support The PCI-1760 is board unique. It uses an outgoing/incoming mailbox programming sequence to access the hardware. The other boards supported by this driver use simple register mapping. Including support for the PCI-1760 in this driver just makes it harder to understand. Separate out the PCI-1760 support into a new driver, adv_pci1760. Clean up the new driver. The original code had a bunch of CamelCase and other checkpatch.pl issues. The code used to access the outgoing/incoming mailboxes was also a bit awkward with the passing of the arrays for the outgoing and incoming mailbox bytes. Replace them with two new functions that send a command and return the feedback data from the command based on the programming flow chart in the datasheet for the PCI-1760. The new adv_pci1760 driver also fixes the incomplete timer subdevice. This subdevice is actually the 2 PWM outputs so the subdevice type has been changed to COMEDI_SUBD_PWM. The counter subdevice support was not complete in the original code. They are also a bit strange since they are up counters connected to each of the digital inputs. For now that subdevice has been disabled (COMEDI_SUBD_UNUSED). Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 12 +- drivers/staging/comedi/drivers/Makefile | 1 + drivers/staging/comedi/drivers/adv_pci1760.c | 432 +++++++++++++++++++ drivers/staging/comedi/drivers/adv_pci_dio.c | 426 +----------------- 4 files changed, 445 insertions(+), 426 deletions(-) create mode 100644 drivers/staging/comedi/drivers/adv_pci1760.c diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 945c85a10793..e7255f811611 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -772,6 +772,14 @@ config COMEDI_ADV_PCI1724 To compile this driver as a module, choose M here: the module will be called adv_pci1724. +config COMEDI_ADV_PCI1760 + tristate "Advantech PCI-1760 support" + ---help--- + Enable support for Advantech PCI-1760 board. + + To compile this driver as a module, choose M here: the module will be + called adv_pci1760. + config COMEDI_ADV_PCI_DIO tristate "Advantech PCI DIO card support" select COMEDI_8254 @@ -779,8 +787,8 @@ config COMEDI_ADV_PCI_DIO ---help--- Enable support for Advantech PCI DIO cards PCI-1730, PCI-1733, PCI-1734, PCI-1735U, PCI-1736UP, PCI-1739U, - PCI-1750, PCI-1751, PCI-1752, PCI-1753/E, PCI-1754, PCI-1756, - PCI-1760 and PCI-1762 + PCI-1750, PCI-1751, PCI-1752, PCI-1753/E, PCI-1754, PCI-1756 and + PCI-1762 To compile this driver as a module, choose M here: the module will be called adv_pci_dio. diff --git a/drivers/staging/comedi/drivers/Makefile b/drivers/staging/comedi/drivers/Makefile index 94c179bea71e..0c8cfa738727 100644 --- a/drivers/staging/comedi/drivers/Makefile +++ b/drivers/staging/comedi/drivers/Makefile @@ -81,6 +81,7 @@ obj-$(CONFIG_COMEDI_ADV_PCI1710) += adv_pci1710.o obj-$(CONFIG_COMEDI_ADV_PCI1720) += adv_pci1720.o obj-$(CONFIG_COMEDI_ADV_PCI1723) += adv_pci1723.o obj-$(CONFIG_COMEDI_ADV_PCI1724) += adv_pci1724.o +obj-$(CONFIG_COMEDI_ADV_PCI1760) += adv_pci1760.o obj-$(CONFIG_COMEDI_ADV_PCI_DIO) += adv_pci_dio.o obj-$(CONFIG_COMEDI_AMPLC_DIO200_PCI) += amplc_dio200_pci.o obj-$(CONFIG_COMEDI_AMPLC_PC236_PCI) += amplc_pci236.o diff --git a/drivers/staging/comedi/drivers/adv_pci1760.c b/drivers/staging/comedi/drivers/adv_pci1760.c new file mode 100644 index 000000000000..d7dd1e55e347 --- /dev/null +++ b/drivers/staging/comedi/drivers/adv_pci1760.c @@ -0,0 +1,432 @@ +/* + * COMEDI driver for the Advantech PCI-1760 + * Copyright (C) 2015 H Hartley Sweeten + * + * Based on the pci1760 support in the adv_pci_dio driver written by: + * Michal Dobes + * + * COMEDI - Linux Control and Measurement Device Interface + * Copyright (C) 2000 David A. Schleef + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/* + * Driver: adv_pci1760 + * Description: Advantech PCI-1760 Relay & Isolated Digital Input Card + * Devices: [Advantech] PCI-1760 (adv_pci1760) + * Author: H Hartley Sweeten + * Updated: Fri, 13 Nov 2015 12:34:00 -0700 + * Status: untested + * + * Configuration Options: not applicable, uses PCI auto config + */ + +#include + +#include "../comedi_pci.h" + +/* + * PCI-1760 Register Map + * + * Outgoing Mailbox Bytes + * OMB3: Not used (must be 0) + * OMB2: The command code to the PCI-1760 + * OMB1: The hi byte of the parameter for the command in OMB2 + * OMB0: The lo byte of the parameter for the command in OMB2 + * + * Incoming Mailbox Bytes + * IMB3: The Isolated Digital Input status (updated every 100us) + * IMB2: The current command (matches OMB2 when command is successful) + * IMB1: The hi byte of the feedback data for the command in OMB2 + * IMB0: The lo byte of the feedback data for the command in OMB2 + * + * Interrupt Control/Status + * INTCSR3: Not used (must be 0) + * INTCSR2: The interrupt status (read only) + * INTCSR1: Interrupt enable/disable + * INTCSR0: Not used (must be 0) + */ +#define PCI1760_OMB_REG(x) (0x0c + (x)) +#define PCI1760_IMB_REG(x) (0x1c + (x)) +#define PCI1760_INTCSR_REG(x) (0x38 + (x)) +#define PCI1760_INTCSR1_IRQ_ENA BIT(5) +#define PCI1760_INTCSR2_OMB_IRQ BIT(0) +#define PCI1760_INTCSR2_IMB_IRQ BIT(1) +#define PCI1760_INTCSR2_IRQ_STATUS BIT(6) +#define PCI1760_INTCSR2_IRQ_ASSERTED BIT(7) + +/* PCI-1760 command codes */ +#define PCI1760_CMD_CLR_IMB2 0x00 /* Clears IMB2 */ +#define PCI1760_CMD_SET_DO 0x01 /* Set output state */ +#define PCI1760_CMD_GET_DO 0x02 /* Read output status */ +#define PCI1760_CMD_GET_STATUS 0x03 /* Read current status */ +#define PCI1760_CMD_GET_FW_VER 0x0e /* Read firware version */ +#define PCI1760_CMD_GET_HW_VER 0x0f /* Read hardware version */ +#define PCI1760_CMD_SET_PWM_HI(x) (0x10 + (x) * 2) /* Set "hi" period */ +#define PCI1760_CMD_SET_PWM_LO(x) (0x11 + (x) * 2) /* Set "lo" period */ +#define PCI1760_CMD_SET_PWM_CNT(x) (0x14 + (x)) /* Set burst count */ +#define PCI1760_CMD_ENA_PWM 0x1f /* Enable PWM outputs */ +#define PCI1760_CMD_ENA_FILT 0x20 /* Enable input filter */ +#define PCI1760_CMD_ENA_PAT_MATCH 0x21 /* Enable input pattern match */ +#define PCI1760_CMD_SET_PAT_MATCH 0x22 /* Set input pattern match */ +#define PCI1760_CMD_ENA_RISE_EDGE 0x23 /* Enable input rising edge */ +#define PCI1760_CMD_ENA_FALL_EDGE 0x24 /* Enable input falling edge */ +#define PCI1760_CMD_ENA_CNT 0x28 /* Enable counter */ +#define PCI1760_CMD_RST_CNT 0x29 /* Reset counter */ +#define PCI1760_CMD_ENA_CNT_OFLOW 0x2a /* Enable counter overflow */ +#define PCI1760_CMD_ENA_CNT_MATCH 0x2b /* Enable counter match */ +#define PCI1760_CMD_SET_CNT_EDGE 0x2c /* Set counter edge */ +#define PCI1760_CMD_GET_CNT 0x2f /* Reads counter value */ +#define PCI1760_CMD_SET_HI_SAMP(x) (0x30 + (x)) /* Set "hi" sample time */ +#define PCI1760_CMD_SET_LO_SAMP(x) (0x38 + (x)) /* Set "lo" sample time */ +#define PCI1760_CMD_SET_CNT(x) (0x40 + (x)) /* Set counter reset val */ +#define PCI1760_CMD_SET_CNT_MATCH(x) (0x48 + (x)) /* Set counter match val */ +#define PCI1760_CMD_GET_INT_FLAGS 0x60 /* Read interrupt flags */ +#define PCI1760_CMD_GET_INT_FLAGS_MATCH BIT(0) +#define PCI1760_CMD_GET_INT_FLAGS_COS BIT(1) +#define PCI1760_CMD_GET_INT_FLAGS_OFLOW BIT(2) +#define PCI1760_CMD_GET_OS 0x61 /* Read edge change flags */ +#define PCI1760_CMD_GET_CNT_STATUS 0x62 /* Read counter oflow/match */ + +#define PCI1760_CMD_TIMEOUT 250 /* 250 usec timeout */ +#define PCI1760_CMD_RETRIES 3 /* limit number of retries */ + +#define PCI1760_PWM_TIMEBASE 100000 /* 1 unit = 100 usec */ + +static int pci1760_send_cmd(struct comedi_device *dev, + unsigned char cmd, unsigned short val) +{ + unsigned long timeout; + + /* send the command and parameter */ + outb(val & 0xff, dev->iobase + PCI1760_OMB_REG(0)); + outb((val >> 8) & 0xff, dev->iobase + PCI1760_OMB_REG(1)); + outb(cmd, dev->iobase + PCI1760_OMB_REG(2)); + outb(0, dev->iobase + PCI1760_OMB_REG(3)); + + /* datasheet says to allow up to 250 usec for the command to complete */ + timeout = jiffies + usecs_to_jiffies(PCI1760_CMD_TIMEOUT); + do { + if (inb(dev->iobase + PCI1760_IMB_REG(2)) == cmd) { + /* command success; return the feedback data */ + return inb(dev->iobase + PCI1760_IMB_REG(0)) | + (inb(dev->iobase + PCI1760_IMB_REG(1)) << 8); + } + cpu_relax(); + } while (time_before(jiffies, timeout)); + + return -EBUSY; +} + +static int pci1760_cmd(struct comedi_device *dev, + unsigned char cmd, unsigned short val) +{ + int repeats; + int ret; + + /* send PCI1760_CMD_CLR_IMB2 between identical commands */ + if (inb(dev->iobase + PCI1760_IMB_REG(2)) == cmd) { + ret = pci1760_send_cmd(dev, PCI1760_CMD_CLR_IMB2, 0); + if (ret < 0) { + /* timeout? try it once more */ + ret = pci1760_send_cmd(dev, PCI1760_CMD_CLR_IMB2, 0); + if (ret < 0) + return -ETIMEDOUT; + } + } + + /* datasheet says to keep retrying the command */ + for (repeats = 0; repeats < PCI1760_CMD_RETRIES; repeats++) { + ret = pci1760_send_cmd(dev, cmd, val); + if (ret >= 0) + return ret; + } + + /* command failed! */ + return -ETIMEDOUT; +} + +static int pci1760_di_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + data[1] = inb(dev->iobase + PCI1760_IMB_REG(3)); + + return insn->n; +} + +static int pci1760_do_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + int ret; + + if (comedi_dio_update_state(s, data)) { + ret = pci1760_cmd(dev, PCI1760_CMD_SET_DO, s->state); + if (ret < 0) + return ret; + } + + data[1] = s->state; + + return insn->n; +} + +static int pci1760_pwm_ns_to_div(unsigned int flags, unsigned int ns) +{ + unsigned int divisor; + + switch (flags) { + case CMDF_ROUND_NEAREST: + divisor = DIV_ROUND_CLOSEST(ns, PCI1760_PWM_TIMEBASE); + break; + case CMDF_ROUND_UP: + divisor = DIV_ROUND_UP(ns, PCI1760_PWM_TIMEBASE); + break; + case CMDF_ROUND_DOWN: + divisor = ns / PCI1760_PWM_TIMEBASE; + default: + return -EINVAL; + } + + if (divisor < 1) + divisor = 1; + if (divisor > 0xffff) + divisor = 0xffff; + + return divisor; +} + +static int pci1760_pwm_enable(struct comedi_device *dev, + unsigned int chan, bool enable) +{ + int ret; + + ret = pci1760_cmd(dev, PCI1760_CMD_GET_STATUS, PCI1760_CMD_ENA_PWM); + if (ret < 0) + return ret; + + if (enable) + ret |= BIT(chan); + else + ret &= ~BIT(chan); + + return pci1760_cmd(dev, PCI1760_CMD_ENA_PWM, ret); +} + +static int pci1760_pwm_insn_config(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + unsigned int chan = CR_CHAN(insn->chanspec); + int hi_div; + int lo_div; + int ret; + + switch (data[0]) { + case INSN_CONFIG_ARM: + ret = pci1760_pwm_enable(dev, chan, false); + if (ret < 0) + return ret; + + if (data[1] > 0xffff) + return -EINVAL; + ret = pci1760_cmd(dev, PCI1760_CMD_SET_PWM_CNT(chan), data[1]); + if (ret < 0) + return ret; + + ret = pci1760_pwm_enable(dev, chan, true); + if (ret < 0) + return ret; + break; + case INSN_CONFIG_DISARM: + ret = pci1760_pwm_enable(dev, chan, false); + if (ret < 0) + return ret; + break; + case INSN_CONFIG_PWM_OUTPUT: + ret = pci1760_pwm_enable(dev, chan, false); + if (ret < 0) + return ret; + + hi_div = pci1760_pwm_ns_to_div(data[1], data[2]); + lo_div = pci1760_pwm_ns_to_div(data[3], data[4]); + if (hi_div < 0 || lo_div < 0) + return -EINVAL; + if ((hi_div * PCI1760_PWM_TIMEBASE) != data[2] || + (lo_div * PCI1760_PWM_TIMEBASE) != data[4]) { + data[2] = hi_div * PCI1760_PWM_TIMEBASE; + data[4] = lo_div * PCI1760_PWM_TIMEBASE; + return -EAGAIN; + } + ret = pci1760_cmd(dev, PCI1760_CMD_SET_PWM_HI(chan), hi_div); + if (ret < 0) + return ret; + ret = pci1760_cmd(dev, PCI1760_CMD_SET_PWM_LO(chan), lo_div); + if (ret < 0) + return ret; + break; + case INSN_CONFIG_GET_PWM_OUTPUT: + hi_div = pci1760_cmd(dev, PCI1760_CMD_GET_STATUS, + PCI1760_CMD_SET_PWM_HI(chan)); + lo_div = pci1760_cmd(dev, PCI1760_CMD_GET_STATUS, + PCI1760_CMD_SET_PWM_LO(chan)); + if (hi_div < 0 || lo_div < 0) + return -ETIMEDOUT; + + data[1] = hi_div * PCI1760_PWM_TIMEBASE; + data[2] = lo_div * PCI1760_PWM_TIMEBASE; + break; + case INSN_CONFIG_GET_PWM_STATUS: + ret = pci1760_cmd(dev, PCI1760_CMD_GET_STATUS, + PCI1760_CMD_ENA_PWM); + if (ret < 0) + return ret; + + data[1] = (ret & BIT(chan)) ? 1 : 0; + break; + default: + return -EINVAL; + } + + return insn->n; +} + +static void pci1760_reset(struct comedi_device *dev) +{ + int i; + + /* disable interrupts (intcsr2 is read-only) */ + outb(0, dev->iobase + PCI1760_INTCSR_REG(0)); + outb(0, dev->iobase + PCI1760_INTCSR_REG(1)); + outb(0, dev->iobase + PCI1760_INTCSR_REG(3)); + + /* disable counters */ + pci1760_cmd(dev, PCI1760_CMD_ENA_CNT, 0); + + /* disable overflow interrupts */ + pci1760_cmd(dev, PCI1760_CMD_ENA_CNT_OFLOW, 0); + + /* disable match */ + pci1760_cmd(dev, PCI1760_CMD_ENA_CNT_MATCH, 0); + + /* set match and counter reset values */ + for (i = 0; i < 8; i++) { + pci1760_cmd(dev, PCI1760_CMD_SET_CNT_MATCH(i), 0x8000); + pci1760_cmd(dev, PCI1760_CMD_SET_CNT(i), 0x0000); + } + + /* reset counters to reset values */ + pci1760_cmd(dev, PCI1760_CMD_RST_CNT, 0xff); + + /* set counter count edges */ + pci1760_cmd(dev, PCI1760_CMD_SET_CNT_EDGE, 0); + + /* disable input filters */ + pci1760_cmd(dev, PCI1760_CMD_ENA_FILT, 0); + + /* disable pattern matching */ + pci1760_cmd(dev, PCI1760_CMD_ENA_PAT_MATCH, 0); + + /* set pattern match value */ + pci1760_cmd(dev, PCI1760_CMD_SET_PAT_MATCH, 0); +} + +static int pci1760_auto_attach(struct comedi_device *dev, + unsigned long context) +{ + struct pci_dev *pcidev = comedi_to_pci_dev(dev); + struct comedi_subdevice *s; + int ret; + + ret = comedi_pci_enable(dev); + if (ret) + return ret; + dev->iobase = pci_resource_start(pcidev, 0); + + pci1760_reset(dev); + + ret = comedi_alloc_subdevices(dev, 4); + if (ret) + return ret; + + /* Digital Input subdevice */ + s = &dev->subdevices[0]; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pci1760_di_insn_bits; + + /* Digital Output subdevice */ + s = &dev->subdevices[1]; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pci1760_do_insn_bits; + + /* get the current state of the outputs */ + ret = pci1760_cmd(dev, PCI1760_CMD_GET_DO, 0); + if (ret < 0) + return ret; + s->state = ret; + + /* PWM subdevice */ + s = &dev->subdevices[2]; + s->type = COMEDI_SUBD_PWM; + s->subdev_flags = SDF_PWM_COUNTER; + s->n_chan = 2; + s->insn_config = pci1760_pwm_insn_config; + + /* Counter subdevice */ + s = &dev->subdevices[3]; + s->type = COMEDI_SUBD_UNUSED; + + return 0; +} + +static struct comedi_driver pci1760_driver = { + .driver_name = "adv_pci1760", + .module = THIS_MODULE, + .auto_attach = pci1760_auto_attach, + .detach = comedi_pci_detach, +}; + +static int pci1760_pci_probe(struct pci_dev *dev, + const struct pci_device_id *id) +{ + return comedi_pci_auto_config(dev, &pci1760_driver, id->driver_data); +} + +static const struct pci_device_id pci1760_pci_table[] = { + { PCI_DEVICE(PCI_VENDOR_ID_ADVANTECH, 0x1760) }, + { 0 } +}; +MODULE_DEVICE_TABLE(pci, pci1760_pci_table); + +static struct pci_driver pci1760_pci_driver = { + .name = "adv_pci1760", + .id_table = pci1760_pci_table, + .probe = pci1760_pci_probe, + .remove = comedi_pci_auto_unconfig, +}; +module_comedi_pci_driver(pci1760_driver, pci1760_pci_driver); + +MODULE_AUTHOR("Comedi http://www.comedi.org"); +MODULE_DESCRIPTION("Comedi driver for Advantech PCI-1760"); +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index f1b3c5aa8d79..81b2cf27182c 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -9,13 +9,13 @@ Driver: adv_pci_dio Description: Advantech PCI-1730, PCI-1733, PCI-1734, PCI-1735U, PCI-1736UP, PCI-1739U, PCI-1750, PCI-1751, PCI-1752, - PCI-1753/E, PCI-1754, PCI-1756, PCI-1760, PCI-1762 + PCI-1753/E, PCI-1754, PCI-1756, PCI-1762 Author: Michal Dobes Devices: [Advantech] PCI-1730 (adv_pci_dio), PCI-1733, PCI-1734, PCI-1735U, PCI-1736UP, PCI-1739U, PCI-1750, PCI-1751, PCI-1752, PCI-1753, PCI-1753+PCI-1753E, PCI-1754, PCI-1756, - PCI-1760, PCI-1762 + PCI-1762 Status: untested Updated: Mon, 09 Jan 2012 12:40:46 +0000 @@ -46,7 +46,6 @@ enum hw_cards_id { TYPE_PCI1752, TYPE_PCI1753, TYPE_PCI1753E, TYPE_PCI1754, TYPE_PCI1756, - TYPE_PCI1760, TYPE_PCI1762 }; @@ -141,84 +140,6 @@ enum hw_io_access { #define PCI1762_ICR 6 /* W: Interrupt control register */ #define PCI1762_ISR 6 /* R: Interrupt status register */ -/* Advantech PCI-1760 registers */ -#define OMB0 0x0c /* W: Mailbox outgoing registers */ -#define OMB1 0x0d -#define OMB2 0x0e -#define OMB3 0x0f -#define IMB0 0x1c /* R: Mailbox incoming registers */ -#define IMB1 0x1d -#define IMB2 0x1e -#define IMB3 0x1f -#define INTCSR0 0x38 /* R/W: Interrupt control registers */ -#define INTCSR1 0x39 -#define INTCSR2 0x3a -#define INTCSR3 0x3b - -/* PCI-1760 mailbox commands */ -#define CMD_ClearIMB2 0x00 /* Clear IMB2 status and return actual - * DI status in IMB3 */ -#define CMD_SetRelaysOutput 0x01 /* Set relay output from OMB0 */ -#define CMD_GetRelaysStatus 0x02 /* Get relay status to IMB0 */ -#define CMD_ReadCurrentStatus 0x07 /* Read the current status of the - * register in OMB0, result in IMB0 */ -#define CMD_ReadFirmwareVersion 0x0e /* Read the firmware ver., result in - * IMB1.IMB0 */ -#define CMD_ReadHardwareVersion 0x0f /* Read the hardware ver., result in - * IMB1.IMB0 */ -#define CMD_EnableIDIFilters 0x20 /* Enable IDI filters based on bits in - * OMB0 */ -#define CMD_EnableIDIPatternMatch 0x21 /* Enable IDI pattern match based on - * bits in OMB0 */ -#define CMD_SetIDIPatternMatch 0x22 /* Enable IDI pattern match based on - * bits in OMB0 */ -#define CMD_EnableIDICounters 0x28 /* Enable IDI counters based on bits in - * OMB0 */ -#define CMD_ResetIDICounters 0x29 /* Reset IDI counters based on bits in - * OMB0 to its reset values */ -#define CMD_OverflowIDICounters 0x2a /* Enable IDI counters overflow - * interrupts based on bits in OMB0 */ -#define CMD_MatchIntIDICounters 0x2b /* Enable IDI counters match value - * interrupts based on bits in OMB0 */ -#define CMD_EdgeIDICounters 0x2c /* Set IDI up counters count edge (bit=0 - * - rising, =1 - falling) */ -#define CMD_GetIDICntCurValue 0x2f /* Read IDI{OMB0} up counter current - * value */ -#define CMD_SetIDI0CntResetValue 0x40 /* Set IDI0 Counter Reset Value - * 256*OMB1+OMB0 */ -#define CMD_SetIDI1CntResetValue 0x41 /* Set IDI1 Counter Reset Value - * 256*OMB1+OMB0 */ -#define CMD_SetIDI2CntResetValue 0x42 /* Set IDI2 Counter Reset Value - * 256*OMB1+OMB0 */ -#define CMD_SetIDI3CntResetValue 0x43 /* Set IDI3 Counter Reset Value - * 256*OMB1+OMB0 */ -#define CMD_SetIDI4CntResetValue 0x44 /* Set IDI4 Counter Reset Value - * 256*OMB1+OMB0 */ -#define CMD_SetIDI5CntResetValue 0x45 /* Set IDI5 Counter Reset Value - * 256*OMB1+OMB0 */ -#define CMD_SetIDI6CntResetValue 0x46 /* Set IDI6 Counter Reset Value - * 256*OMB1+OMB0 */ -#define CMD_SetIDI7CntResetValue 0x47 /* Set IDI7 Counter Reset Value - * 256*OMB1+OMB0 */ -#define CMD_SetIDI0CntMatchValue 0x48 /* Set IDI0 Counter Match Value - * 256*OMB1+OMB0 */ -#define CMD_SetIDI1CntMatchValue 0x49 /* Set IDI1 Counter Match Value - * 256*OMB1+OMB0 */ -#define CMD_SetIDI2CntMatchValue 0x4a /* Set IDI2 Counter Match Value - * 256*OMB1+OMB0 */ -#define CMD_SetIDI3CntMatchValue 0x4b /* Set IDI3 Counter Match Value - * 256*OMB1+OMB0 */ -#define CMD_SetIDI4CntMatchValue 0x4c /* Set IDI4 Counter Match Value - * 256*OMB1+OMB0 */ -#define CMD_SetIDI5CntMatchValue 0x4d /* Set IDI5 Counter Match Value - * 256*OMB1+OMB0 */ -#define CMD_SetIDI6CntMatchValue 0x4e /* Set IDI6 Counter Match Value - * 256*OMB1+OMB0 */ -#define CMD_SetIDI7CntMatchValue 0x4f /* Set IDI7 Counter Match Value - * 256*OMB1+OMB0 */ - -#define OMBCMD_RETRY 0x03 /* 3 times try request before error */ - struct diosubd_data { int chans; /* num of chans */ int addr; /* PCI address ofset */ @@ -365,14 +286,6 @@ static const struct dio_boardtype boardtypes[] = { .boardid = { 4, PCI175x_BOARDID, 1, SDF_INTERNAL, }, .io_access = IO_16b, }, - [TYPE_PCI1760] = { - /* This card has its own 'attach' */ - .name = "pci1760", - .main_pci_region = 0, - .cardtype = TYPE_PCI1760, - .nsubdevs = 4, - .io_access = IO_8b, - }, [TYPE_PCI1762] = { .name = "pci1762", .main_pci_region = PCIDIO_MAINREG, @@ -385,25 +298,6 @@ static const struct dio_boardtype boardtypes[] = { }, }; -struct pci_dio_private { - char GlobalIrqEnabled; /* 1= any IRQ source is enabled */ - /* PCI-1760 specific data */ - unsigned char IDICntEnable; /* counter's counting enable status */ - unsigned char IDICntOverEnable; /* counter's overflow interrupts enable - * status */ - unsigned char IDICntMatchEnable; /* counter's match interrupts - * enable status */ - unsigned char IDICntEdge; /* counter's count edge value - * (bit=0 - rising, =1 - falling) */ - unsigned short CntResValue[8]; /* counters' reset value */ - unsigned short CntMatchValue[8]; /* counters' match interrupt value */ - unsigned char IDIFiltersEn; /* IDI's digital filters enable status */ - unsigned char IDIPatMatchEn; /* IDI's pattern match enable status */ - unsigned char IDIPatMatchValue; /* IDI's pattern match value */ - unsigned short IDIFiltrLow[8]; /* IDI's filter value low signal */ - unsigned short IDIFiltrHigh[8]; /* IDI's filter value high signal */ -}; - /* ============================================================================== */ @@ -476,260 +370,6 @@ static int pci_dio_insn_bits_do_w(struct comedi_device *dev, return insn->n; } -/* -============================================================================== -*/ -static int pci1760_unchecked_mbxrequest(struct comedi_device *dev, - unsigned char *omb, unsigned char *imb, - int repeats) -{ - int cnt, tout, ok = 0; - - for (cnt = 0; cnt < repeats; cnt++) { - outb(omb[0], dev->iobase + OMB0); - outb(omb[1], dev->iobase + OMB1); - outb(omb[2], dev->iobase + OMB2); - outb(omb[3], dev->iobase + OMB3); - for (tout = 0; tout < 251; tout++) { - imb[2] = inb(dev->iobase + IMB2); - if (imb[2] == omb[2]) { - imb[0] = inb(dev->iobase + IMB0); - imb[1] = inb(dev->iobase + IMB1); - imb[3] = inb(dev->iobase + IMB3); - ok = 1; - break; - } - udelay(1); - } - if (ok) - return 0; - } - - dev_err(dev->class_dev, "PCI-1760 mailbox request timeout!\n"); - return -ETIME; -} - -static int pci1760_clear_imb2(struct comedi_device *dev) -{ - unsigned char omb[4] = { 0x0, 0x0, CMD_ClearIMB2, 0x0 }; - unsigned char imb[4]; - /* check if imb2 is already clear */ - if (inb(dev->iobase + IMB2) == CMD_ClearIMB2) - return 0; - return pci1760_unchecked_mbxrequest(dev, omb, imb, OMBCMD_RETRY); -} - -static int pci1760_mbxrequest(struct comedi_device *dev, - unsigned char *omb, unsigned char *imb) -{ - if (omb[2] == CMD_ClearIMB2) { - dev_err(dev->class_dev, - "bug! this function should not be used for CMD_ClearIMB2 command\n"); - return -EINVAL; - } - if (inb(dev->iobase + IMB2) == omb[2]) { - int retval; - - retval = pci1760_clear_imb2(dev); - if (retval < 0) - return retval; - } - return pci1760_unchecked_mbxrequest(dev, omb, imb, OMBCMD_RETRY); -} - -/* -============================================================================== -*/ -static int pci1760_insn_bits_di(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) -{ - data[1] = inb(dev->iobase + IMB3); - - return insn->n; -} - -static int pci1760_insn_bits_do(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) -{ - int ret; - unsigned char omb[4] = { - 0x00, - 0x00, - CMD_SetRelaysOutput, - 0x00 - }; - unsigned char imb[4]; - - if (comedi_dio_update_state(s, data)) { - omb[0] = s->state; - ret = pci1760_mbxrequest(dev, omb, imb); - if (!ret) - return ret; - } - - data[1] = s->state; - - return insn->n; -} - -/* -============================================================================== -*/ -static int pci1760_insn_cnt_read(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) -{ - int ret, n; - unsigned char omb[4] = { - CR_CHAN(insn->chanspec) & 0x07, - 0x00, - CMD_GetIDICntCurValue, - 0x00 - }; - unsigned char imb[4]; - - for (n = 0; n < insn->n; n++) { - ret = pci1760_mbxrequest(dev, omb, imb); - if (!ret) - return ret; - data[n] = (imb[1] << 8) + imb[0]; - } - - return n; -} - -/* -============================================================================== -*/ -static int pci1760_insn_cnt_write(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) -{ - struct pci_dio_private *devpriv = dev->private; - int ret; - unsigned char chan = CR_CHAN(insn->chanspec) & 0x07; - unsigned char bitmask = 1 << chan; - unsigned char omb[4] = { - data[0] & 0xff, - (data[0] >> 8) & 0xff, - CMD_SetIDI0CntResetValue + chan, - 0x00 - }; - unsigned char imb[4]; - - /* Set reset value if different */ - if (devpriv->CntResValue[chan] != (data[0] & 0xffff)) { - ret = pci1760_mbxrequest(dev, omb, imb); - if (!ret) - return ret; - devpriv->CntResValue[chan] = data[0] & 0xffff; - } - - omb[0] = bitmask; /* reset counter to it reset value */ - omb[2] = CMD_ResetIDICounters; - ret = pci1760_mbxrequest(dev, omb, imb); - if (!ret) - return ret; - - /* start counter if it don't run */ - if (!(bitmask & devpriv->IDICntEnable)) { - omb[0] = bitmask; - omb[2] = CMD_EnableIDICounters; - ret = pci1760_mbxrequest(dev, omb, imb); - if (!ret) - return ret; - devpriv->IDICntEnable |= bitmask; - } - return 1; -} - -/* -============================================================================== -*/ -static int pci1760_reset(struct comedi_device *dev) -{ - struct pci_dio_private *devpriv = dev->private; - int i; - unsigned char omb[4] = { 0x00, 0x00, 0x00, 0x00 }; - unsigned char imb[4]; - - outb(0, dev->iobase + INTCSR0); /* disable IRQ */ - outb(0, dev->iobase + INTCSR1); - outb(0, dev->iobase + INTCSR2); - outb(0, dev->iobase + INTCSR3); - devpriv->GlobalIrqEnabled = 0; - - omb[0] = 0x00; - omb[2] = CMD_SetRelaysOutput; /* reset relay outputs */ - pci1760_mbxrequest(dev, omb, imb); - - omb[0] = 0x00; - omb[2] = CMD_EnableIDICounters; /* disable IDI up counters */ - pci1760_mbxrequest(dev, omb, imb); - devpriv->IDICntEnable = 0; - - omb[0] = 0x00; - omb[2] = CMD_OverflowIDICounters; /* disable counters overflow - * interrupts */ - pci1760_mbxrequest(dev, omb, imb); - devpriv->IDICntOverEnable = 0; - - omb[0] = 0x00; - omb[2] = CMD_MatchIntIDICounters; /* disable counters match value - * interrupts */ - pci1760_mbxrequest(dev, omb, imb); - devpriv->IDICntMatchEnable = 0; - - omb[0] = 0x00; - omb[1] = 0x80; - for (i = 0; i < 8; i++) { /* set IDI up counters match value */ - omb[2] = CMD_SetIDI0CntMatchValue + i; - pci1760_mbxrequest(dev, omb, imb); - devpriv->CntMatchValue[i] = 0x8000; - } - - omb[0] = 0x00; - omb[1] = 0x00; - for (i = 0; i < 8; i++) { /* set IDI up counters reset value */ - omb[2] = CMD_SetIDI0CntResetValue + i; - pci1760_mbxrequest(dev, omb, imb); - devpriv->CntResValue[i] = 0x0000; - } - - omb[0] = 0xff; - omb[2] = CMD_ResetIDICounters; /* reset IDI up counters to reset - * values */ - pci1760_mbxrequest(dev, omb, imb); - - omb[0] = 0x00; - omb[2] = CMD_EdgeIDICounters; /* set IDI up counters count edge */ - pci1760_mbxrequest(dev, omb, imb); - devpriv->IDICntEdge = 0x00; - - omb[0] = 0x00; - omb[2] = CMD_EnableIDIFilters; /* disable all digital in filters */ - pci1760_mbxrequest(dev, omb, imb); - devpriv->IDIFiltersEn = 0x00; - - omb[0] = 0x00; - omb[2] = CMD_EnableIDIPatternMatch; /* disable pattern matching */ - pci1760_mbxrequest(dev, omb, imb); - devpriv->IDIPatMatchEn = 0x00; - - omb[0] = 0x00; - omb[2] = CMD_SetIDIPatternMatch; /* set pattern match value */ - pci1760_mbxrequest(dev, omb, imb); - devpriv->IDIPatMatchValue = 0x00; - - return 0; -} - -/* -============================================================================== -*/ static int pci_dio_reset(struct comedi_device *dev) { const struct dio_boardtype *board = dev->board_ptr; @@ -821,9 +461,6 @@ static int pci_dio_reset(struct comedi_device *dev) outw(0, dev->iobase + PCI1756_IDO); /* clear outputs */ outw(0, dev->iobase + PCI1756_IDO + 2); break; - case TYPE_PCI1760: - pci1760_reset(dev); - break; case TYPE_PCI1762: outw(0x0101, dev->iobase + PCI1762_ICR); /* disable & clear * interrupts */ @@ -833,56 +470,6 @@ static int pci_dio_reset(struct comedi_device *dev) return 0; } -/* -============================================================================== -*/ -static int pci1760_attach(struct comedi_device *dev) -{ - struct comedi_subdevice *s; - - s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 8; - s->maxdata = 1; - s->len_chanlist = 8; - s->range_table = &range_digital; - s->insn_bits = pci1760_insn_bits_di; - - s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 1; - s->len_chanlist = 8; - s->range_table = &range_digital; - s->state = 0; - s->insn_bits = pci1760_insn_bits_do; - - s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_TIMER; - s->subdev_flags = SDF_WRITABLE | SDF_LSAMPL; - s->n_chan = 2; - s->maxdata = 0xffffffff; - s->len_chanlist = 2; -/* s->insn_config=pci1760_insn_pwm_cfg; */ - - s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 0xffff; - s->len_chanlist = 8; - s->insn_read = pci1760_insn_cnt_read; - s->insn_write = pci1760_insn_cnt_write; -/* s->insn_config=pci1760_insn_cnt_cfg; */ - - return 0; -} - -/* -============================================================================== -*/ static int pci_dio_add_di(struct comedi_device *dev, struct comedi_subdevice *s, const struct diosubd_data *d) @@ -979,7 +566,6 @@ static int pci_dio_auto_attach(struct comedi_device *dev, { struct pci_dev *pcidev = comedi_to_pci_dev(dev); const struct dio_boardtype *board = NULL; - struct pci_dio_private *devpriv; struct comedi_subdevice *s; int ret, subdev, i, j; @@ -990,10 +576,6 @@ static int pci_dio_auto_attach(struct comedi_device *dev, dev->board_ptr = board; dev->board_name = board->name; - devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); - if (!devpriv) - return -ENOMEM; - ret = comedi_pci_enable(dev); if (ret) return ret; @@ -1050,9 +632,6 @@ static int pci_dio_auto_attach(struct comedi_device *dev, subdev++; } - if (board->cardtype == TYPE_PCI1760) - pci1760_attach(dev); - pci_dio_reset(dev); return 0; @@ -1094,7 +673,6 @@ static const struct pci_device_id adv_pci_dio_pci_table[] = { { PCI_VDEVICE(ADVANTECH, 0x1753), TYPE_PCI1753 }, { PCI_VDEVICE(ADVANTECH, 0x1754), TYPE_PCI1754 }, { PCI_VDEVICE(ADVANTECH, 0x1756), TYPE_PCI1756 }, - { PCI_VDEVICE(ADVANTECH, 0x1760), TYPE_PCI1760 }, { PCI_VDEVICE(ADVANTECH, 0x1762), TYPE_PCI1762 }, { 0 } }; From 6fa60dd4a46cdb698cbda705015d7425d1a548bc Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 11:11:04 -0700 Subject: [PATCH 608/843] staging: comedi: adv_pci1710: remove 'has_irq' boardinfo All the boards supported by this driver can use an interrupt. Remove the unnecessary boardinfo. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 45d7f42312ec..032d1d41a139 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -134,7 +134,6 @@ struct boardtype { const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ const char *rangecode_ai; /* range codes for programming */ unsigned int is_pci1713:1; - unsigned int has_irq:1; unsigned int has_large_fifo:1; /* 4K or 1K FIFO */ unsigned int has_diff_ai:1; unsigned int has_ao:1; @@ -148,7 +147,6 @@ static const struct boardtype boardtypes[] = { .n_aichan = 16, .rangelist_ai = &range_pci1710_3, .rangecode_ai = range_codes_pci1710_3, - .has_irq = 1, .has_large_fifo = 1, .has_diff_ai = 1, .has_ao = 1, @@ -160,7 +158,6 @@ static const struct boardtype boardtypes[] = { .n_aichan = 16, .rangelist_ai = &range_pci1710hg, .rangecode_ai = range_codes_pci1710hg, - .has_irq = 1, .has_large_fifo = 1, .has_diff_ai = 1, .has_ao = 1, @@ -172,7 +169,6 @@ static const struct boardtype boardtypes[] = { .n_aichan = 16, .rangelist_ai = &range_pci17x1, .rangecode_ai = range_codes_pci17x1, - .has_irq = 1, .has_ao = 1, .has_di_do = 1, .has_counter = 1, @@ -183,7 +179,6 @@ static const struct boardtype boardtypes[] = { .rangelist_ai = &range_pci1710_3, .rangecode_ai = range_codes_pci1710_3, .is_pci1713 = 1, - .has_irq = 1, .has_large_fifo = 1, .has_diff_ai = 1, }, @@ -192,7 +187,6 @@ static const struct boardtype boardtypes[] = { .n_aichan = 16, .rangelist_ai = &range_pci17x1, .rangecode_ai = range_codes_pci17x1, - .has_irq = 1, .has_di_do = 1, }, }; @@ -806,7 +800,7 @@ static int pci1710_auto_attach(struct comedi_device *dev, pci1710_reset(dev); - if (board->has_irq && pcidev->irq) { + if (pcidev->irq) { ret = request_irq(pcidev->irq, interrupt_service_pci1710, IRQF_SHARED, dev->board_name, dev); if (ret == 0) From 8a8d0875a5ccf14a6772b3bbffa1717e668a0d8a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 11:11:05 -0700 Subject: [PATCH 609/843] staging: comedi: adv_pci1710: remove 'has_counter' boardinfo All the boards supported by this driver have a 8254 counter. Channels 1 and 2 are used to create the cascaded 32-bit analog input pacer. Counter 0 is available for the user on all the boards except the PCI-1713. Remove the 'has_counter' boardinfo and use the 'is_pci1713' boardinfo to determine if the user counter subdevice needs to be allocated and initialized. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 032d1d41a139..62f9f478421c 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -138,7 +138,6 @@ struct boardtype { unsigned int has_diff_ai:1; unsigned int has_ao:1; unsigned int has_di_do:1; - unsigned int has_counter:1; }; static const struct boardtype boardtypes[] = { @@ -151,7 +150,6 @@ static const struct boardtype boardtypes[] = { .has_diff_ai = 1, .has_ao = 1, .has_di_do = 1, - .has_counter = 1, }, [BOARD_PCI1710HG] = { .name = "pci1710hg", @@ -162,7 +160,6 @@ static const struct boardtype boardtypes[] = { .has_diff_ai = 1, .has_ao = 1, .has_di_do = 1, - .has_counter = 1, }, [BOARD_PCI1711] = { .name = "pci1711", @@ -171,7 +168,6 @@ static const struct boardtype boardtypes[] = { .rangecode_ai = range_codes_pci17x1, .has_ao = 1, .has_di_do = 1, - .has_counter = 1, }, [BOARD_PCI1713] = { .name = "pci1713", @@ -791,7 +787,7 @@ static int pci1710_auto_attach(struct comedi_device *dev, n_subdevices++; if (board->has_di_do) n_subdevices += 2; - if (board->has_counter) + if (!board->is_pci1713) /* all other boards have a user counter */ n_subdevices++; ret = comedi_alloc_subdevices(dev, n_subdevices); @@ -866,8 +862,8 @@ static int pci1710_auto_attach(struct comedi_device *dev, subdev++; } - /* Counter subdevice (8254) */ - if (board->has_counter) { + if (!board->is_pci1713) { + /* Counter subdevice (8254) */ s = &dev->subdevices[subdev]; comedi_8254_subdevice_init(s, dev->pacer); From 19cbb8fb798f9e391df2876ea9522fbd6be88358 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 11:11:06 -0700 Subject: [PATCH 610/843] staging: comedi: adv_pci1710: don't "reset" board when detaching Currently this driver calls pci1710_reset() during the (*detach) of the driver. That function does the following: 1) program the control register to stop any operations 2) clears the analog input FIFO 3) clears any pending interrupts 4) sets all the analog output channels to unipolar 5V range and 0V output 5) sets all the digital outputs to 0V Before detaching the comedi core will (*cancel) any running async commands. This will handle 1-3 above. Depending on the application, it might not be safe to reset the analog and digital outputs when the driver is detached. Remove the board reset when detaching and just use comedi_pci_detach() directly for the driver (*detach). Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 62f9f478421c..e6d9db865d3b 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -882,18 +882,11 @@ static int pci1710_auto_attach(struct comedi_device *dev, return 0; } -static void pci1710_detach(struct comedi_device *dev) -{ - if (dev->iobase) - pci1710_reset(dev); - comedi_pci_detach(dev); -} - static struct comedi_driver adv_pci1710_driver = { .driver_name = "adv_pci1710", .module = THIS_MODULE, .auto_attach = pci1710_auto_attach, - .detach = pci1710_detach, + .detach = comedi_pci_detach, }; static int adv_pci1710_pci_probe(struct pci_dev *dev, From 7603900fc7b41c71753d69487930eda707048b9d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 11:11:07 -0700 Subject: [PATCH 611/843] staging: comedi: adv_pci1710: refactor ai range programming The gain codes used to program the analog output range are currently stored in const char arrays. The values look a bit "magic" and it's not clear how they associate with the comedi_lrange without looking through user manuals. Refactor the ai range programming to clarify the driver and remove the magic numbers. Also, refine the bits in the range register that set the differential and unipolar modes. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 108 ++++++++++--------- 1 file changed, 55 insertions(+), 53 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index e6d9db865d3b..8fa3db304a6f 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -41,6 +41,9 @@ #define PCI171X_AD_DATA_REG 0x00 /* R: A/D data */ #define PCI171X_SOFTTRG_REG 0x00 /* W: soft trigger for A/D */ #define PCI171X_RANGE_REG 0x02 /* W: A/D gain/range register */ +#define PCI171X_RANGE_DIFF BIT(5) +#define PCI171X_RANGE_UNI BIT(4) +#define PCI171X_RANGE_GAIN(x) (((x) & 0x7) << 0) #define PCI171X_MUX_REG 0x04 /* W: A/D multiplexor control */ #define PCI171X_STATUS_REG 0x06 /* R: status register */ #define PCI171X_STATUS_IRQ BIT(11) /* 1=IRQ occurred */ @@ -63,56 +66,47 @@ #define PCI171X_DO_REG 0x10 /* W: digital outputs */ #define PCI171X_TIMER_BASE 0x18 /* R/W: 8254 timer */ -static const struct comedi_lrange range_pci1710_3 = { +static const struct comedi_lrange pci1710_ai_range = { 9, { - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625), - BIP_RANGE(10), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25) + BIP_RANGE(5), /* gain 1 (0x00) */ + BIP_RANGE(2.5), /* gain 2 (0x01) */ + BIP_RANGE(1.25), /* gain 4 (0x02) */ + BIP_RANGE(0.625), /* gain 8 (0x03) */ + BIP_RANGE(10), /* gain 0.5 (0x04) */ + UNI_RANGE(10), /* gain 1 (0x00 | UNI) */ + UNI_RANGE(5), /* gain 2 (0x01 | UNI) */ + UNI_RANGE(2.5), /* gain 4 (0x02 | UNI) */ + UNI_RANGE(1.25) /* gain 8 (0x03 | UNI) */ } }; -static const char range_codes_pci1710_3[] = { 0x00, 0x01, 0x02, 0x03, 0x04, - 0x10, 0x11, 0x12, 0x13 }; - -static const struct comedi_lrange range_pci1710hg = { +static const struct comedi_lrange pci1710hg_ai_range = { 12, { - BIP_RANGE(5), - BIP_RANGE(0.5), - BIP_RANGE(0.05), - BIP_RANGE(0.005), - BIP_RANGE(10), - BIP_RANGE(1), - BIP_RANGE(0.1), - BIP_RANGE(0.01), - UNI_RANGE(10), - UNI_RANGE(1), - UNI_RANGE(0.1), - UNI_RANGE(0.01) + BIP_RANGE(5), /* gain 1 (0x00) */ + BIP_RANGE(0.5), /* gain 10 (0x01) */ + BIP_RANGE(0.05), /* gain 100 (0x02) */ + BIP_RANGE(0.005), /* gain 1000 (0x03) */ + BIP_RANGE(10), /* gain 0.5 (0x04) */ + BIP_RANGE(1), /* gain 5 (0x05) */ + BIP_RANGE(0.1), /* gain 50 (0x06) */ + BIP_RANGE(0.01), /* gain 500 (0x07) */ + UNI_RANGE(10), /* gain 1 (0x00 | UNI) */ + UNI_RANGE(1), /* gain 10 (0x01 | UNI) */ + UNI_RANGE(0.1), /* gain 100 (0x02 | UNI) */ + UNI_RANGE(0.01) /* gain 1000 (0x03 | UNI) */ } }; -static const char range_codes_pci1710hg[] = { 0x00, 0x01, 0x02, 0x03, 0x04, - 0x05, 0x06, 0x07, 0x10, 0x11, - 0x12, 0x13 }; - -static const struct comedi_lrange range_pci17x1 = { +static const struct comedi_lrange pci1711_ai_range = { 5, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625) + BIP_RANGE(10), /* gain 1 (0x00) */ + BIP_RANGE(5), /* gain 2 (0x01) */ + BIP_RANGE(2.5), /* gain 4 (0x02) */ + BIP_RANGE(1.25), /* gain 8 (0x03) */ + BIP_RANGE(0.625) /* gain 16 (0x04) */ } }; -static const char range_codes_pci17x1[] = { 0x00, 0x01, 0x02, 0x03, 0x04 }; - static const struct comedi_lrange pci171x_ao_range = { 2, { UNI_RANGE(5), @@ -132,7 +126,6 @@ struct boardtype { const char *name; /* board name */ int n_aichan; /* num of A/D chans */ const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ - const char *rangecode_ai; /* range codes for programming */ unsigned int is_pci1713:1; unsigned int has_large_fifo:1; /* 4K or 1K FIFO */ unsigned int has_diff_ai:1; @@ -144,8 +137,7 @@ static const struct boardtype boardtypes[] = { [BOARD_PCI1710] = { .name = "pci1710", .n_aichan = 16, - .rangelist_ai = &range_pci1710_3, - .rangecode_ai = range_codes_pci1710_3, + .rangelist_ai = &pci1710_ai_range, .has_large_fifo = 1, .has_diff_ai = 1, .has_ao = 1, @@ -154,8 +146,7 @@ static const struct boardtype boardtypes[] = { [BOARD_PCI1710HG] = { .name = "pci1710hg", .n_aichan = 16, - .rangelist_ai = &range_pci1710hg, - .rangecode_ai = range_codes_pci1710hg, + .rangelist_ai = &pci1710hg_ai_range, .has_large_fifo = 1, .has_diff_ai = 1, .has_ao = 1, @@ -164,16 +155,14 @@ static const struct boardtype boardtypes[] = { [BOARD_PCI1711] = { .name = "pci1711", .n_aichan = 16, - .rangelist_ai = &range_pci17x1, - .rangecode_ai = range_codes_pci17x1, + .rangelist_ai = &pci1711_ai_range, .has_ao = 1, .has_di_do = 1, }, [BOARD_PCI1713] = { .name = "pci1713", .n_aichan = 32, - .rangelist_ai = &range_pci1710_3, - .rangecode_ai = range_codes_pci1710_3, + .rangelist_ai = &pci1710_ai_range, .is_pci1713 = 1, .has_large_fifo = 1, .has_diff_ai = 1, @@ -181,8 +170,7 @@ static const struct boardtype boardtypes[] = { [BOARD_PCI1731] = { .name = "pci1731", .n_aichan = 16, - .rangelist_ai = &range_pci17x1, - .rangecode_ai = range_codes_pci17x1, + .rangelist_ai = &pci1711_ai_range, .has_di_do = 1, }, }; @@ -196,6 +184,7 @@ struct pci1710_private { unsigned int act_chanlist[32]; /* list of scanned channel */ unsigned char saved_seglen; /* len of the non-repeating chanlist */ unsigned char da_ranges; /* copy of D/A outpit range register */ + unsigned char unipolar_gain; /* adjust for unipolar gain codes */ }; static int pci171x_ai_check_chanlist(struct comedi_device *dev, @@ -270,7 +259,6 @@ static void pci171x_ai_setup_chanlist(struct comedi_device *dev, unsigned int n_chan, unsigned int seglen) { - const struct boardtype *board = dev->board_ptr; struct pci1710_private *devpriv = dev->private; unsigned int first_chan = CR_CHAN(chanlist[0]); unsigned int last_chan = CR_CHAN(chanlist[seglen - 1]); @@ -280,11 +268,15 @@ static void pci171x_ai_setup_chanlist(struct comedi_device *dev, unsigned int chan = CR_CHAN(chanlist[i]); unsigned int range = CR_RANGE(chanlist[i]); unsigned int aref = CR_AREF(chanlist[i]); - unsigned int rangeval; + unsigned int rangeval = 0; - rangeval = board->rangecode_ai[range]; if (aref == AREF_DIFF) - rangeval |= 0x0020; + rangeval |= PCI171X_RANGE_DIFF; + if (comedi_range_is_unipolar(s, range)) { + rangeval |= PCI171X_RANGE_UNI; + range -= devpriv->unipolar_gain; + } + rangeval |= PCI171X_RANGE_GAIN(range); /* select channel and set range */ outw(chan | (chan << 8), dev->iobase + PCI171X_MUX_REG); @@ -758,6 +750,7 @@ static int pci1710_auto_attach(struct comedi_device *dev, struct pci1710_private *devpriv; struct comedi_subdevice *s; int ret, subdev, n_subdevices; + int i; if (context < ARRAY_SIZE(boardtypes)) board = &boardtypes[context]; @@ -823,6 +816,15 @@ static int pci1710_auto_attach(struct comedi_device *dev, s->do_cmd = pci171x_ai_cmd; s->cancel = pci171x_ai_cancel; } + + /* find the value needed to adjust for unipolar gain codes */ + for (i = 0; i < s->range_table->length; i++) { + if (comedi_range_is_unipolar(s, i)) { + devpriv->unipolar_gain = i; + break; + } + } + subdev++; } From 92c65e5553ed0a887735dfc1b86911541ca8be3e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 11:11:08 -0700 Subject: [PATCH 612/843] staging: comedi: adv_pci1710: define the mux control register bits For aesthetics, define some macros to set the bits in the mux control register. Also, rename the 'mux_ext' member of the private data. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 8fa3db304a6f..ed6c9fb65efe 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -45,6 +45,9 @@ #define PCI171X_RANGE_UNI BIT(4) #define PCI171X_RANGE_GAIN(x) (((x) & 0x7) << 0) #define PCI171X_MUX_REG 0x04 /* W: A/D multiplexor control */ +#define PCI171X_MUX_CHANH(x) (((x) & 0xf) << 8) +#define PCI171X_MUX_CHANL(x) (((x) & 0xf) << 0) +#define PCI171X_MUX_CHAN(x) (PCI171X_MUX_CHANH(x) | PCI171X_MUX_CHANL(x)) #define PCI171X_STATUS_REG 0x06 /* R: status register */ #define PCI171X_STATUS_IRQ BIT(11) /* 1=IRQ occurred */ #define PCI171X_STATUS_FF BIT(10) /* 1=FIFO is full, fatal error */ @@ -179,7 +182,7 @@ struct pci1710_private { unsigned int max_samples; unsigned int ctrl; /* control register value */ unsigned int ctrl_ext; /* used to switch from TRIG_EXT to TRIG_xxx */ - unsigned int mux_ext; /* used to set the channel interval to scan */ + unsigned int mux_scan; /* used to set the channel interval to scan */ unsigned char ai_et; unsigned int act_chanlist[32]; /* list of scanned channel */ unsigned char saved_seglen; /* len of the non-repeating chanlist */ @@ -279,7 +282,7 @@ static void pci171x_ai_setup_chanlist(struct comedi_device *dev, rangeval |= PCI171X_RANGE_GAIN(range); /* select channel and set range */ - outw(chan | (chan << 8), dev->iobase + PCI171X_MUX_REG); + outw(PCI171X_MUX_CHAN(chan), dev->iobase + PCI171X_MUX_REG); outw(rangeval, dev->iobase + PCI171X_RANGE_REG); devpriv->act_chanlist[i] = chan; @@ -288,8 +291,9 @@ static void pci171x_ai_setup_chanlist(struct comedi_device *dev, devpriv->act_chanlist[i] = CR_CHAN(chanlist[i]); /* select channel interval to scan */ - devpriv->mux_ext = first_chan | (last_chan << 8); - outw(devpriv->mux_ext, dev->iobase + PCI171X_MUX_REG); + devpriv->mux_scan = PCI171X_MUX_CHANL(first_chan) | + PCI171X_MUX_CHANH(last_chan); + outw(devpriv->mux_scan, dev->iobase + PCI171X_MUX_REG); } static int pci171x_ai_eoc(struct comedi_device *dev, @@ -551,7 +555,7 @@ static irqreturn_t interrupt_service_pci1710(int irq, void *d) outb(0, dev->iobase + PCI171X_CLRFIFO_REG); outb(0, dev->iobase + PCI171X_CLRINT_REG); /* no sample on this interrupt; reset the channel interval */ - outw(devpriv->mux_ext, dev->iobase + PCI171X_MUX_REG); + outw(devpriv->mux_scan, dev->iobase + PCI171X_MUX_REG); outw(devpriv->ctrl, dev->iobase + PCI171X_CTRL_REG); comedi_8254_pacer_enable(dev->pacer, 1, 2, true); return IRQ_HANDLED; From 0b458e730412b3d3d3d2e5c59924177acbbcf755 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 11:11:09 -0700 Subject: [PATCH 613/843] staging: comedi: adv_pci1710: remove 'n_aichan' boardinfo This member of the boardinfo isn't really necessary. All the boards have analog inputs, the pci1713 has 32 channels the rest have 16 channels. There is already a 'is_pci1713' member in the boardinfo so that can be used to determine the number of channels for the analog input subdevice. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 65 +++++++++----------- 1 file changed, 28 insertions(+), 37 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index ed6c9fb65efe..8d205ae8f696 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -127,7 +127,6 @@ enum pci1710_boardid { struct boardtype { const char *name; /* board name */ - int n_aichan; /* num of A/D chans */ const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ unsigned int is_pci1713:1; unsigned int has_large_fifo:1; /* 4K or 1K FIFO */ @@ -139,7 +138,6 @@ struct boardtype { static const struct boardtype boardtypes[] = { [BOARD_PCI1710] = { .name = "pci1710", - .n_aichan = 16, .rangelist_ai = &pci1710_ai_range, .has_large_fifo = 1, .has_diff_ai = 1, @@ -148,7 +146,6 @@ static const struct boardtype boardtypes[] = { }, [BOARD_PCI1710HG] = { .name = "pci1710hg", - .n_aichan = 16, .rangelist_ai = &pci1710hg_ai_range, .has_large_fifo = 1, .has_diff_ai = 1, @@ -157,14 +154,12 @@ static const struct boardtype boardtypes[] = { }, [BOARD_PCI1711] = { .name = "pci1711", - .n_aichan = 16, .rangelist_ai = &pci1711_ai_range, .has_ao = 1, .has_di_do = 1, }, [BOARD_PCI1713] = { .name = "pci1713", - .n_aichan = 32, .rangelist_ai = &pci1710_ai_range, .is_pci1713 = 1, .has_large_fifo = 1, @@ -172,7 +167,6 @@ static const struct boardtype boardtypes[] = { }, [BOARD_PCI1731] = { .name = "pci1731", - .n_aichan = 16, .rangelist_ai = &pci1711_ai_range, .has_di_do = 1, }, @@ -777,9 +771,7 @@ static int pci1710_auto_attach(struct comedi_device *dev, if (!dev->pacer) return -ENOMEM; - n_subdevices = 0; - if (board->n_aichan) - n_subdevices++; + n_subdevices = 1; /* all boards have analog inputs */ if (board->has_ao) n_subdevices++; if (board->has_di_do) @@ -802,36 +794,35 @@ static int pci1710_auto_attach(struct comedi_device *dev, subdev = 0; - if (board->n_aichan) { - s = &dev->subdevices[subdev]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND; - if (board->has_diff_ai) - s->subdev_flags |= SDF_DIFF; - s->n_chan = board->n_aichan; - s->maxdata = 0x0fff; - s->range_table = board->rangelist_ai; - s->insn_read = pci171x_ai_insn_read; - if (dev->irq) { - dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = s->n_chan; - s->do_cmdtest = pci171x_ai_cmdtest; - s->do_cmd = pci171x_ai_cmd; - s->cancel = pci171x_ai_cancel; - } - - /* find the value needed to adjust for unipolar gain codes */ - for (i = 0; i < s->range_table->length; i++) { - if (comedi_range_is_unipolar(s, i)) { - devpriv->unipolar_gain = i; - break; - } - } - - subdev++; + /* Analog Input subdevice */ + s = &dev->subdevices[subdev]; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND; + if (board->has_diff_ai) + s->subdev_flags |= SDF_DIFF; + s->n_chan = board->is_pci1713 ? 32 : 16; + s->maxdata = 0x0fff; + s->range_table = board->rangelist_ai; + s->insn_read = pci171x_ai_insn_read; + if (dev->irq) { + dev->read_subdev = s; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = s->n_chan; + s->do_cmdtest = pci171x_ai_cmdtest; + s->do_cmd = pci171x_ai_cmd; + s->cancel = pci171x_ai_cancel; } + /* find the value needed to adjust for unipolar gain codes */ + for (i = 0; i < s->range_table->length; i++) { + if (comedi_range_is_unipolar(s, i)) { + devpriv->unipolar_gain = i; + break; + } + } + + subdev++; + if (board->has_ao) { s = &dev->subdevices[subdev]; s->type = COMEDI_SUBD_AO; From 88601533ae91ce26fbd35441f11b57c3814eeb6a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 11:11:10 -0700 Subject: [PATCH 614/843] staging: comedi: adv_pci1710: remove 'has_di_do' boardinfo This member of the boardinfo isn't really necessary. All the boards except the pci1713 have 16 digital inputs and 16 digital outputs. There is already a 'is_pci1713' member in the boardinfo so that can be used to determine the subdevices for the digital inputs and outputs need to be allocated and initialized. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 22 +++++++++----------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 8d205ae8f696..76f3793f7dc5 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -132,7 +132,6 @@ struct boardtype { unsigned int has_large_fifo:1; /* 4K or 1K FIFO */ unsigned int has_diff_ai:1; unsigned int has_ao:1; - unsigned int has_di_do:1; }; static const struct boardtype boardtypes[] = { @@ -142,7 +141,6 @@ static const struct boardtype boardtypes[] = { .has_large_fifo = 1, .has_diff_ai = 1, .has_ao = 1, - .has_di_do = 1, }, [BOARD_PCI1710HG] = { .name = "pci1710hg", @@ -150,13 +148,11 @@ static const struct boardtype boardtypes[] = { .has_large_fifo = 1, .has_diff_ai = 1, .has_ao = 1, - .has_di_do = 1, }, [BOARD_PCI1711] = { .name = "pci1711", .rangelist_ai = &pci1711_ai_range, .has_ao = 1, - .has_di_do = 1, }, [BOARD_PCI1713] = { .name = "pci1713", @@ -168,7 +164,6 @@ static const struct boardtype boardtypes[] = { [BOARD_PCI1731] = { .name = "pci1731", .rangelist_ai = &pci1711_ai_range, - .has_di_do = 1, }, }; @@ -774,10 +769,13 @@ static int pci1710_auto_attach(struct comedi_device *dev, n_subdevices = 1; /* all boards have analog inputs */ if (board->has_ao) n_subdevices++; - if (board->has_di_do) - n_subdevices += 2; - if (!board->is_pci1713) /* all other boards have a user counter */ - n_subdevices++; + if (!board->is_pci1713) { + /* + * All other boards have digital inputs and outputs as + * well as a user counter. + */ + n_subdevices += 3; + } ret = comedi_alloc_subdevices(dev, n_subdevices); if (ret) @@ -839,7 +837,8 @@ static int pci1710_auto_attach(struct comedi_device *dev, subdev++; } - if (board->has_di_do) { + if (!board->is_pci1713) { + /* Digital Input subdevice */ s = &dev->subdevices[subdev]; s->type = COMEDI_SUBD_DI; s->subdev_flags = SDF_READABLE; @@ -849,6 +848,7 @@ static int pci1710_auto_attach(struct comedi_device *dev, s->insn_bits = pci171x_di_insn_bits; subdev++; + /* Digital Output subdevice */ s = &dev->subdevices[subdev]; s->type = COMEDI_SUBD_DO; s->subdev_flags = SDF_WRITABLE; @@ -857,9 +857,7 @@ static int pci1710_auto_attach(struct comedi_device *dev, s->range_table = &range_digital; s->insn_bits = pci171x_do_insn_bits; subdev++; - } - if (!board->is_pci1713) { /* Counter subdevice (8254) */ s = &dev->subdevices[subdev]; comedi_8254_subdevice_init(s, dev->pacer); From dbdb6248229d1a9f2532cd86dcb8db270ea79034 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 11:11:11 -0700 Subject: [PATCH 615/843] staging: comedi: adv_pci1710: remove 'has_large_fifo' and 'has_diff_ai' boardinfo The pci1711/31 boards are the only ones that have a smaller FIFO (1K vs 4K) and single-ended analog inputs (no differential). Replace the 'has_large_fifo' and 'has_diff_ai' members of the boardinfo with 'is_pci1711' and use that to determine how to initialize the analog input subdev_flags as well as the private data 'max_samples'. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 76f3793f7dc5..7088b76d3458 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -128,9 +128,8 @@ enum pci1710_boardid { struct boardtype { const char *name; /* board name */ const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ + unsigned int is_pci1711:1; unsigned int is_pci1713:1; - unsigned int has_large_fifo:1; /* 4K or 1K FIFO */ - unsigned int has_diff_ai:1; unsigned int has_ao:1; }; @@ -138,32 +137,28 @@ static const struct boardtype boardtypes[] = { [BOARD_PCI1710] = { .name = "pci1710", .rangelist_ai = &pci1710_ai_range, - .has_large_fifo = 1, - .has_diff_ai = 1, .has_ao = 1, }, [BOARD_PCI1710HG] = { .name = "pci1710hg", .rangelist_ai = &pci1710hg_ai_range, - .has_large_fifo = 1, - .has_diff_ai = 1, .has_ao = 1, }, [BOARD_PCI1711] = { .name = "pci1711", .rangelist_ai = &pci1711_ai_range, + .is_pci1711 = 1, .has_ao = 1, }, [BOARD_PCI1713] = { .name = "pci1713", .rangelist_ai = &pci1710_ai_range, .is_pci1713 = 1, - .has_large_fifo = 1, - .has_diff_ai = 1, }, [BOARD_PCI1731] = { .name = "pci1731", .rangelist_ai = &pci1711_ai_range, + .is_pci1711 = 1, }, }; @@ -796,7 +791,7 @@ static int pci1710_auto_attach(struct comedi_device *dev, s = &dev->subdevices[subdev]; s->type = COMEDI_SUBD_AI; s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND; - if (board->has_diff_ai) + if (!board->is_pci1711) s->subdev_flags |= SDF_DIFF; s->n_chan = board->is_pci1713 ? 32 : 16; s->maxdata = 0x0fff; @@ -872,7 +867,7 @@ static int pci1710_auto_attach(struct comedi_device *dev, } /* max_samples is half the FIFO size (2 bytes/sample) */ - devpriv->max_samples = (board->has_large_fifo) ? 2048 : 512; + devpriv->max_samples = (board->is_pci1711) ? 512 : 2048; return 0; } From b5b147dcb48600f8372bdd8728bab8ef1840dac4 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 11:11:12 -0700 Subject: [PATCH 616/843] staging: comedi: adv_pci1710: tidy up boardinfo definition Remove the unnecessary comments and rename the 'rangelist_ai' member for aesthetics. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 7088b76d3458..76371e03aec5 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -126,8 +126,8 @@ enum pci1710_boardid { }; struct boardtype { - const char *name; /* board name */ - const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ + const char *name; + const struct comedi_lrange *ai_range; unsigned int is_pci1711:1; unsigned int is_pci1713:1; unsigned int has_ao:1; @@ -136,28 +136,28 @@ struct boardtype { static const struct boardtype boardtypes[] = { [BOARD_PCI1710] = { .name = "pci1710", - .rangelist_ai = &pci1710_ai_range, + .ai_range = &pci1710_ai_range, .has_ao = 1, }, [BOARD_PCI1710HG] = { .name = "pci1710hg", - .rangelist_ai = &pci1710hg_ai_range, + .ai_range = &pci1710hg_ai_range, .has_ao = 1, }, [BOARD_PCI1711] = { .name = "pci1711", - .rangelist_ai = &pci1711_ai_range, + .ai_range = &pci1711_ai_range, .is_pci1711 = 1, .has_ao = 1, }, [BOARD_PCI1713] = { .name = "pci1713", - .rangelist_ai = &pci1710_ai_range, + .ai_range = &pci1710_ai_range, .is_pci1713 = 1, }, [BOARD_PCI1731] = { .name = "pci1731", - .rangelist_ai = &pci1711_ai_range, + .ai_range = &pci1711_ai_range, .is_pci1711 = 1, }, }; @@ -795,7 +795,7 @@ static int pci1710_auto_attach(struct comedi_device *dev, s->subdev_flags |= SDF_DIFF; s->n_chan = board->is_pci1713 ? 32 : 16; s->maxdata = 0x0fff; - s->range_table = board->rangelist_ai; + s->range_table = board->ai_range; s->insn_read = pci171x_ai_insn_read; if (dev->irq) { dev->read_subdev = s; From 96d57c15ab8acca8ca2ceeebee67c0962134ddcf Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 11:11:13 -0700 Subject: [PATCH 617/843] staging: comedi: adv_pci1710: rename interrupt_service_pci1710() Rename this function so it has namespace associated with the driver. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 76371e03aec5..3c660ee2ae89 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -513,7 +513,7 @@ static void pci1710_handle_fifo(struct comedi_device *dev, outb(0, dev->iobase + PCI171X_CLRINT_REG); } -static irqreturn_t interrupt_service_pci1710(int irq, void *d) +static irqreturn_t pci1710_irq_handler(int irq, void *d) { struct comedi_device *dev = d; struct pci1710_private *devpriv = dev->private; @@ -779,7 +779,7 @@ static int pci1710_auto_attach(struct comedi_device *dev, pci1710_reset(dev); if (pcidev->irq) { - ret = request_irq(pcidev->irq, interrupt_service_pci1710, + ret = request_irq(pcidev->irq, pci1710_irq_handler, IRQF_SHARED, dev->board_name, dev); if (ret == 0) dev->irq = pcidev->irq; From f1f4ce6462b65523edfaae2233046c93ca7c25a7 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 11:11:14 -0700 Subject: [PATCH 618/843] staging: comedi: adv_pci1710: rename pci171x_insn_counter_config() Rename this function so it has namespace associated with the driver. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 3c660ee2ae89..4a8604f09512 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -668,7 +668,7 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev, return 0; } -static int pci171x_insn_counter_config(struct comedi_device *dev, +static int pci1710_counter_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -857,7 +857,7 @@ static int pci1710_auto_attach(struct comedi_device *dev, s = &dev->subdevices[subdev]; comedi_8254_subdevice_init(s, dev->pacer); - dev->pacer->insn_config = pci171x_insn_counter_config; + dev->pacer->insn_config = pci1710_counter_insn_config; /* counters 1 and 2 are used internally for the pacer */ comedi_8254_set_busy(dev->pacer, 1, true); From 6039278668cd162cacc95a883b59b933e39dc2f5 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 11:11:15 -0700 Subject: [PATCH 619/843] staging: comedi: adv_pci1710: rename pci171x_d[io]_insn_bits Rename these functions so they have namespace associated with the driver. For aesthetics, move the functions so they are not located in the middle of the analog input/output support functions. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 50 ++++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 4a8604f09512..45661228ed56 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -387,29 +387,6 @@ static int pci171x_ao_insn_write(struct comedi_device *dev, return insn->n; } -static int pci171x_di_insn_bits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) -{ - data[1] = inw(dev->iobase + PCI171X_DI_REG); - - return insn->n; -} - -static int pci171x_do_insn_bits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) -{ - if (comedi_dio_update_state(s, data)) - outw(s->state, dev->iobase + PCI171X_DO_REG); - - data[1] = s->state; - - return insn->n; -} - static int pci171x_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { @@ -668,6 +645,29 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev, return 0; } +static int pci1710_di_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + data[1] = inw(dev->iobase + PCI171X_DI_REG); + + return insn->n; +} + +static int pci1710_do_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + if (comedi_dio_update_state(s, data)) + outw(s->state, dev->iobase + PCI171X_DO_REG); + + data[1] = s->state; + + return insn->n; +} + static int pci1710_counter_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -840,7 +840,7 @@ static int pci1710_auto_attach(struct comedi_device *dev, s->n_chan = 16; s->maxdata = 1; s->range_table = &range_digital; - s->insn_bits = pci171x_di_insn_bits; + s->insn_bits = pci1710_di_insn_bits; subdev++; /* Digital Output subdevice */ @@ -850,7 +850,7 @@ static int pci1710_auto_attach(struct comedi_device *dev, s->n_chan = 16; s->maxdata = 1; s->range_table = &range_digital; - s->insn_bits = pci171x_do_insn_bits; + s->insn_bits = pci1710_do_insn_bits; subdev++; /* Counter subdevice (8254) */ From baacf6ca54291aec45babc4af079a39b64b02da3 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 11:11:16 -0700 Subject: [PATCH 620/843] staging: comedi: adv_pci1710: rename pci171x_ao_insn_write() Rename this function so it has namespace associated with the driver. For aesthetics, move the function so it is located in the middle of the analog input support functions. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 52 ++++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 45661228ed56..cc451f131857 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -362,31 +362,6 @@ static int pci171x_ai_insn_read(struct comedi_device *dev, return ret ? ret : insn->n; } -static int pci171x_ao_insn_write(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) -{ - struct pci1710_private *devpriv = dev->private; - unsigned int chan = CR_CHAN(insn->chanspec); - unsigned int range = CR_RANGE(insn->chanspec); - unsigned int val = s->readback[chan]; - int i; - - devpriv->da_ranges &= ~(1 << (chan << 1)); - devpriv->da_ranges |= (range << (chan << 1)); - outw(devpriv->da_ranges, dev->iobase + PCI171X_DAREF_REG); - - for (i = 0; i < insn->n; i++) { - val = data[i]; - outw(val, dev->iobase + PCI171X_DA_REG(chan)); - } - - s->readback[chan] = val; - - return insn->n; -} - static int pci171x_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { @@ -645,6 +620,31 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev, return 0; } +static int pci1710_ao_insn_write(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + struct pci1710_private *devpriv = dev->private; + unsigned int chan = CR_CHAN(insn->chanspec); + unsigned int range = CR_RANGE(insn->chanspec); + unsigned int val = s->readback[chan]; + int i; + + devpriv->da_ranges &= ~(1 << (chan << 1)); + devpriv->da_ranges |= (range << (chan << 1)); + outw(devpriv->da_ranges, dev->iobase + PCI171X_DAREF_REG); + + for (i = 0; i < insn->n; i++) { + val = data[i]; + outw(val, dev->iobase + PCI171X_DA_REG(chan)); + } + + s->readback[chan] = val; + + return insn->n; +} + static int pci1710_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -823,7 +823,7 @@ static int pci1710_auto_attach(struct comedi_device *dev, s->n_chan = 2; s->maxdata = 0x0fff; s->range_table = &pci171x_ao_range; - s->insn_write = pci171x_ao_insn_write; + s->insn_write = pci1710_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) From 976e893b61e628ff72adbf70ad84674650c8f053 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 11:11:17 -0700 Subject: [PATCH 621/843] staging: comedi: adv_pci1710: support external analog output reference The analog outputs can use an external reference to create the D/A output range. Add an entry to the comedi_lrange table for it and modify the (*insn_write) to support it. Note that the D/A output range is 0 to +Vref with a -Vref. The comedi_lrange does not include the sign of the range. It simmply allows the user to convert between the 12-bit samples values (0x0000 - 0x0fff) and a physical value (0.0 to 1.0) using the comedilib comedi_to_phys() and comedi_from_phys() functions. A physical value of 0.0 would actually be 0V with a -Vref and -V with a +Vref and 1.0 would be +V with a -Vref and 0V with a -Vref. Ths user will need to work this out but at least they can now use the external reference. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index cc451f131857..aafcb8adb1db 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -65,6 +65,8 @@ #define PCI171X_CLRFIFO_REG 0x09 /* W: clear FIFO */ #define PCI171X_DA_REG(x) (0x0a + ((x) * 2)) /* W: D/A register */ #define PCI171X_DAREF_REG 0x0e /* W: D/A reference control */ +#define PCI171X_DAREF(c, r) (((r) & 0x3) << ((c) * 2)) +#define PCI171X_DAREF_MASK(c) PCI171X_DAREF((c), 0x3) #define PCI171X_DI_REG 0x10 /* R: digital inputs */ #define PCI171X_DO_REG 0x10 /* W: digital outputs */ #define PCI171X_TIMER_BASE 0x18 /* R/W: 8254 timer */ @@ -111,9 +113,10 @@ static const struct comedi_lrange pci1711_ai_range = { }; static const struct comedi_lrange pci171x_ao_range = { - 2, { - UNI_RANGE(5), - UNI_RANGE(10) + 3, { + UNI_RANGE(5), /* internal -5V ref */ + UNI_RANGE(10), /* internal -10V ref */ + RANGE_ext(0, 1) /* external -Vref (+/-10V max) */ } }; @@ -631,8 +634,8 @@ static int pci1710_ao_insn_write(struct comedi_device *dev, unsigned int val = s->readback[chan]; int i; - devpriv->da_ranges &= ~(1 << (chan << 1)); - devpriv->da_ranges |= (range << (chan << 1)); + devpriv->da_ranges &= ~PCI171X_DAREF_MASK(chan); + devpriv->da_ranges |= PCI171X_DAREF(chan, range); outw(devpriv->da_ranges, dev->iobase + PCI171X_DAREF_REG); for (i = 0; i < insn->n; i++) { From 1ef6e0a48e3b624beb6f6206db2875ca3367459e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 11:11:18 -0700 Subject: [PATCH 622/843] staging: comedi: adv_pci1710: tidy up analog output subdev_flags Remove the SDF_COMMON flag, the analog reference is not programmable and the default aref (AREF_GROUND -> SDF_GROUND) provides adequate information about the reference. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index aafcb8adb1db..91ab68b92086 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -820,9 +820,10 @@ static int pci1710_auto_attach(struct comedi_device *dev, subdev++; if (board->has_ao) { + /* Analog Output subdevice */ s = &dev->subdevices[subdev]; s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; + s->subdev_flags = SDF_WRITABLE | SDF_GROUND; s->n_chan = 2; s->maxdata = 0x0fff; s->range_table = &pci171x_ao_range; From 7387332558f050ace07334e945d2077af3c2ed96 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 11:11:19 -0700 Subject: [PATCH 623/843] staging: comedi: adv_pci1710: tidy up analog input subdev_flags Remove the SDF_COMMON flag, the analog reference is not programmable and the default aref (AREF_GROUND -> SDF_GROUND) provides adequate information about the reference. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 91ab68b92086..f68cb1a6836e 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -793,7 +793,7 @@ static int pci1710_auto_attach(struct comedi_device *dev, /* Analog Input subdevice */ s = &dev->subdevices[subdev]; s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND; + s->subdev_flags = SDF_READABLE | SDF_GROUND; if (!board->is_pci1711) s->subdev_flags |= SDF_DIFF; s->n_chan = board->is_pci1713 ? 32 : 16; From d3e8ab48db7fdb7b4898d3685f49720a46925902 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 11:11:20 -0700 Subject: [PATCH 624/843] staging: comedi: adv_pci1710: post increment 'subdev' in (*auto_attach) For aesthetics, post-increment the 'subdev' index when used to get a comedi_subdevice pointer instead of incrementing it after the subdevice is initialized. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index f68cb1a6836e..e36b54045eb4 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -791,7 +791,7 @@ static int pci1710_auto_attach(struct comedi_device *dev, subdev = 0; /* Analog Input subdevice */ - s = &dev->subdevices[subdev]; + s = &dev->subdevices[subdev++]; s->type = COMEDI_SUBD_AI; s->subdev_flags = SDF_READABLE | SDF_GROUND; if (!board->is_pci1711) @@ -817,11 +817,9 @@ static int pci1710_auto_attach(struct comedi_device *dev, } } - subdev++; - if (board->has_ao) { /* Analog Output subdevice */ - s = &dev->subdevices[subdev]; + s = &dev->subdevices[subdev++]; s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_WRITABLE | SDF_GROUND; s->n_chan = 2; @@ -832,33 +830,29 @@ static int pci1710_auto_attach(struct comedi_device *dev, ret = comedi_alloc_subdev_readback(s); if (ret) return ret; - - subdev++; } if (!board->is_pci1713) { /* Digital Input subdevice */ - s = &dev->subdevices[subdev]; + s = &dev->subdevices[subdev++]; s->type = COMEDI_SUBD_DI; s->subdev_flags = SDF_READABLE; s->n_chan = 16; s->maxdata = 1; s->range_table = &range_digital; s->insn_bits = pci1710_di_insn_bits; - subdev++; /* Digital Output subdevice */ - s = &dev->subdevices[subdev]; + s = &dev->subdevices[subdev++]; s->type = COMEDI_SUBD_DO; s->subdev_flags = SDF_WRITABLE; s->n_chan = 16; s->maxdata = 1; s->range_table = &range_digital; s->insn_bits = pci1710_do_insn_bits; - subdev++; /* Counter subdevice (8254) */ - s = &dev->subdevices[subdev]; + s = &dev->subdevices[subdev++]; comedi_8254_subdevice_init(s, dev->pacer); dev->pacer->insn_config = pci1710_counter_insn_config; @@ -866,8 +860,6 @@ static int pci1710_auto_attach(struct comedi_device *dev, /* counters 1 and 2 are used internally for the pacer */ comedi_8254_set_busy(dev->pacer, 1, true); comedi_8254_set_busy(dev->pacer, 2, true); - - subdev++; } /* max_samples is half the FIFO size (2 bytes/sample) */ From adbc9ec7fe38baa8af2a3d21e3f505c8a8da7c3b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 11:11:21 -0700 Subject: [PATCH 625/843] staging: comedi: adv_pci1710: ai (*cancel) should not enable software trigger The (*cancel) operation should do just that. Remove the setting of the SW bit which enables the software trigger. For aesthetics, rename the function so it has namespace associated with the driver and add a couple comments. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index e36b54045eb4..737d40867d3b 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -365,16 +365,19 @@ static int pci171x_ai_insn_read(struct comedi_device *dev, return ret ? ret : insn->n; } -static int pci171x_ai_cancel(struct comedi_device *dev, +static int pci1710_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { struct pci1710_private *devpriv = dev->private; - devpriv->ctrl &= PCI171X_CTRL_CNT0; - devpriv->ctrl |= PCI171X_CTRL_SW; - /* reset any operations */ + /* disable A/D triggers and interrupt sources */ + devpriv->ctrl &= PCI171X_CTRL_CNT0; /* preserve counter 0 clk src */ outw(devpriv->ctrl, dev->iobase + PCI171X_CTRL_REG); + + /* disable pacer */ comedi_8254_pacer_enable(dev->pacer, 1, 2, false); + + /* clear A/D FIFO and any pending interrutps */ outb(0, dev->iobase + PCI171X_CLRFIFO_REG); outb(0, dev->iobase + PCI171X_CLRINT_REG); @@ -806,7 +809,7 @@ static int pci1710_auto_attach(struct comedi_device *dev, s->len_chanlist = s->n_chan; s->do_cmdtest = pci171x_ai_cmdtest; s->do_cmd = pci171x_ai_cmd; - s->cancel = pci171x_ai_cancel; + s->cancel = pci1710_ai_cancel; } /* find the value needed to adjust for unipolar gain codes */ From 0c917a93654557dc2489ebacbeadc3851186e3ce Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 11:11:22 -0700 Subject: [PATCH 626/843] staging: comedi: adv_pci1710: tidy up pci1710_reset() Change the return type to void, this function always succeeds and the caller does not check the return value anyway. Fix the initial programming of the control register. The SW bit enables the software trigger and should not be set here. Setting CNT0 selects the external clock source for counter 0 (the user counter). It makes more sense to select the internal 1 MHz clock. Remove the unnecessary initialization of the private data members. This function is only called during the (*auto_attach) after the private data was kzalloc'ed. Remove the redundant clearing of the A/D FIFO and pending interrupts. Just do it once. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 737d40867d3b..8bd9edfca2f2 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -711,29 +711,29 @@ static int pci1710_counter_insn_config(struct comedi_device *dev, return insn->n; } -static int pci1710_reset(struct comedi_device *dev) +static void pci1710_reset(struct comedi_device *dev) { const struct boardtype *board = dev->board_ptr; - struct pci1710_private *devpriv = dev->private; - /* Software trigger, CNT0=external */ - devpriv->ctrl = PCI171X_CTRL_SW | PCI171X_CTRL_CNT0; - /* reset any operations */ - outw(devpriv->ctrl, dev->iobase + PCI171X_CTRL_REG); + /* + * Disable A/D triggers and interrupt sources, set counter 0 + * to use internal 1 MHz clock. + */ + outw(0, dev->iobase + PCI171X_CTRL_REG); + + /* clear A/D FIFO and any pending interrutps */ outb(0, dev->iobase + PCI171X_CLRFIFO_REG); outb(0, dev->iobase + PCI171X_CLRINT_REG); - devpriv->da_ranges = 0; + if (board->has_ao) { /* set DACs to 0..5V and outputs to 0V */ - outb(devpriv->da_ranges, dev->iobase + PCI171X_DAREF_REG); + outb(0, dev->iobase + PCI171X_DAREF_REG); outw(0, dev->iobase + PCI171X_DA_REG(0)); outw(0, dev->iobase + PCI171X_DA_REG(1)); } - outw(0, dev->iobase + PCI171X_DO_REG); /* digital outputs to 0 */ - outb(0, dev->iobase + PCI171X_CLRFIFO_REG); - outb(0, dev->iobase + PCI171X_CLRINT_REG); - return 0; + /* set digital outputs to 0 */ + outw(0, dev->iobase + PCI171X_DO_REG); } static int pci1710_auto_attach(struct comedi_device *dev, From d0445303f86c6ace7dcaf6d2806445ea0208f151 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 11:11:23 -0700 Subject: [PATCH 627/843] staging: comedi: adv_pci1710: fix counter 0 internal clock source There are a number of descrepencies in the various manuals for the boards that this driver supports. Some show a 10 MHz clock for counters 1 and 2 others show a 1 MHz clock. Counter 0 can use either a div 10 of that clock or an external clock (up to 10 MHz). Currently this driver initializes counters 1 and 2 with a 10 MHz clock. For consistency, return 1 MHz (10 MHz/10) for counter 0 when the user queries the internal clock source with INSN_CONFIG_GET_CLOCK_SRC. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 8bd9edfca2f2..5f1e86e767c8 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -701,7 +701,7 @@ static int pci1710_counter_insn_config(struct comedi_device *dev, data[2] = 0; } else { data[1] = 0; - data[2] = I8254_OSC_BASE_10MHZ; + data[2] = I8254_OSC_BASE_1MHZ; } break; default: From 5ce4385232255683f3fccca4d6772ae61769f2ad Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 11:11:24 -0700 Subject: [PATCH 628/843] staging: comedi: adv_pci1710: fix ai (*insn_read) An (*insn_read) can only happen if the subdevice is in a non-busy state, i.e. an async command is not running. The board reset and subdevice (*cancel) will ensure that the control bits (devpriv->ctrl) are already cleared. The (*insn_read) only needs to enable the software trigger before reading samples. It should also disable the software trigger when done. Fix the (*insn_read) to do this. For aesthetics, rename the function so it has namespace associated with the driver. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 5f1e86e767c8..93b3e3fedbb6 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -325,7 +325,7 @@ static int pci171x_ai_read_sample(struct comedi_device *dev, return 0; } -static int pci171x_ai_insn_read(struct comedi_device *dev, +static int pci1710_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -334,9 +334,10 @@ static int pci171x_ai_insn_read(struct comedi_device *dev, int ret = 0; int i; - devpriv->ctrl &= PCI171X_CTRL_CNT0; - devpriv->ctrl |= PCI171X_CTRL_SW; /* set software trigger */ + /* enable software trigger */ + devpriv->ctrl |= PCI171X_CTRL_SW; outw(devpriv->ctrl, dev->iobase + PCI171X_CTRL_REG); + outb(0, dev->iobase + PCI171X_CLRFIFO_REG); outb(0, dev->iobase + PCI171X_CLRINT_REG); @@ -359,6 +360,10 @@ static int pci171x_ai_insn_read(struct comedi_device *dev, data[i] = val; } + /* disable software trigger */ + devpriv->ctrl &= ~PCI171X_CTRL_SW; + outw(devpriv->ctrl, dev->iobase + PCI171X_CTRL_REG); + outb(0, dev->iobase + PCI171X_CLRFIFO_REG); outb(0, dev->iobase + PCI171X_CLRINT_REG); @@ -802,7 +807,7 @@ static int pci1710_auto_attach(struct comedi_device *dev, s->n_chan = board->is_pci1713 ? 32 : 16; s->maxdata = 0x0fff; s->range_table = board->ai_range; - s->insn_read = pci171x_ai_insn_read; + s->insn_read = pci1710_ai_insn_read; if (dev->irq) { dev->read_subdev = s; s->subdev_flags |= SDF_CMD_READ; From 6f05ce9cce0c946ab4d5e21bdeb1eafcab0fc156 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 11:11:25 -0700 Subject: [PATCH 629/843] staging: comedi: adv_pci1710: rename pci171x_ai_{cmd,cmdtest}() Rename these functions so they have namespace associated with the driver. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 93b3e3fedbb6..b9edf2790222 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -518,7 +518,7 @@ static irqreturn_t pci1710_irq_handler(int irq, void *d) return IRQ_HANDLED; } -static int pci171x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) +static int pci1710_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { struct pci1710_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; @@ -559,7 +559,7 @@ static int pci171x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) return 0; } -static int pci171x_ai_cmdtest(struct comedi_device *dev, +static int pci1710_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { @@ -812,8 +812,8 @@ static int pci1710_auto_attach(struct comedi_device *dev, dev->read_subdev = s; s->subdev_flags |= SDF_CMD_READ; s->len_chanlist = s->n_chan; - s->do_cmdtest = pci171x_ai_cmdtest; - s->do_cmd = pci171x_ai_cmd; + s->do_cmdtest = pci1710_ai_cmdtest; + s->do_cmd = pci1710_ai_cmd; s->cancel = pci1710_ai_cancel; } From e209f7cc205f51b089f9067f4d03922fa5f28490 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 13 Nov 2015 11:11:26 -0700 Subject: [PATCH 630/843] staging: comedi: adv_pci1710: rename pci171x_ai_*() Rename these functions so they have namespace associated with the driver. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index b9edf2790222..2c1b6de30da8 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -177,7 +177,7 @@ struct pci1710_private { unsigned char unipolar_gain; /* adjust for unipolar gain codes */ }; -static int pci171x_ai_check_chanlist(struct comedi_device *dev, +static int pci1710_ai_check_chanlist(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { @@ -243,7 +243,7 @@ static int pci171x_ai_check_chanlist(struct comedi_device *dev, return 0; } -static void pci171x_ai_setup_chanlist(struct comedi_device *dev, +static void pci1710_ai_setup_chanlist(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int *chanlist, unsigned int n_chan, @@ -283,7 +283,7 @@ static void pci171x_ai_setup_chanlist(struct comedi_device *dev, outw(devpriv->mux_scan, dev->iobase + PCI171X_MUX_REG); } -static int pci171x_ai_eoc(struct comedi_device *dev, +static int pci1710_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned long context) @@ -296,7 +296,7 @@ static int pci171x_ai_eoc(struct comedi_device *dev, return -EBUSY; } -static int pci171x_ai_read_sample(struct comedi_device *dev, +static int pci1710_ai_read_sample(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int cur_chan, unsigned int *val) @@ -341,7 +341,7 @@ static int pci1710_ai_insn_read(struct comedi_device *dev, outb(0, dev->iobase + PCI171X_CLRFIFO_REG); outb(0, dev->iobase + PCI171X_CLRINT_REG); - pci171x_ai_setup_chanlist(dev, s, &insn->chanspec, 1, 1); + pci1710_ai_setup_chanlist(dev, s, &insn->chanspec, 1, 1); for (i = 0; i < insn->n; i++) { unsigned int val; @@ -349,11 +349,11 @@ static int pci1710_ai_insn_read(struct comedi_device *dev, /* start conversion */ outw(0, dev->iobase + PCI171X_SOFTTRG_REG); - ret = comedi_timeout(dev, s, insn, pci171x_ai_eoc, 0); + ret = comedi_timeout(dev, s, insn, pci1710_ai_eoc, 0); if (ret) break; - ret = pci171x_ai_read_sample(dev, s, 0, &val); + ret = pci1710_ai_read_sample(dev, s, 0, &val); if (ret) break; @@ -413,7 +413,7 @@ static void pci1710_handle_every_sample(struct comedi_device *dev, outb(0, dev->iobase + PCI171X_CLRINT_REG); for (; !(inw(dev->iobase + PCI171X_STATUS_REG) & PCI171X_STATUS_FE);) { - ret = pci171x_ai_read_sample(dev, s, s->async->cur_chan, &val); + ret = pci1710_ai_read_sample(dev, s, s->async->cur_chan, &val); if (ret) { s->async->events |= COMEDI_CB_ERROR; break; @@ -457,7 +457,7 @@ static void pci1710_handle_fifo(struct comedi_device *dev, unsigned int val; int ret; - ret = pci171x_ai_read_sample(dev, s, s->async->cur_chan, &val); + ret = pci1710_ai_read_sample(dev, s, s->async->cur_chan, &val); if (ret) { s->async->events |= COMEDI_CB_ERROR; break; @@ -523,7 +523,7 @@ static int pci1710_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) struct pci1710_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; - pci171x_ai_setup_chanlist(dev, s, cmd->chanlist, cmd->chanlist_len, + pci1710_ai_setup_chanlist(dev, s, cmd->chanlist, cmd->chanlist_len, devpriv->saved_seglen); outb(0, dev->iobase + PCI171X_CLRFIFO_REG); @@ -623,7 +623,7 @@ static int pci1710_ai_cmdtest(struct comedi_device *dev, /* Step 5: check channel list */ - err |= pci171x_ai_check_chanlist(dev, s, cmd); + err |= pci1710_ai_check_chanlist(dev, s, cmd); if (err) return 5; From 75e1a3a789e1f7437e4d369a5ba45ebd5dd24490 Mon Sep 17 00:00:00 2001 From: Marc Titinger Date: Tue, 15 Dec 2015 16:26:22 +0100 Subject: [PATCH 631/843] iio: ina2xx: fix channel order in software buffer POWER and CURRENT were swapped out in the buffer: was current2 and power3, correct order is power2 and current3. Signed-off-by: Marc Titinger Signed-off-by: Jonathan Cameron --- drivers/iio/adc/ina2xx-adc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c index 4c18c4cc8939..bd56adaeec05 100644 --- a/drivers/iio/adc/ina2xx-adc.c +++ b/drivers/iio/adc/ina2xx-adc.c @@ -428,8 +428,8 @@ static ssize_t ina2xx_shunt_resistor_store(struct device *dev, static const struct iio_chan_spec ina2xx_channels[] = { INA2XX_CHAN_VOLTAGE(0, INA2XX_SHUNT_VOLTAGE), INA2XX_CHAN_VOLTAGE(1, INA2XX_BUS_VOLTAGE), - INA2XX_CHAN(IIO_CURRENT, 2, INA2XX_CURRENT), - INA2XX_CHAN(IIO_POWER, 3, INA2XX_POWER), + INA2XX_CHAN(IIO_POWER, 2, INA2XX_POWER), + INA2XX_CHAN(IIO_CURRENT, 3, INA2XX_CURRENT), IIO_CHAN_SOFT_TIMESTAMP(4), }; From 6e17c98a004c921e07bdecdb8cc2320488f88759 Mon Sep 17 00:00:00 2001 From: Marc Titinger Date: Mon, 14 Dec 2015 12:01:10 +0100 Subject: [PATCH 632/843] iio: ina2xx: add ABI documentation entry sysfs-bus-iio-ina2xx-adc Documentation for attributes: * in_allow_async_readout * in_shunt_resistor Signed-off-by: Marc Titinger Signed-off-by: Jonathan Cameron --- .../ABI/testing/sysfs-bus-iio-ina2xx-adc | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-ina2xx-adc diff --git a/Documentation/ABI/testing/sysfs-bus-iio-ina2xx-adc b/Documentation/ABI/testing/sysfs-bus-iio-ina2xx-adc new file mode 100644 index 000000000000..8916f7ec6507 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-iio-ina2xx-adc @@ -0,0 +1,24 @@ +What: /sys/bus/iio/devices/iio:deviceX/in_allow_async_readout +Date: December 2015 +KernelVersion: 4.4 +Contact: linux-iio@vger.kernel.org +Description: + By default (value '0'), the capture thread checks for the Conversion + Ready Flag to being set prior to committing a new value to the sample + buffer. This synchronizes the in-chip conversion rate with the + in-driver readout rate at the cost of an additional register read. + + Writing '1' will remove the polling for the Conversion Ready Flags to + save the additional i2c transaction, which will improve the bandwidth + available for reading data. However, samples can be occasionally skipped + or repeated, depending on the beat between the capture and conversion + rates. + +What: /sys/bus/iio/devices/iio:deviceX/in_shunt_resistor +Date: December 2015 +KernelVersion: 4.4 +Contact: linux-iio@vger.kernel.org +Description: + The value of the shunt resistor may be known only at runtime fom an + eeprom content read by a client application. This attribute allows to + set its value in ohms. From 34708a0ce860fc70112c285cfde717b1d1aed708 Mon Sep 17 00:00:00 2001 From: Bhaktipriya Shridhar Date: Sun, 13 Dec 2015 18:15:13 +0300 Subject: [PATCH 633/843] Staging: iio: accel: sca3000: Fixed NULL comparison style The variable u8 **rx_p, is a pointer-to-pointer and hence the check should be "if (!*rx_p)" and not "if (!rx_p)". In the earlier version, checkpatch.pl gave the following check, which was incorrect: CHECK: Comparison to NULL could be written "!rx_p" + if (*rx_p == NULL) { Signed-off-by: Bhaktipriya Shridhar Signed-off-by: Jonathan Cameron --- drivers/staging/iio/accel/sca3000_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/iio/accel/sca3000_ring.c b/drivers/staging/iio/accel/sca3000_ring.c index 20b878d35ea2..1920dc60cf3d 100644 --- a/drivers/staging/iio/accel/sca3000_ring.c +++ b/drivers/staging/iio/accel/sca3000_ring.c @@ -48,7 +48,7 @@ static int sca3000_read_data(struct sca3000_state *st, } }; *rx_p = kmalloc(len, GFP_KERNEL); - if (*rx_p == NULL) { + if (!*rx_p) { ret = -ENOMEM; goto error_ret; } From 8e34f2c8d2688a84f516d698aa8a8438a668265f Mon Sep 17 00:00:00 2001 From: Martin Kepplinger Date: Tue, 15 Dec 2015 17:44:59 +0100 Subject: [PATCH 634/843] iio: mma8452: remove unused register description Signed-off-by: Martin Kepplinger Signed-off-by: Christoph Muellner Signed-off-by: Jonathan Cameron --- drivers/iio/accel/mma8452.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c index 116a6e401a6a..162bbef8139f 100644 --- a/drivers/iio/accel/mma8452.c +++ b/drivers/iio/accel/mma8452.c @@ -58,7 +58,6 @@ #define MMA8452_FF_MT_COUNT 0x18 #define MMA8452_TRANSIENT_CFG 0x1d #define MMA8452_TRANSIENT_CFG_HPF_BYP BIT(0) -#define MMA8452_TRANSIENT_CFG_CHAN(chan) BIT(chan + 1) #define MMA8452_TRANSIENT_CFG_ELE BIT(4) #define MMA8452_TRANSIENT_SRC 0x1e #define MMA8452_TRANSIENT_SRC_XTRANSE BIT(1) From e60378c17c7eebf8636fb6831bff1efc9a434521 Mon Sep 17 00:00:00 2001 From: Martin Kepplinger Date: Tue, 15 Dec 2015 17:45:00 +0100 Subject: [PATCH 635/843] iio: mma8452: use enum for channel index This gets rid of some magic numbers by adding an enum. Signed-off-by: Martin Kepplinger Signed-off-by: Christoph Muellner Signed-off-by: Jonathan Cameron --- drivers/iio/accel/mma8452.c | 39 ++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c index 162bbef8139f..ccc632a7cf01 100644 --- a/drivers/iio/accel/mma8452.c +++ b/drivers/iio/accel/mma8452.c @@ -143,6 +143,13 @@ struct mma_chip_info { u8 ev_count; }; +enum { + idx_x, + idx_y, + idx_z, + idx_ts, +}; + static int mma8452_drdy(struct mma8452_data *data) { int tries = 150; @@ -816,31 +823,31 @@ static struct attribute_group mma8452_event_attribute_group = { } static const struct iio_chan_spec mma8452_channels[] = { - MMA8452_CHANNEL(X, 0, 12), - MMA8452_CHANNEL(Y, 1, 12), - MMA8452_CHANNEL(Z, 2, 12), - IIO_CHAN_SOFT_TIMESTAMP(3), + MMA8452_CHANNEL(X, idx_x, 12), + MMA8452_CHANNEL(Y, idx_y, 12), + MMA8452_CHANNEL(Z, idx_z, 12), + IIO_CHAN_SOFT_TIMESTAMP(idx_ts), }; static const struct iio_chan_spec mma8453_channels[] = { - MMA8452_CHANNEL(X, 0, 10), - MMA8452_CHANNEL(Y, 1, 10), - MMA8452_CHANNEL(Z, 2, 10), - IIO_CHAN_SOFT_TIMESTAMP(3), + MMA8452_CHANNEL(X, idx_x, 10), + MMA8452_CHANNEL(Y, idx_y, 10), + MMA8452_CHANNEL(Z, idx_z, 10), + IIO_CHAN_SOFT_TIMESTAMP(idx_ts), }; static const struct iio_chan_spec mma8652_channels[] = { - MMA8652_CHANNEL(X, 0, 12), - MMA8652_CHANNEL(Y, 1, 12), - MMA8652_CHANNEL(Z, 2, 12), - IIO_CHAN_SOFT_TIMESTAMP(3), + MMA8652_CHANNEL(X, idx_x, 12), + MMA8652_CHANNEL(Y, idx_y, 12), + MMA8652_CHANNEL(Z, idx_z, 12), + IIO_CHAN_SOFT_TIMESTAMP(idx_ts), }; static const struct iio_chan_spec mma8653_channels[] = { - MMA8652_CHANNEL(X, 0, 10), - MMA8652_CHANNEL(Y, 1, 10), - MMA8652_CHANNEL(Z, 2, 10), - IIO_CHAN_SOFT_TIMESTAMP(3), + MMA8652_CHANNEL(X, idx_x, 10), + MMA8652_CHANNEL(Y, idx_y, 10), + MMA8652_CHANNEL(Z, idx_z, 10), + IIO_CHAN_SOFT_TIMESTAMP(idx_ts), }; enum { From c6e3a5b3ef16b9e1498daa41645c728ee6e5285c Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:05 +0900 Subject: [PATCH 636/843] staging: wilc1000: remove define COMPLEMENT_BOOT This patch removes define COMPLEMENT_BOOT in Makefile. The feature was removed by commit b46d68825c2d ('staging: wilc1000: remove COMPLEMENT_BOOT') but the define was not removed. So remove completely. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile index 198d536da57c..c55fdd2fa734 100644 --- a/drivers/staging/wilc1000/Makefile +++ b/drivers/staging/wilc1000/Makefile @@ -1,7 +1,5 @@ obj-$(CONFIG_WILC1000) += wilc1000.o -ccflags-$(CONFIG_WILC1000_SDIO) += -DCOMPLEMENT_BOOT - ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \ -DAP_FIRMWARE=\"atmel/wilc1000_ap_fw.bin\" \ -DP2P_CONCURRENCY_FIRMWARE=\"atmel/wilc1000_p2p_fw.bin\" From a5038d56f86011af0d1dcaac56e8507ef5c8f6cf Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:06 +0900 Subject: [PATCH 637/843] staging: wilc1000: remove wilc memory allocation config This patch remove memory allocation options in Kconfig. It was used a long time ago to aquire memory, which we will not use this config anymore. Remove it's config, related define and codes as well. We will take PREALLOCATE_AT_LOADING_DRIVER as it is default. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/Kconfig | 22 -------------- drivers/staging/wilc1000/Makefile | 6 ---- drivers/staging/wilc1000/linux_wlan_common.h | 2 -- drivers/staging/wilc1000/wilc_wlan.c | 30 -------------------- 4 files changed, 60 deletions(-) diff --git a/drivers/staging/wilc1000/Kconfig b/drivers/staging/wilc1000/Kconfig index 2923122346ef..dce9cee9134a 100644 --- a/drivers/staging/wilc1000/Kconfig +++ b/drivers/staging/wilc1000/Kconfig @@ -31,28 +31,6 @@ config WILC1000_SPI immediately following reset when pin 9 (SDIO_SPI_CFG) is tied to VDDIO. Select this if your platform is using the SPI bus. -choice - prompt "WILC1000 Memory Allocation" - depends on WILC1000 - default WILC1000_PREALLOCATE_AT_LOADING_DRIVER - -config WILC1000_PREALLOCATE_AT_LOADING_DRIVER - bool "Preallocate memory at loading driver" - ---help--- - This choice supports static allocation of the memory - for the receive buffer. The driver will allocate the RX buffer - during initial time. The driver will also free the buffer - by calling network device stop. - -config WILC1000_DYNAMICALLY_ALLOCATE_MEMROY - bool "Dynamically allocate memory in real time" - ---help--- - This choice supports dynamic allocation of the memory - for the receive buffer. The driver will allocate the RX buffer - when it is required. -endchoice - - config WILC1000_HW_OOB_INTR bool "WILC1000 out of band interrupt" depends on WILC1000_SDIO diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile index c55fdd2fa734..cd71be9ebc8c 100644 --- a/drivers/staging/wilc1000/Makefile +++ b/drivers/staging/wilc1000/Makefile @@ -7,12 +7,6 @@ ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \ ccflags-y += -I$(src)/ -D__CHECK_ENDIAN__ -DWILC_ASIC_A0 -DWILC_DEBUGFS #ccflags-y += -DTCP_ACK_FILTER -ccflags-$(CONFIG_WILC1000_PREALLOCATE_AT_LOADING_DRIVER) += -DMEMORY_STATIC \ - -DWILC_PREALLOC_AT_INSMOD - -ccflags-$(CONFIG_WILC1000_DYNAMICALLY_ALLOCATE_MEMROY) += -DWILC_NORMAL_ALLOC - - wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \ wilc_msgqueue.o \ coreconfigurator.o host_interface.o \ diff --git a/drivers/staging/wilc1000/linux_wlan_common.h b/drivers/staging/wilc1000/linux_wlan_common.h index 72b524a98cba..5d40f05124c1 100644 --- a/drivers/staging/wilc1000/linux_wlan_common.h +++ b/drivers/staging/wilc1000/linux_wlan_common.h @@ -124,9 +124,7 @@ extern atomic_t WILC_DEBUG_LEVEL; #define FN_IN /* PRINT_D(">>> \n") */ #define FN_OUT /* PRINT_D("<<<\n") */ -#ifdef MEMORY_STATIC #define LINUX_RX_SIZE (96 * 1024) -#endif #define LINUX_TX_SIZE (64 * 1024) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index a73e99f64f27..10def3f1c773 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -12,10 +12,8 @@ typedef struct { u32 cfg_frame_offset; int cfg_seq_no; - #ifdef MEMORY_STATIC u8 *rx_buffer; u32 rx_buffer_offset; - #endif u8 *tx_buffer; u32 tx_buffer_offset; @@ -1050,9 +1048,6 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) if (offset >= size) break; } while (1); -#ifndef MEMORY_STATIC - kfree(buffer); -#endif kfree(rqe); if (has_packet) @@ -1097,9 +1092,7 @@ static void wilc_sleeptimer_isr_ext(struct wilc *wilc, u32 int_stats1) static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) { wilc_wlan_dev_t *p = &g_wlan; -#ifdef MEMORY_STATIC u32 offset = p->rx_buffer_offset; -#endif u8 *buffer = NULL; u32 size; u32 retries = 0; @@ -1118,7 +1111,6 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) } if (size > 0) { -#ifdef MEMORY_STATIC if (LINUX_RX_SIZE - offset < size) offset = 0; @@ -1129,13 +1121,6 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) goto _end_; } -#else - buffer = kmalloc(size, GFP_KERNEL); - if (!buffer) { - usleep_range(100 * 1000, 100 * 1000); - goto _end_; - } -#endif p->hif_func.hif_clear_int_ext(wilc, DATA_INT_CLR | ENABLE_RX_VMM); ret = p->hif_func.hif_block_rx_ext(wilc, 0, buffer, size); @@ -1146,10 +1131,8 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) } _end_: if (ret) { -#ifdef MEMORY_STATIC offset += size; p->rx_buffer_offset = offset; -#endif rqe = kmalloc(sizeof(*rqe), GFP_KERNEL); if (rqe) { rqe->buffer = buffer; @@ -1157,10 +1140,6 @@ _end_: PRINT_D(RX_DBG, "rxq entery Size= %d - Address = %p\n", rqe->buffer_size, rqe->buffer); wilc_wlan_rxq_add(wilc, rqe); } - } else { -#ifndef MEMORY_STATIC - kfree(buffer); -#endif } } wilc_wlan_handle_rxq(wilc); @@ -1442,16 +1421,11 @@ void wilc_wlan_cleanup(struct net_device *dev) rqe = wilc_wlan_rxq_remove(wilc); if (!rqe) break; -#ifndef MEMORY_STATIC - kfree(rqe->buffer); -#endif kfree(rqe); } while (1); - #ifdef MEMORY_STATIC kfree(p->rx_buffer); p->rx_buffer = NULL; - #endif kfree(p->tx_buffer); acquire_bus(wilc, ACQUIRE_AND_WAKEUP); @@ -1691,7 +1665,6 @@ int wilc_wlan_init(struct net_device *dev) goto _fail_; } -#if defined(MEMORY_STATIC) if (!g_wlan.rx_buffer) g_wlan.rx_buffer = kmalloc(LINUX_RX_SIZE, GFP_KERNEL); PRINT_D(TX_DBG, "g_wlan.rx_buffer =%p\n", g_wlan.rx_buffer); @@ -1700,7 +1673,6 @@ int wilc_wlan_init(struct net_device *dev) PRINT_ER("Can't allocate Rx Buffer"); goto _fail_; } -#endif if (!init_chip(dev)) { ret = -EIO; @@ -1714,10 +1686,8 @@ int wilc_wlan_init(struct net_device *dev) _fail_: - #ifdef MEMORY_STATIC kfree(g_wlan.rx_buffer); g_wlan.rx_buffer = NULL; - #endif kfree(g_wlan.tx_buffer); g_wlan.tx_buffer = NULL; From b719302da6da3480e9086121f9c27362382c0efe Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:07 +0900 Subject: [PATCH 638/843] staging: wilc1000: rename index to tcp_pending_ack_idx This patch renames "index" of struct txq_entry_t to tcp_pending_ack_idx since this name could be confused index of txq_entry_t. It is index of tcp pending ack. It fixes 8e55639d066f ("staging: wilc1000: rename tcp_PendingAck_index of struct txq_entry_t") Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 12 ++++++------ drivers/staging/wilc1000/wilc_wlan.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 10def3f1c773..27a44ee576cb 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -249,7 +249,7 @@ static inline int add_tcp_pending_ack(u32 ack, u32 session_index, pending_acks_info[pending_base + pending_acks].ack_num = ack; pending_acks_info[pending_base + pending_acks].txqe = txqe; pending_acks_info[pending_base + pending_acks].session_index = session_index; - txqe->index = pending_base + pending_acks; + txqe->tcp_pending_ack_idx = pending_base + pending_acks; pending_acks++; } return 0; @@ -421,7 +421,7 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc *wilc, u8 *buffer, u32 buffer_s tqe->tx_complete_func = NULL; tqe->priv = NULL; #ifdef TCP_ACK_FILTER - tqe->index = NOT_TCP_ACK; + tqe->tcp_pending_ack_idx = NOT_TCP_ACK; #endif PRINT_D(TX_DBG, "Adding the config packet at the Queue tail\n"); @@ -451,7 +451,7 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, PRINT_D(TX_DBG, "Adding mgmt packet at the Queue tail\n"); #ifdef TCP_ACK_FILTER - tqe->index = NOT_TCP_ACK; + tqe->tcp_pending_ack_idx = NOT_TCP_ACK; if (is_tcp_ack_filter_enabled()) tcp_process(dev, tqe); #endif @@ -478,7 +478,7 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, tqe->tx_complete_func = func; tqe->priv = priv; #ifdef TCP_ACK_FILTER - tqe->index = NOT_TCP_ACK; + tqe->tcp_pending_ack_idx = NOT_TCP_ACK; #endif PRINT_D(TX_DBG, "Adding Network packet at the Queue tail\n"); wilc_wlan_txq_add_to_tail(dev, tqe); @@ -923,8 +923,8 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) tqe->tx_complete_func(tqe->priv, tqe->status); #ifdef TCP_ACK_FILTER - if (tqe->index != NOT_TCP_ACK) - pending_acks_info[tqe->index].txqe = NULL; + if (tqe->tcp_pending_ack_idx != NOT_TCP_ACK) + pending_acks_info[tqe->tcp_pending_ack_idx].txqe = NULL; #endif kfree(tqe); } else { diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 2ac63a3e092a..27c7bbb17b33 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -216,7 +216,7 @@ struct txq_entry_t { struct txq_entry_t *next; struct txq_entry_t *prev; int type; - int index; + int tcp_pending_ack_idx; u8 *buffer; int buffer_size; void *priv; From 9e6627ac727c0d8646085908d9d6c33c08390111 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:08 +0900 Subject: [PATCH 639/843] staging: wilc1000: use kernel define byte order macros This patch removes define BIG_ENDIAN and use kernel define byte order macros instead of swap itself. Remove unused BYTE_SWAP macro and __CHECK_ENDIAN__ in Makefile also. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/Makefile | 2 +- drivers/staging/wilc1000/wilc_sdio.c | 8 ++------ drivers/staging/wilc1000/wilc_spi.c | 16 ++++------------ drivers/staging/wilc1000/wilc_wlan.c | 22 ++++++---------------- drivers/staging/wilc1000/wilc_wlan.h | 11 ----------- drivers/staging/wilc1000/wilc_wlan_cfg.c | 16 +++------------- 6 files changed, 16 insertions(+), 59 deletions(-) diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile index cd71be9ebc8c..207674376553 100644 --- a/drivers/staging/wilc1000/Makefile +++ b/drivers/staging/wilc1000/Makefile @@ -4,7 +4,7 @@ ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \ -DAP_FIRMWARE=\"atmel/wilc1000_ap_fw.bin\" \ -DP2P_CONCURRENCY_FIRMWARE=\"atmel/wilc1000_p2p_fw.bin\" -ccflags-y += -I$(src)/ -D__CHECK_ENDIAN__ -DWILC_ASIC_A0 -DWILC_DEBUGFS +ccflags-y += -I$(src)/ -DWILC_ASIC_A0 -DWILC_DEBUGFS #ccflags-y += -DTCP_ACK_FILTER wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \ diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index ff7990a0b5ec..a9ad49f70d39 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -163,9 +163,7 @@ static int sdio_clear_int(struct wilc *wilc) ********************************************/ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data) { -#ifdef BIG_ENDIAN - data = BYTE_SWAP(data); -#endif + data = cpu_to_le32(data); if ((addr >= 0xf0) && (addr <= 0xff)) { sdio_cmd52_t cmd; @@ -330,9 +328,7 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data) } } -#ifdef BIG_ENDIAN - *data = BYTE_SWAP(*data); -#endif + *data = cpu_to_le32(*data); return 1; diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index d6f412117fd8..c94d86f6cbea 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -529,9 +529,7 @@ static int spi_internal_write(struct wilc *wilc, u32 adr, u32 dat) { int result; -#ifdef BIG_ENDIAN - dat = BYTE_SWAP(dat); -#endif + dat = cpu_to_le32(dat); result = spi_cmd_complete(wilc, CMD_INTERNAL_WRITE, adr, (u8 *)&dat, 4, 0); if (result != N_OK) { @@ -552,9 +550,7 @@ static int spi_internal_read(struct wilc *wilc, u32 adr, u32 *data) return 0; } -#ifdef BIG_ENDIAN - *data = BYTE_SWAP(*data); -#endif + *data = cpu_to_le32(*data); return 1; } @@ -571,9 +567,7 @@ static int wilc_spi_write_reg(struct wilc *wilc, u32 addr, u32 data) u8 cmd = CMD_SINGLE_WRITE; u8 clockless = 0; -#ifdef BIG_ENDIAN - data = BYTE_SWAP(data); -#endif + data = cpu_to_le32(data); if (addr < 0x30) { /* Clockless register*/ cmd = CMD_INTERNAL_WRITE; @@ -635,9 +629,7 @@ static int wilc_spi_read_reg(struct wilc *wilc, u32 addr, u32 *data) return 0; } -#ifdef BIG_ENDIAN - *data = BYTE_SWAP(*data); -#endif + *data = cpu_to_le32(*data); return 1; } diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 27a44ee576cb..a74a95e3830e 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -759,9 +759,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) vmm_table[i] |= BIT(10); PRINT_D(TX_DBG, "VMMTable entry changed for CFG packet = %d\n", vmm_table[i]); } -#ifdef BIG_ENDIAN - vmm_table[i] = BYTE_SWAP(vmm_table[i]); -#endif + vmm_table[i] = cpu_to_le32(vmm_table[i]); i++; sum += vmm_sz; @@ -886,9 +884,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) if (tqe && (vmm_table[i] != 0)) { u32 header, buffer_offset; -#ifdef BIG_ENDIAN - vmm_table[i] = BYTE_SWAP(vmm_table[i]); -#endif + vmm_table[i] = cpu_to_le32(vmm_table[i]); vmm_sz = (vmm_table[i] & 0x3ff); vmm_sz *= 4; header = (tqe->type << 31) | @@ -899,9 +895,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) else header &= ~BIT(30); -#ifdef BIG_ENDIAN - header = BYTE_SWAP(header); -#endif + header = cpu_to_le32(header); memcpy(&txb[offset], &header, 4); if (tqe->type == WILC_CFG_PKT) { buffer_offset = ETH_CONFIG_PKT_HDR_OFFSET; @@ -993,9 +987,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) PRINT_D(RX_DBG, "In the 2nd do-while\n"); memcpy(&header, &buffer[offset], 4); -#ifdef BIG_ENDIAN - header = BYTE_SWAP(header); -#endif + header = cpu_to_le32(header); PRINT_D(RX_DBG, "Header = %04x - Offset = %d\n", header, offset); @@ -1194,10 +1186,8 @@ int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 buffer_ do { memcpy(&addr, &buffer[offset], 4); memcpy(&size, &buffer[offset + 4], 4); -#ifdef BIG_ENDIAN - addr = BYTE_SWAP(addr); - size = BYTE_SWAP(size); -#endif + addr = cpu_to_le32(addr); + size = cpu_to_le32(size); acquire_bus(wilc, ACQUIRE_ONLY); offset += 8; while (((int)size) && (offset < buffer_size)) { diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 27c7bbb17b33..366645318ad2 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -35,17 +35,6 @@ #define ETH_CONFIG_PKT_HDR_OFFSET (ETH_ETHERNET_HDR_OFFSET + \ ETH_CONFIG_PKT_HDR_LEN) -/******************************************** - * - * Endian Conversion - * - ********************************************/ - -#define BYTE_SWAP(val) (((val & 0x000000FF) << 24) + \ - ((val & 0x0000FF00) << 8) + \ - ((val & 0x00FF0000) >> 8) + \ - ((val & 0xFF000000) >> 24)) - /******************************************** * * Register Defines diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c index 274052f36400..f62c0e696a01 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.c +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c @@ -275,9 +275,7 @@ static void wilc_wlan_parse_response_frame(u8 *info, int size) while (size > 0) { i = 0; wid = info[0] | (info[1] << 8); -#ifdef BIG_ENDIAN - wid = BYTE_SWAP(wid); -#endif + wid = cpu_to_le32(wid); PRINT_INFO(GENERIC_DBG, "Processing response for %d seq %d\n", wid, seq++); switch ((wid >> 12) & 0x7) { case WID_CHAR: @@ -300,11 +298,7 @@ static void wilc_wlan_parse_response_frame(u8 *info, int size) break; if (g_cfg_hword[i].id == wid) { -#ifdef BIG_ENDIAN - g_cfg_hword[i].val = (info[3] << 8) | (info[4]); -#else - g_cfg_hword[i].val = info[3] | (info[4] << 8); -#endif + g_cfg_hword[i].val = cpu_to_le16(info[3] | (info[4] << 8)); break; } i++; @@ -318,11 +312,7 @@ static void wilc_wlan_parse_response_frame(u8 *info, int size) break; if (g_cfg_word[i].id == wid) { -#ifdef BIG_ENDIAN - g_cfg_word[i].val = (info[3] << 24) | (info[4] << 16) | (info[5] << 8) | (info[6]); -#else - g_cfg_word[i].val = info[3] | (info[4] << 8) | (info[5] << 16) | (info[6] << 24); -#endif + g_cfg_word[i].val = cpu_to_le32(info[3] | (info[4] << 8) | (info[5] << 16) | (info[6] << 24)); break; } i++; From af9ae09ae0704e2bea199e0d47f0734e06f232fa Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:09 +0900 Subject: [PATCH 640/843] staging: wilc1000: wilc_wlan.c: remove hif_func of wilc_wlan_dev_t hif_func of wilc_wlan_dev_t is duplicate because we have same struct wilc_hif_func ops of struct wilc which is available in wilc_wlan.c. Rename ops of struct wilc with hif_func and remove hif_func of wilc_wlan_dev_t, and use wilc->hif_func instead of g_wlan.hif_func in all functions. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 18 +- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +- drivers/staging/wilc1000/wilc_wlan.c | 161 +++++++++--------- 3 files changed, 87 insertions(+), 94 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index d1c3e4c10d02..92ca0723c8b6 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -750,9 +750,9 @@ void wilc1000_wlan_deinit(struct net_device *dev) PRINT_D(INIT_DBG, "Disabling IRQ\n"); if (!wl->dev_irq_num && - wl->ops->disable_interrupt) { + wl->hif_func->disable_interrupt) { mutex_lock(&wl->hif_cs); - wl->ops->disable_interrupt(wl); + wl->hif_func->disable_interrupt(wl); mutex_unlock(&wl->hif_cs); } if (&wl->txq_event) @@ -770,12 +770,12 @@ void wilc1000_wlan_deinit(struct net_device *dev) wilc_wlan_cleanup(dev); #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31) if (!wl->dev_irq_num && - wl->ops->disable_interrupt) { + wl->hif_func->disable_interrupt) { PRINT_D(INIT_DBG, "Disabling IRQ 2\n"); mutex_lock(&wl->hif_cs); - wl->ops->disable_interrupt(wl); + wl->hif_func->disable_interrupt(wl); mutex_unlock(&wl->hif_cs); } #endif @@ -911,8 +911,8 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) } if (!wl->dev_irq_num && - wl->ops->enable_interrupt && - wl->ops->enable_interrupt(wl)) { + wl->hif_func->enable_interrupt && + wl->hif_func->enable_interrupt(wl)) { PRINT_ER("couldn't initialize IRQ\n"); ret = -EIO; goto _fail_irq_init_; @@ -964,8 +964,8 @@ _fail_fw_start_: _fail_irq_enable_: if (!wl->dev_irq_num && - wl->ops->disable_interrupt) - wl->ops->disable_interrupt(wl); + wl->hif_func->disable_interrupt) + wl->hif_func->disable_interrupt(wl); _fail_irq_init_: if (wl->dev_irq_num) deinit_irq(dev); @@ -1438,7 +1438,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, *wilc = wl; wl->io_type = io_type; wl->gpio = gpio; - wl->ops = ops; + wl->hif_func = ops; register_inetaddr_notifier(&g_dev_notifier); diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 212d607748e9..b593b6461160 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -156,7 +156,7 @@ struct wilc_vif { }; struct wilc { - const struct wilc_hif_func *ops; + const struct wilc_hif_func *hif_func; int io_type; int mac_status; int gpio; diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index a74a95e3830e..b9bedc8010fc 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -6,7 +6,6 @@ typedef struct { int quit; int io_type; - struct wilc_hif_func hif_func; int cfg_frame_in_use; struct wilc_cfg_frame cfg_frame; u32 cfg_frame_offset; @@ -564,9 +563,9 @@ static inline void chip_allow_sleep(struct wilc *wilc) { u32 reg = 0; - g_wlan.hif_func.hif_read_reg(wilc, 0xf0, ®); + wilc->hif_func->hif_read_reg(wilc, 0xf0, ®); - g_wlan.hif_func.hif_write_reg(wilc, 0xf0, reg & ~BIT(0)); + wilc->hif_func->hif_write_reg(wilc, 0xf0, reg & ~BIT(0)); } static inline void chip_wakeup(struct wilc *wilc) @@ -576,9 +575,9 @@ static inline void chip_wakeup(struct wilc *wilc) if ((g_wlan.io_type & 0x1) == HIF_SPI) { do { - g_wlan.hif_func.hif_read_reg(wilc, 1, ®); - g_wlan.hif_func.hif_write_reg(wilc, 1, reg | BIT(1)); - g_wlan.hif_func.hif_write_reg(wilc, 1, reg & ~BIT(1)); + wilc->hif_func->hif_read_reg(wilc, 1, ®); + wilc->hif_func->hif_write_reg(wilc, 1, reg | BIT(1)); + wilc->hif_func->hif_write_reg(wilc, 1, reg & ~BIT(1)); do { usleep_range(2 * 1000, 2 * 1000); @@ -589,44 +588,44 @@ static inline void chip_wakeup(struct wilc *wilc) } while (wilc_get_chipid(wilc, true) == 0); } else if ((g_wlan.io_type & 0x1) == HIF_SDIO) { - g_wlan.hif_func.hif_read_reg(wilc, 0xf0, ®); + wilc->hif_func->hif_read_reg(wilc, 0xf0, ®); do { - g_wlan.hif_func.hif_write_reg(wilc, 0xf0, + wilc->hif_func->hif_write_reg(wilc, 0xf0, reg | BIT(0)); - g_wlan.hif_func.hif_read_reg(wilc, 0xf1, + wilc->hif_func->hif_read_reg(wilc, 0xf1, &clk_status_reg); while (((clk_status_reg & 0x1) == 0) && (((++trials) % 3) == 0)) { usleep_range(2 * 1000, 2 * 1000); - g_wlan.hif_func.hif_read_reg(wilc, 0xf1, + wilc->hif_func->hif_read_reg(wilc, 0xf1, &clk_status_reg); if ((clk_status_reg & 0x1) == 0) wilc_debug(N_ERR, "clocks still OFF. Wake up failed\n"); } if ((clk_status_reg & 0x1) == 0) { - g_wlan.hif_func.hif_write_reg(wilc, 0xf0, + wilc->hif_func->hif_write_reg(wilc, 0xf0, reg & (~BIT(0))); } } while ((clk_status_reg & 0x1) == 0); } if (chip_ps_state == CHIP_SLEEPING_MANUAL) { - g_wlan.hif_func.hif_read_reg(wilc, 0x1C0C, ®); + wilc->hif_func->hif_read_reg(wilc, 0x1C0C, ®); reg &= ~BIT(0); - g_wlan.hif_func.hif_write_reg(wilc, 0x1C0C, reg); + wilc->hif_func->hif_write_reg(wilc, 0x1C0C, reg); if (wilc_get_chipid(wilc, false) >= 0x1002b0) { u32 val32; - g_wlan.hif_func.hif_read_reg(wilc, 0x1e1c, &val32); + wilc->hif_func->hif_read_reg(wilc, 0x1e1c, &val32); val32 |= BIT(6); - g_wlan.hif_func.hif_write_reg(wilc, 0x1e1c, val32); + wilc->hif_func->hif_write_reg(wilc, 0x1e1c, val32); - g_wlan.hif_func.hif_read_reg(wilc, 0x1e9c, &val32); + wilc->hif_func->hif_read_reg(wilc, 0x1e9c, &val32); val32 |= BIT(6); - g_wlan.hif_func.hif_write_reg(wilc, 0x1e9c, val32); + wilc->hif_func->hif_write_reg(wilc, 0x1e9c, val32); } } chip_ps_state = CHIP_WAKEDUP; @@ -638,17 +637,17 @@ static inline void chip_wakeup(struct wilc *wilc) do { if ((g_wlan.io_type & 0x1) == HIF_SPI) { - g_wlan.hif_func.hif_read_reg(wilc, 1, ®); - g_wlan.hif_func.hif_write_reg(wilc, 1, reg & ~BIT(1)); - g_wlan.hif_func.hif_write_reg(wilc, 1, reg | BIT(1)); - g_wlan.hif_func.hif_write_reg(wilc, 1, reg & ~BIT(1)); + wilc->hif_func->hif_read_reg(wilc, 1, ®); + wilc->hif_func->hif_write_reg(wilc, 1, reg & ~BIT(1)); + wilc->hif_func->hif_write_reg(wilc, 1, reg | BIT(1)); + wilc->hif_func->hif_write_reg(wilc, 1, reg & ~BIT(1)); } else if ((g_wlan.io_type & 0x1) == HIF_SDIO) { - g_wlan.hif_func.hif_read_reg(wilc, 0xf0, ®); - g_wlan.hif_func.hif_write_reg(wilc, 0xf0, + wilc->hif_func->hif_read_reg(wilc, 0xf0, ®); + wilc->hif_func->hif_write_reg(wilc, 0xf0, reg & ~BIT(0)); - g_wlan.hif_func.hif_write_reg(wilc, 0xf0, + wilc->hif_func->hif_write_reg(wilc, 0xf0, reg | BIT(0)); - g_wlan.hif_func.hif_write_reg(wilc, 0xf0, + wilc->hif_func->hif_write_reg(wilc, 0xf0, reg & ~BIT(0)); } @@ -663,20 +662,20 @@ static inline void chip_wakeup(struct wilc *wilc) } while (wilc_get_chipid(wilc, true) == 0); if (chip_ps_state == CHIP_SLEEPING_MANUAL) { - g_wlan.hif_func.hif_read_reg(wilc, 0x1C0C, ®); + wilc->hif_func->hif_read_reg(wilc, 0x1C0C, ®); reg &= ~BIT(0); - g_wlan.hif_func.hif_write_reg(wilc, 0x1C0C, reg); + wilc->hif_func->hif_write_reg(wilc, 0x1C0C, reg); if (wilc_get_chipid(wilc, false) >= 0x1002b0) { u32 val32; - g_wlan.hif_func.hif_read_reg(wilc, 0x1e1c, &val32); + wilc->hif_func->hif_read_reg(wilc, 0x1e1c, &val32); val32 |= BIT(6); - g_wlan.hif_func.hif_write_reg(wilc, 0x1e1c, val32); + wilc->hif_func->hif_write_reg(wilc, 0x1e1c, val32); - g_wlan.hif_func.hif_read_reg(wilc, 0x1e9c, &val32); + wilc->hif_func->hif_read_reg(wilc, 0x1e9c, &val32); val32 |= BIT(6); - g_wlan.hif_func.hif_write_reg(wilc, 0x1e9c, val32); + wilc->hif_func->hif_write_reg(wilc, 0x1e9c, val32); } } chip_ps_state = CHIP_WAKEDUP; @@ -691,7 +690,7 @@ void wilc_chip_sleep_manually(struct wilc *wilc) #ifdef WILC_OPTIMIZE_SLEEP_INT chip_allow_sleep(wilc); #endif - g_wlan.hif_func.hif_write_reg(wilc, 0x10a8, 1); + wilc->hif_func->hif_write_reg(wilc, 0x10a8, 1); chip_ps_state = CHIP_SLEEPING_MANUAL; release_bus(wilc, RELEASE_ONLY); @@ -780,7 +779,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) acquire_bus(wilc, ACQUIRE_AND_WAKEUP); counter = 0; do { - ret = p->hif_func.hif_read_reg(wilc, WILC_HOST_TX_CTRL, + ret = wilc->hif_func->hif_read_reg(wilc, WILC_HOST_TX_CTRL, ®); if (!ret) { wilc_debug(N_ERR, "[wilc txq]: fail can't read reg vmm_tbl_entry..\n"); @@ -795,7 +794,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) if (counter > 200) { counter = 0; PRINT_D(TX_DBG, "Looping in tx ctrl , forcce quit\n"); - ret = p->hif_func.hif_write_reg(wilc, WILC_HOST_TX_CTRL, 0); + ret = wilc->hif_func->hif_write_reg(wilc, WILC_HOST_TX_CTRL, 0); break; } PRINT_WRN(GENERIC_DBG, "[wilc txq]: warn, vmm table not clear yet, wait...\n"); @@ -810,13 +809,13 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) timeout = 200; do { - ret = p->hif_func.hif_block_tx(wilc, WILC_VMM_TBL_RX_SHADOW_BASE, (u8 *)vmm_table, ((i + 1) * 4)); + ret = wilc->hif_func->hif_block_tx(wilc, WILC_VMM_TBL_RX_SHADOW_BASE, (u8 *)vmm_table, ((i + 1) * 4)); if (!ret) { wilc_debug(N_ERR, "ERR block TX of VMM table.\n"); break; } - ret = p->hif_func.hif_write_reg(wilc, WILC_HOST_VMM_CTL, + ret = wilc->hif_func->hif_write_reg(wilc, WILC_HOST_VMM_CTL, 0x2); if (!ret) { wilc_debug(N_ERR, "[wilc txq]: fail can't write reg host_vmm_ctl..\n"); @@ -824,7 +823,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) } do { - ret = p->hif_func.hif_read_reg(wilc, WILC_HOST_VMM_CTL, ®); + ret = wilc->hif_func->hif_read_reg(wilc, WILC_HOST_VMM_CTL, ®); if (!ret) { wilc_debug(N_ERR, "[wilc txq]: fail can't read reg host_vmm_ctl..\n"); break; @@ -840,7 +839,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) } } while (--timeout); if (timeout <= 0) { - ret = p->hif_func.hif_write_reg(wilc, WILC_HOST_VMM_CTL, 0x0); + ret = wilc->hif_func->hif_write_reg(wilc, WILC_HOST_VMM_CTL, 0x0); break; } @@ -850,13 +849,13 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) if (entries == 0) { PRINT_WRN(GENERIC_DBG, "[wilc txq]: no more buffer in the chip (reg: %08x), retry later [[ %d, %x ]]\n", reg, i, vmm_table[i - 1]); - ret = p->hif_func.hif_read_reg(wilc, WILC_HOST_TX_CTRL, ®); + ret = wilc->hif_func->hif_read_reg(wilc, WILC_HOST_TX_CTRL, ®); if (!ret) { wilc_debug(N_ERR, "[wilc txq]: fail can't read reg WILC_HOST_TX_CTRL..\n"); break; } reg &= ~BIT(0); - ret = p->hif_func.hif_write_reg(wilc, WILC_HOST_TX_CTRL, reg); + ret = wilc->hif_func->hif_write_reg(wilc, WILC_HOST_TX_CTRL, reg); if (!ret) { wilc_debug(N_ERR, "[wilc txq]: fail can't write reg WILC_HOST_TX_CTRL..\n"); break; @@ -928,13 +927,13 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) acquire_bus(wilc, ACQUIRE_AND_WAKEUP); - ret = p->hif_func.hif_clear_int_ext(wilc, ENABLE_TX_VMM); + ret = wilc->hif_func->hif_clear_int_ext(wilc, ENABLE_TX_VMM); if (!ret) { wilc_debug(N_ERR, "[wilc txq]: fail can't start tx VMM ...\n"); goto _end_; } - ret = p->hif_func.hif_block_tx_ext(wilc, 0, txb, offset); + ret = wilc->hif_func->hif_block_tx_ext(wilc, 0, txb, offset); if (!ret) { wilc_debug(N_ERR, "[wilc txq]: fail can't block tx ext...\n"); goto _end_; @@ -1053,14 +1052,14 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) static void wilc_unknown_isr_ext(struct wilc *wilc) { - g_wlan.hif_func.hif_clear_int_ext(wilc, 0); + wilc->hif_func->hif_clear_int_ext(wilc, 0); } static void wilc_pllupdate_isr_ext(struct wilc *wilc, u32 int_stats) { int trials = 10; - g_wlan.hif_func.hif_clear_int_ext(wilc, PLL_INT_CLR); + wilc->hif_func->hif_clear_int_ext(wilc, PLL_INT_CLR); if (g_wlan.io_type == HIF_SDIO) mdelay(WILC_PLL_TO_SDIO); @@ -1075,7 +1074,7 @@ static void wilc_pllupdate_isr_ext(struct wilc *wilc, u32 int_stats) static void wilc_sleeptimer_isr_ext(struct wilc *wilc, u32 int_stats1) { - g_wlan.hif_func.hif_clear_int_ext(wilc, SLEEP_INT_CLR); + wilc->hif_func->hif_clear_int_ext(wilc, SLEEP_INT_CLR); #ifndef WILC_OPTIMIZE_SLEEP_INT chip_ps_state = CHIP_SLEEPING_AUTO; #endif @@ -1097,7 +1096,7 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) u32 time = 0; wilc_debug(N_ERR, "RX Size equal zero ... Trying to read it again for %d time\n", time++); - p->hif_func.hif_read_size(wilc, &size); + wilc->hif_func->hif_read_size(wilc, &size); size = ((size & 0x7fff) << 2); retries++; } @@ -1113,9 +1112,9 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) goto _end_; } - p->hif_func.hif_clear_int_ext(wilc, + wilc->hif_func->hif_clear_int_ext(wilc, DATA_INT_CLR | ENABLE_RX_VMM); - ret = p->hif_func.hif_block_rx_ext(wilc, 0, buffer, size); + ret = wilc->hif_func->hif_block_rx_ext(wilc, 0, buffer, size); if (!ret) { wilc_debug(N_ERR, "[wilc isr]: fail block rx...\n"); @@ -1142,7 +1141,7 @@ void wilc_handle_isr(struct wilc *wilc) u32 int_status; acquire_bus(wilc, ACQUIRE_AND_WAKEUP); - g_wlan.hif_func.hif_read_int(wilc, &int_status); + wilc->hif_func->hif_read_int(wilc, &int_status); if (int_status & PLL_INT_EXT) wilc_pllupdate_isr_ext(wilc, int_status); @@ -1165,7 +1164,6 @@ EXPORT_SYMBOL_GPL(wilc_handle_isr); int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 buffer_size) { - wilc_wlan_dev_t *p = &g_wlan; u32 offset; u32 addr, size, size2, blksz; u8 *dma_buffer; @@ -1197,7 +1195,7 @@ int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 buffer_ size2 = blksz; memcpy(dma_buffer, &buffer[offset], size2); - ret = p->hif_func.hif_block_tx(wilc, addr, dma_buffer, + ret = wilc->hif_func->hif_block_tx(wilc, addr, dma_buffer, size2); if (!ret) break; @@ -1239,7 +1237,7 @@ int wilc_wlan_start(struct wilc *wilc) reg = 1; } acquire_bus(wilc, ACQUIRE_ONLY); - ret = p->hif_func.hif_write_reg(wilc, WILC_VMM_CORE_CFG, reg); + ret = wilc->hif_func->hif_write_reg(wilc, WILC_VMM_CORE_CFG, reg); if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail write reg vmm_core_cfg...\n"); release_bus(wilc, RELEASE_ONLY); @@ -1273,7 +1271,7 @@ int wilc_wlan_start(struct wilc *wilc) reg |= WILC_HAVE_DISABLE_WILC_UART; #endif - ret = p->hif_func.hif_write_reg(wilc, WILC_GP_REG_1, reg); + ret = wilc->hif_func->hif_write_reg(wilc, WILC_GP_REG_1, reg); if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail write WILC_GP_REG_1 ...\n"); release_bus(wilc, RELEASE_ONLY); @@ -1281,9 +1279,9 @@ int wilc_wlan_start(struct wilc *wilc) return ret; } - p->hif_func.hif_sync_ext(wilc, NUM_INT_EXT); + wilc->hif_func->hif_sync_ext(wilc, NUM_INT_EXT); - ret = p->hif_func.hif_read_reg(wilc, 0x1000, &chipid); + ret = wilc->hif_func->hif_read_reg(wilc, 0x1000, &chipid); if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail read reg 0x1000 ...\n"); release_bus(wilc, RELEASE_ONLY); @@ -1291,16 +1289,16 @@ int wilc_wlan_start(struct wilc *wilc) return ret; } - p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0, ®); + wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, ®); if ((reg & BIT(10)) == BIT(10)) { reg &= ~BIT(10); - p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, reg); - p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0, ®); + wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg); + wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, ®); } reg |= BIT(10); - ret = p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, reg); - p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0, ®); + ret = wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg); + wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, ®); release_bus(wilc, RELEASE_ONLY); return (ret < 0) ? ret : 0; @@ -1308,22 +1306,18 @@ int wilc_wlan_start(struct wilc *wilc) void wilc_wlan_global_reset(struct wilc *wilc) { - - wilc_wlan_dev_t *p = &g_wlan; - acquire_bus(wilc, ACQUIRE_AND_WAKEUP); - p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, 0x0); + wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, 0x0); release_bus(wilc, RELEASE_ONLY); } int wilc_wlan_stop(struct wilc *wilc) { - wilc_wlan_dev_t *p = &g_wlan; u32 reg = 0; int ret; u8 timeout = 10; acquire_bus(wilc, ACQUIRE_AND_WAKEUP); - ret = p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0, ®); + ret = wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, ®); if (!ret) { PRINT_ER("Error while reading reg\n"); release_bus(wilc, RELEASE_ALLOW_SLEEP); @@ -1331,7 +1325,7 @@ int wilc_wlan_stop(struct wilc *wilc) } reg &= ~BIT(10); - ret = p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, reg); + ret = wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg); if (!ret) { PRINT_ER("Error while writing reg\n"); release_bus(wilc, RELEASE_ALLOW_SLEEP); @@ -1339,7 +1333,7 @@ int wilc_wlan_stop(struct wilc *wilc) } do { - ret = p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0, ®); + ret = wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, ®); if (!ret) { PRINT_ER("Error while reading reg\n"); release_bus(wilc, RELEASE_ALLOW_SLEEP); @@ -1352,13 +1346,13 @@ int wilc_wlan_stop(struct wilc *wilc) PRINT_D(GENERIC_DBG, "Bit 10 not reset : Retry %d\n", timeout); reg &= ~BIT(10); - ret = p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, + ret = wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg); timeout--; } else { PRINT_D(GENERIC_DBG, "Bit 10 reset after : Retry %d\n", timeout); - ret = p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0, + ret = wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, ®); if (!ret) { PRINT_ER("Error while reading reg\n"); @@ -1374,10 +1368,10 @@ int wilc_wlan_stop(struct wilc *wilc) reg = (BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(8) | BIT(9) | BIT(26) | BIT(29) | BIT(30) | BIT(31)); - p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, reg); + wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg); reg = (u32)~BIT(10); - ret = p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, reg); + ret = wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg); release_bus(wilc, RELEASE_ALLOW_SLEEP); @@ -1420,20 +1414,20 @@ void wilc_wlan_cleanup(struct net_device *dev) acquire_bus(wilc, ACQUIRE_AND_WAKEUP); - ret = p->hif_func.hif_read_reg(wilc, WILC_GP_REG_0, ®); + ret = wilc->hif_func->hif_read_reg(wilc, WILC_GP_REG_0, ®); if (!ret) { PRINT_ER("Error while reading reg\n"); release_bus(wilc, RELEASE_ALLOW_SLEEP); } PRINT_ER("Writing ABORT reg\n"); - ret = p->hif_func.hif_write_reg(wilc, WILC_GP_REG_0, + ret = wilc->hif_func->hif_write_reg(wilc, WILC_GP_REG_0, (reg | ABORT_INT)); if (!ret) { PRINT_ER("Error while writing reg\n"); release_bus(wilc, RELEASE_ALLOW_SLEEP); } release_bus(wilc, RELEASE_ALLOW_SLEEP); - p->hif_func.hif_deinit(NULL); + wilc->hif_func->hif_deinit(NULL); } static int wilc_wlan_cfg_commit(struct wilc *wilc, int type, u32 drv_handler) @@ -1566,18 +1560,18 @@ static u32 init_chip(struct net_device *dev) chipid = wilc_get_chipid(wilc, true); if ((chipid & 0xfff) != 0xa0) { - ret = g_wlan.hif_func.hif_read_reg(wilc, 0x1118, ®); + ret = wilc->hif_func->hif_read_reg(wilc, 0x1118, ®); if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail read reg 0x1118 ...\n"); return ret; } reg |= BIT(0); - ret = g_wlan.hif_func.hif_write_reg(wilc, 0x1118, reg); + ret = wilc->hif_func->hif_write_reg(wilc, 0x1118, reg); if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail write reg 0x1118 ...\n"); return ret; } - ret = g_wlan.hif_func.hif_write_reg(wilc, 0xc0000, 0x71); + ret = wilc->hif_func->hif_write_reg(wilc, 0xc0000, 0x71); if (!ret) { wilc_debug(N_ERR, "[wilc start]: fail write reg 0xc0000 ...\n"); return ret; @@ -1596,8 +1590,8 @@ u32 wilc_get_chipid(struct wilc *wilc, u8 update) u32 rfrevid; if (chipid == 0 || update != 0) { - g_wlan.hif_func.hif_read_reg(wilc, 0x1000, &tempchipid); - g_wlan.hif_func.hif_read_reg(wilc, 0x13f4, &rfrevid); + wilc->hif_func->hif_read_reg(wilc, 0x1000, &tempchipid); + wilc->hif_func->hif_read_reg(wilc, 0x13f4, &rfrevid); if (!ISWILC1000(tempchipid)) { chipid = 0; goto _fail_; @@ -1634,8 +1628,7 @@ int wilc_wlan_init(struct net_device *dev) memset((void *)&g_wlan, 0, sizeof(wilc_wlan_dev_t)); g_wlan.io_type = wilc->io_type; - g_wlan.hif_func = *wilc->ops; - if (!g_wlan.hif_func.hif_init(wilc, wilc_debug)) { + if (!wilc->hif_func->hif_init(wilc, wilc_debug)) { ret = -EIO; goto _fail_; } @@ -1695,7 +1688,7 @@ u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value) wilc = nic->wilc; mutex_lock(&wilc->hif_cs); - ret = (&g_wlan)->hif_func.hif_read_reg(wilc, WILC_CHANGING_VIR_IF, + ret = wilc->hif_func->hif_read_reg(wilc, WILC_CHANGING_VIR_IF, ®); if (!ret) PRINT_ER("Error while Reading reg WILC_CHANGING_VIR_IF\n"); @@ -1705,7 +1698,7 @@ u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value) else reg &= ~BIT(31); - ret = (&g_wlan)->hif_func.hif_write_reg(wilc, WILC_CHANGING_VIR_IF, + ret = wilc->hif_func->hif_write_reg(wilc, WILC_CHANGING_VIR_IF, reg); if (!ret) From a3629a9ee36a6f8fcbc764e811a2fe0e492f739f Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:10 +0900 Subject: [PATCH 641/843] staging: wilc1000: remove io_type of wilc_wlan_dev_t io_type of wilc_wlan_dev_t is unneeded, we can use io_type of struct wilc. Remove io_type of wilc_wlan_dev_t and use io_type of wilc. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index b9bedc8010fc..37879cd40b49 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -5,7 +5,6 @@ typedef struct { int quit; - int io_type; int cfg_frame_in_use; struct wilc_cfg_frame cfg_frame; u32 cfg_frame_offset; @@ -573,7 +572,7 @@ static inline void chip_wakeup(struct wilc *wilc) u32 reg, clk_status_reg, trials = 0; u32 sleep_time; - if ((g_wlan.io_type & 0x1) == HIF_SPI) { + if ((wilc->io_type & 0x1) == HIF_SPI) { do { wilc->hif_func->hif_read_reg(wilc, 1, ®); wilc->hif_func->hif_write_reg(wilc, 1, reg | BIT(1)); @@ -587,7 +586,7 @@ static inline void chip_wakeup(struct wilc *wilc) } while ((wilc_get_chipid(wilc, true) == 0) && ((++trials % 3) == 0)); } while (wilc_get_chipid(wilc, true) == 0); - } else if ((g_wlan.io_type & 0x1) == HIF_SDIO) { + } else if ((wilc->io_type & 0x1) == HIF_SDIO) { wilc->hif_func->hif_read_reg(wilc, 0xf0, ®); do { wilc->hif_func->hif_write_reg(wilc, 0xf0, @@ -636,12 +635,12 @@ static inline void chip_wakeup(struct wilc *wilc) u32 reg, trials = 0; do { - if ((g_wlan.io_type & 0x1) == HIF_SPI) { + if ((wilc->io_type & 0x1) == HIF_SPI) { wilc->hif_func->hif_read_reg(wilc, 1, ®); wilc->hif_func->hif_write_reg(wilc, 1, reg & ~BIT(1)); wilc->hif_func->hif_write_reg(wilc, 1, reg | BIT(1)); wilc->hif_func->hif_write_reg(wilc, 1, reg & ~BIT(1)); - } else if ((g_wlan.io_type & 0x1) == HIF_SDIO) { + } else if ((wilc->io_type & 0x1) == HIF_SDIO) { wilc->hif_func->hif_read_reg(wilc, 0xf0, ®); wilc->hif_func->hif_write_reg(wilc, 0xf0, reg & ~BIT(0)); @@ -1061,7 +1060,7 @@ static void wilc_pllupdate_isr_ext(struct wilc *wilc, u32 int_stats) wilc->hif_func->hif_clear_int_ext(wilc, PLL_INT_CLR); - if (g_wlan.io_type == HIF_SDIO) + if (wilc->io_type == HIF_SDIO) mdelay(WILC_PLL_TO_SDIO); else mdelay(WILC_PLL_TO_SPI); @@ -1225,15 +1224,14 @@ _fail_1: int wilc_wlan_start(struct wilc *wilc) { - wilc_wlan_dev_t *p = &g_wlan; u32 reg = 0; int ret; u32 chipid; - if (p->io_type == HIF_SDIO) { + if (wilc->io_type == HIF_SDIO) { reg = 0; reg |= BIT(3); - } else if (p->io_type == HIF_SPI) { + } else if (wilc->io_type == HIF_SPI) { reg = 1; } acquire_bus(wilc, ACQUIRE_ONLY); @@ -1245,7 +1243,7 @@ int wilc_wlan_start(struct wilc *wilc) return ret; } reg = 0; - if (p->io_type == HIF_SDIO && wilc->dev_irq_num) + if (wilc->io_type == HIF_SDIO && wilc->dev_irq_num) reg |= WILC_HAVE_SDIO_IRQ_GPIO; #ifdef WILC_DISABLE_PMU @@ -1627,7 +1625,6 @@ int wilc_wlan_init(struct net_device *dev) PRINT_D(INIT_DBG, "Initializing WILC_Wlan ...\n"); memset((void *)&g_wlan, 0, sizeof(wilc_wlan_dev_t)); - g_wlan.io_type = wilc->io_type; if (!wilc->hif_func->hif_init(wilc, wilc_debug)) { ret = -EIO; goto _fail_; From 21ee5092cab9f6512d8b73afe79a74433d2363fb Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:11 +0900 Subject: [PATCH 642/843] staging: wilc1000: remove unused varialbe tx_buffer_offset This patch removes unused variable tx_buffer_offset of wilc_wlan_dev_t. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 37879cd40b49..502b49976290 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -13,7 +13,6 @@ typedef struct { u8 *rx_buffer; u32 rx_buffer_offset; u8 *tx_buffer; - u32 tx_buffer_offset; unsigned long txq_spinlock_flags; From 67e2a07ed8008b81fdb98a998ceab66dc7af5999 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:12 +0900 Subject: [PATCH 643/843] staging: wilc1000: move all of wilc_wlan_dev_t to struct wilc linux_wlan.c and wilc_wlan.c was separated into two part at the beginning to support various platforms. They are in charge of send/receive control and packet data, so they will be merged into one file wlan.c later. First of all, wilc_wlan_dev_t which is used as global variable of wilc_wlan.c will be moved into struct wilc. This patch moves all members of wilc_wlan_dev_t to struct wilc and use wilc instead of g_wlan. Finally remove wilc_wlan_dev_t and g_wlan. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 22 ++ drivers/staging/wilc1000/wilc_wlan.c | 269 ++++++++---------- 2 files changed, 138 insertions(+), 153 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index b593b6461160..68a159f36f14 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -181,6 +181,28 @@ struct wilc { struct task_struct *txq_thread; + int quit; + int cfg_frame_in_use; + struct wilc_cfg_frame cfg_frame; + u32 cfg_frame_offset; + int cfg_seq_no; + + u8 *rx_buffer; + u32 rx_buffer_offset; + u8 *tx_buffer; + + unsigned long txq_spinlock_flags; + + struct txq_entry_t *txq_head; + struct txq_entry_t *txq_tail; + int txq_entries; + int txq_exit; + + struct rxq_entry_t *rxq_head; + struct rxq_entry_t *rxq_tail; + int rxq_entries; + int rxq_exit; + unsigned char eth_src_address[NUM_CONCURRENT_IFC][6]; const struct firmware *firmware; diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 502b49976290..0427349354f4 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -3,32 +3,6 @@ #include "wilc_wfi_netdevice.h" #include "wilc_wlan_cfg.h" -typedef struct { - int quit; - int cfg_frame_in_use; - struct wilc_cfg_frame cfg_frame; - u32 cfg_frame_offset; - int cfg_seq_no; - - u8 *rx_buffer; - u32 rx_buffer_offset; - u8 *tx_buffer; - - unsigned long txq_spinlock_flags; - - struct txq_entry_t *txq_head; - struct txq_entry_t *txq_tail; - int txq_entries; - int txq_exit; - - struct rxq_entry_t *rxq_head; - struct rxq_entry_t *rxq_tail; - int rxq_entries; - int rxq_exit; -} wilc_wlan_dev_t; - -static wilc_wlan_dev_t g_wlan; - #ifdef WILC_OPTIMIZE_SLEEP_INT static inline void chip_allow_sleep(struct wilc *wilc); #endif @@ -76,21 +50,20 @@ static inline void release_bus(struct wilc *wilc, BUS_RELEASE_T release) #ifdef TCP_ACK_FILTER static void wilc_wlan_txq_remove(struct txq_entry_t *tqe) { - wilc_wlan_dev_t *p = &g_wlan; - if (tqe == p->txq_head) { - p->txq_head = tqe->next; - if (p->txq_head) - p->txq_head->prev = NULL; - } else if (tqe == p->txq_tail) { - p->txq_tail = (tqe->prev); - if (p->txq_tail) - p->txq_tail->next = NULL; + if (tqe == wilc->txq_head) { + wilc->txq_head = tqe->next; + if (wilc->txq_head) + wilc->txq_head->prev = NULL; + } else if (tqe == wilc->txq_tail) { + wilc->txq_tail = (tqe->prev); + if (wilc->txq_tail) + wilc->txq_tail->next = NULL; } else { tqe->prev->next = tqe->next; tqe->next->prev = tqe->prev; } - p->txq_entries -= 1; + wilc->txq_entries -= 1; } #endif @@ -98,7 +71,6 @@ static struct txq_entry_t * wilc_wlan_txq_remove_from_head(struct net_device *dev) { struct txq_entry_t *tqe; - wilc_wlan_dev_t *p = &g_wlan; unsigned long flags; perInterface_wlan_t *nic; struct wilc *wilc; @@ -107,13 +79,13 @@ wilc_wlan_txq_remove_from_head(struct net_device *dev) wilc = nic->wilc; spin_lock_irqsave(&wilc->txq_spinlock, flags); - if (p->txq_head) { - tqe = p->txq_head; - p->txq_head = tqe->next; - if (p->txq_head) - p->txq_head->prev = NULL; + if (wilc->txq_head) { + tqe = wilc->txq_head; + wilc->txq_head = tqe->next; + if (wilc->txq_head) + wilc->txq_head->prev = NULL; - p->txq_entries -= 1; + wilc->txq_entries -= 1; } else { tqe = NULL; } @@ -124,7 +96,6 @@ wilc_wlan_txq_remove_from_head(struct net_device *dev) static void wilc_wlan_txq_add_to_tail(struct net_device *dev, struct txq_entry_t *tqe) { - wilc_wlan_dev_t *p = &g_wlan; unsigned long flags; perInterface_wlan_t *nic; struct wilc *wilc; @@ -134,19 +105,19 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev, spin_lock_irqsave(&wilc->txq_spinlock, flags); - if (!p->txq_head) { + if (!wilc->txq_head) { tqe->next = NULL; tqe->prev = NULL; - p->txq_head = tqe; - p->txq_tail = tqe; + wilc->txq_head = tqe; + wilc->txq_tail = tqe; } else { tqe->next = NULL; - tqe->prev = p->txq_tail; - p->txq_tail->next = tqe; - p->txq_tail = tqe; + tqe->prev = wilc->txq_tail; + wilc->txq_tail->next = tqe; + wilc->txq_tail = tqe; } - p->txq_entries += 1; - PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", p->txq_entries); + wilc->txq_entries += 1; + PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", wilc->txq_entries); spin_unlock_irqrestore(&wilc->txq_spinlock, flags); @@ -157,7 +128,6 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev, static int wilc_wlan_txq_add_to_head(struct wilc *wilc, struct txq_entry_t *tqe) { - wilc_wlan_dev_t *p = &g_wlan; unsigned long flags; if (wilc_lock_timeout(wilc, &wilc->txq_add_to_head_cs, CFG_PKTS_TIMEOUT)) @@ -165,19 +135,19 @@ static int wilc_wlan_txq_add_to_head(struct wilc *wilc, struct txq_entry_t *tqe) spin_lock_irqsave(&wilc->txq_spinlock, flags); - if (!p->txq_head) { + if (!wilc->txq_head) { tqe->next = NULL; tqe->prev = NULL; - p->txq_head = tqe; - p->txq_tail = tqe; + wilc->txq_head = tqe; + wilc->txq_tail = tqe; } else { - tqe->next = p->txq_head; + tqe->next = wilc->txq_head; tqe->prev = NULL; - p->txq_head->prev = tqe; - p->txq_head = tqe; + wilc->txq_head->prev = tqe; + wilc->txq_head = tqe; } - p->txq_entries += 1; - PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", p->txq_entries); + wilc->txq_entries += 1; + PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", wilc->txq_entries); spin_unlock_irqrestore(&wilc->txq_spinlock, flags); up(&wilc->txq_add_to_head_cs); @@ -253,7 +223,6 @@ static inline int add_tcp_pending_ack(u32 ack, u32 session_index, } static inline int remove_TCP_related(struct wilc *wilc) { - wilc_wlan_dev_t *p = &g_wlan; unsigned long flags; spin_lock_irqsave(&wilc->txq_spinlock, flags); @@ -269,7 +238,6 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe) u8 *buffer = tqe->buffer; unsigned short h_proto; int i; - wilc_wlan_dev_t *p = &g_wlan; unsigned long flags; perInterface_wlan_t *nic; struct wilc *wilc; @@ -337,12 +305,11 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) struct wilc *wilc; u32 i = 0; u32 dropped = 0; - wilc_wlan_dev_t *p = &g_wlan; nic = netdev_priv(dev); wilc = nic->wilc; - spin_lock_irqsave(&wilc->txq_spinlock, p->txq_spinlock_flags); + spin_lock_irqsave(&wilc->txq_spinlock, wilc->txq_spinlock_flags); for (i = pending_base; i < (pending_base + pending_acks); i++) { if (pending_acks_info[i].ack_num < ack_session_info[pending_acks_info[i].session_index].bigger_ack_num) { struct txq_entry_t *tqe; @@ -369,7 +336,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) else pending_base = 0; - spin_unlock_irqrestore(&wilc->txq_spinlock, p->txq_spinlock_flags); + spin_unlock_irqrestore(&wilc->txq_spinlock, wilc->txq_spinlock_flags); while (dropped > 0) { wilc_lock_timeout(wilc, &wilc->txq_event, 1); @@ -396,11 +363,10 @@ static bool is_tcp_ack_filter_enabled(void) static int wilc_wlan_txq_add_cfg_pkt(struct wilc *wilc, u8 *buffer, u32 buffer_size) { - wilc_wlan_dev_t *p = &g_wlan; struct txq_entry_t *tqe; PRINT_D(TX_DBG, "Adding config packet ...\n"); - if (p->quit) { + if (wilc->quit) { PRINT_D(TX_DBG, "Return due to clear function\n"); up(&wilc->cfg_event); return 0; @@ -430,10 +396,13 @@ static int wilc_wlan_txq_add_cfg_pkt(struct wilc *wilc, u8 *buffer, u32 buffer_s int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, u32 buffer_size, wilc_tx_complete_func_t func) { - wilc_wlan_dev_t *p = &g_wlan; struct txq_entry_t *tqe; + perInterface_wlan_t *nic = netdev_priv(dev); + struct wilc *wilc; - if (p->quit) + wilc = nic->wilc; + + if (wilc->quit) return 0; tqe = kmalloc(sizeof(*tqe), GFP_ATOMIC); @@ -453,16 +422,19 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, tcp_process(dev, tqe); #endif wilc_wlan_txq_add_to_tail(dev, tqe); - return p->txq_entries; + return wilc->txq_entries; } int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, u32 buffer_size, wilc_tx_complete_func_t func) { - wilc_wlan_dev_t *p = &g_wlan; struct txq_entry_t *tqe; + perInterface_wlan_t *nic = netdev_priv(dev); + struct wilc *wilc; - if (p->quit) + wilc = nic->wilc; + + if (wilc->quit) return 0; tqe = kmalloc(sizeof(*tqe), GFP_KERNEL); @@ -484,13 +456,12 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, static struct txq_entry_t *wilc_wlan_txq_get_first(struct wilc *wilc) { - wilc_wlan_dev_t *p = &g_wlan; struct txq_entry_t *tqe; unsigned long flags; spin_lock_irqsave(&wilc->txq_spinlock, flags); - tqe = p->txq_head; + tqe = wilc->txq_head; spin_unlock_irqrestore(&wilc->txq_spinlock, flags); @@ -512,41 +483,39 @@ static struct txq_entry_t *wilc_wlan_txq_get_next(struct wilc *wilc, static int wilc_wlan_rxq_add(struct wilc *wilc, struct rxq_entry_t *rqe) { - wilc_wlan_dev_t *p = &g_wlan; - if (p->quit) + if (wilc->quit) return 0; mutex_lock(&wilc->rxq_cs); - if (!p->rxq_head) { + if (!wilc->rxq_head) { PRINT_D(RX_DBG, "Add to Queue head\n"); rqe->next = NULL; - p->rxq_head = rqe; - p->rxq_tail = rqe; + wilc->rxq_head = rqe; + wilc->rxq_tail = rqe; } else { PRINT_D(RX_DBG, "Add to Queue tail\n"); - p->rxq_tail->next = rqe; + wilc->rxq_tail->next = rqe; rqe->next = NULL; - p->rxq_tail = rqe; + wilc->rxq_tail = rqe; } - p->rxq_entries += 1; - PRINT_D(RX_DBG, "Number of queue entries: %d\n", p->rxq_entries); + wilc->rxq_entries += 1; + PRINT_D(RX_DBG, "Number of queue entries: %d\n", wilc->rxq_entries); mutex_unlock(&wilc->rxq_cs); - return p->rxq_entries; + return wilc->rxq_entries; } static struct rxq_entry_t *wilc_wlan_rxq_remove(struct wilc *wilc) { - wilc_wlan_dev_t *p = &g_wlan; PRINT_D(RX_DBG, "Getting rxQ element\n"); - if (p->rxq_head) { + if (wilc->rxq_head) { struct rxq_entry_t *rqe; mutex_lock(&wilc->rxq_cs); - rqe = p->rxq_head; - p->rxq_head = p->rxq_head->next; - p->rxq_entries -= 1; + rqe = wilc->rxq_head; + wilc->rxq_head = wilc->rxq_head->next; + wilc->rxq_entries -= 1; PRINT_D(RX_DBG, "RXQ entries decreased\n"); mutex_unlock(&wilc->rxq_cs); return rqe; @@ -696,11 +665,10 @@ void wilc_chip_sleep_manually(struct wilc *wilc) int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) { - wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)&g_wlan; int i, entries = 0; u32 sum; u32 reg; - u8 *txb = p->tx_buffer; + u8 *txb; u32 offset = 0; int vmm_sz = 0; struct txq_entry_t *tqe; @@ -714,9 +682,10 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) nic = netdev_priv(dev); wilc = nic->wilc; - p->txq_exit = 0; + txb = wilc->tx_buffer; + wilc->txq_exit = 0; do { - if (p->quit) + if (wilc->quit) break; wilc_lock_timeout(wilc, &wilc->txq_add_to_head_cs, @@ -800,7 +769,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) usleep_range(3000, 3000); acquire_bus(wilc, ACQUIRE_AND_WAKEUP); } - } while (!p->quit); + } while (!wilc->quit); if (!ret) goto _end_; @@ -945,23 +914,22 @@ _end_: } while (0); up(&wilc->txq_add_to_head_cs); - p->txq_exit = 1; + wilc->txq_exit = 1; PRINT_D(TX_DBG, "THREAD: Exiting txq\n"); - *txq_count = p->txq_entries; + *txq_count = wilc->txq_entries; return ret; } static void wilc_wlan_handle_rxq(struct wilc *wilc) { - wilc_wlan_dev_t *p = &g_wlan; int offset = 0, size, has_packet = 0; u8 *buffer; struct rxq_entry_t *rqe; - p->rxq_exit = 0; + wilc->rxq_exit = 0; do { - if (p->quit) { + if (wilc->quit) { PRINT_D(RX_DBG, "exit 1st do-while due to Clean_UP function\n"); up(&wilc->cfg_event); break; @@ -1022,8 +990,8 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) wilc_wlan_cfg_indicate_rx(&buffer[pkt_offset + offset], pkt_len, &rsp); if (rsp.type == WILC_CFG_RSP) { - PRINT_D(RX_DBG, "p->cfg_seq_no = %d - rsp.seq_no = %d\n", p->cfg_seq_no, rsp.seq_no); - if (p->cfg_seq_no == rsp.seq_no) + PRINT_D(RX_DBG, "wilc->cfg_seq_no = %d - rsp.seq_no = %d\n", wilc->cfg_seq_no, rsp.seq_no); + if (wilc->cfg_seq_no == rsp.seq_no) up(&wilc->cfg_event); } else if (rsp.type == WILC_CFG_RSP_STATUS) { wilc_mac_indicate(wilc, WILC_MAC_INDICATE_STATUS); @@ -1044,7 +1012,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) } while (1); - p->rxq_exit = 1; + wilc->rxq_exit = 1; PRINT_D(RX_DBG, "THREAD: Exiting RX thread\n"); } @@ -1080,8 +1048,7 @@ static void wilc_sleeptimer_isr_ext(struct wilc *wilc, u32 int_stats1) static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) { - wilc_wlan_dev_t *p = &g_wlan; - u32 offset = p->rx_buffer_offset; + u32 offset = wilc->rx_buffer_offset; u8 *buffer = NULL; u32 size; u32 retries = 0; @@ -1103,8 +1070,8 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) if (LINUX_RX_SIZE - offset < size) offset = 0; - if (p->rx_buffer) { - buffer = &p->rx_buffer[offset]; + if (wilc->rx_buffer) { + buffer = &wilc->rx_buffer[offset]; } else { wilc_debug(N_ERR, "[wilc isr]: fail Rx Buffer is NULL...drop the packets (%d)\n", size); goto _end_; @@ -1121,7 +1088,7 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) _end_: if (ret) { offset += size; - p->rx_buffer_offset = offset; + wilc->rx_buffer_offset = offset; rqe = kmalloc(sizeof(*rqe), GFP_KERNEL); if (rqe) { rqe->buffer = buffer; @@ -1377,7 +1344,6 @@ int wilc_wlan_stop(struct wilc *wilc) void wilc_wlan_cleanup(struct net_device *dev) { - wilc_wlan_dev_t *p = &g_wlan; struct txq_entry_t *tqe; struct rxq_entry_t *rqe; u32 reg = 0; @@ -1388,7 +1354,7 @@ void wilc_wlan_cleanup(struct net_device *dev) nic = netdev_priv(dev); wilc = nic->wilc; - p->quit = 1; + wilc->quit = 1; do { tqe = wilc_wlan_txq_remove_from_head(dev); if (!tqe) @@ -1405,9 +1371,9 @@ void wilc_wlan_cleanup(struct net_device *dev) kfree(rqe); } while (1); - kfree(p->rx_buffer); - p->rx_buffer = NULL; - kfree(p->tx_buffer); + kfree(wilc->rx_buffer); + wilc->rx_buffer = NULL; + kfree(wilc->tx_buffer); acquire_bus(wilc, ACQUIRE_AND_WAKEUP); @@ -1429,10 +1395,9 @@ void wilc_wlan_cleanup(struct net_device *dev) static int wilc_wlan_cfg_commit(struct wilc *wilc, int type, u32 drv_handler) { - wilc_wlan_dev_t *p = &g_wlan; - struct wilc_cfg_frame *cfg = &p->cfg_frame; - int total_len = p->cfg_frame_offset + 4 + DRIVER_HANDLER_SIZE; - int seq_no = p->cfg_seq_no % 256; + struct wilc_cfg_frame *cfg = &wilc->cfg_frame; + int total_len = wilc->cfg_frame_offset + 4 + DRIVER_HANDLER_SIZE; + int seq_no = wilc->cfg_seq_no % 256; int driver_handler = (u32)drv_handler; if (type == WILC_CFG_SET) @@ -1446,7 +1411,7 @@ static int wilc_wlan_cfg_commit(struct wilc *wilc, int type, u32 drv_handler) cfg->wid_header[5] = (u8)(driver_handler >> 8); cfg->wid_header[6] = (u8)(driver_handler >> 16); cfg->wid_header[7] = (u8)(driver_handler >> 24); - p->cfg_seq_no = seq_no; + wilc->cfg_seq_no = seq_no; if (!wilc_wlan_txq_add_cfg_pkt(wilc, &cfg->wid_header[0], total_len)) return -1; @@ -1457,27 +1422,26 @@ static int wilc_wlan_cfg_commit(struct wilc *wilc, int type, u32 drv_handler) int wilc_wlan_cfg_set(struct wilc *wilc, int start, u32 wid, u8 *buffer, u32 buffer_size, int commit, u32 drv_handler) { - wilc_wlan_dev_t *p = &g_wlan; u32 offset; int ret_size; - if (p->cfg_frame_in_use) + if (wilc->cfg_frame_in_use) return 0; if (start) - p->cfg_frame_offset = 0; + wilc->cfg_frame_offset = 0; - offset = p->cfg_frame_offset; - ret_size = wilc_wlan_cfg_set_wid(p->cfg_frame.frame, offset, (u16)wid, - buffer, buffer_size); + offset = wilc->cfg_frame_offset; + ret_size = wilc_wlan_cfg_set_wid(wilc->cfg_frame.frame, offset, + (u16)wid, buffer, buffer_size); offset += ret_size; - p->cfg_frame_offset = offset; + wilc->cfg_frame_offset = offset; if (commit) { PRINT_D(TX_DBG, "[WILC]PACKET Commit with sequence number %d\n", - p->cfg_seq_no); + wilc->cfg_seq_no); PRINT_D(RX_DBG, "Processing cfg_set()\n"); - p->cfg_frame_in_use = 1; + wilc->cfg_frame_in_use = 1; if (wilc_wlan_cfg_commit(wilc, WILC_CFG_SET, drv_handler)) ret_size = 0; @@ -1487,9 +1451,9 @@ int wilc_wlan_cfg_set(struct wilc *wilc, int start, u32 wid, u8 *buffer, PRINT_D(TX_DBG, "Set Timed Out\n"); ret_size = 0; } - p->cfg_frame_in_use = 0; - p->cfg_frame_offset = 0; - p->cfg_seq_no += 1; + wilc->cfg_frame_in_use = 0; + wilc->cfg_frame_offset = 0; + wilc->cfg_seq_no += 1; } return ret_size; @@ -1498,23 +1462,23 @@ int wilc_wlan_cfg_set(struct wilc *wilc, int start, u32 wid, u8 *buffer, int wilc_wlan_cfg_get(struct wilc *wilc, int start, u32 wid, int commit, u32 drv_handler) { - wilc_wlan_dev_t *p = &g_wlan; u32 offset; int ret_size; - if (p->cfg_frame_in_use) + if (wilc->cfg_frame_in_use) return 0; if (start) - p->cfg_frame_offset = 0; + wilc->cfg_frame_offset = 0; - offset = p->cfg_frame_offset; - ret_size = wilc_wlan_cfg_get_wid(p->cfg_frame.frame, offset, (u16)wid); + offset = wilc->cfg_frame_offset; + ret_size = wilc_wlan_cfg_get_wid(wilc->cfg_frame.frame, offset, + (u16)wid); offset += ret_size; - p->cfg_frame_offset = offset; + wilc->cfg_frame_offset = offset; if (commit) { - p->cfg_frame_in_use = 1; + wilc->cfg_frame_in_use = 1; if (wilc_wlan_cfg_commit(wilc, WILC_CFG_QUERY, drv_handler)) ret_size = 0; @@ -1525,9 +1489,9 @@ int wilc_wlan_cfg_get(struct wilc *wilc, int start, u32 wid, int commit, ret_size = 0; } PRINT_D(GENERIC_DBG, "[WILC]Get Response received\n"); - p->cfg_frame_in_use = 0; - p->cfg_frame_offset = 0; - p->cfg_seq_no += 1; + wilc->cfg_frame_in_use = 0; + wilc->cfg_frame_offset = 0; + wilc->cfg_seq_no += 1; } return ret_size; @@ -1623,7 +1587,6 @@ int wilc_wlan_init(struct net_device *dev) PRINT_D(INIT_DBG, "Initializing WILC_Wlan ...\n"); - memset((void *)&g_wlan, 0, sizeof(wilc_wlan_dev_t)); if (!wilc->hif_func->hif_init(wilc, wilc_debug)) { ret = -EIO; goto _fail_; @@ -1634,20 +1597,20 @@ int wilc_wlan_init(struct net_device *dev) goto _fail_; } - if (!g_wlan.tx_buffer) - g_wlan.tx_buffer = kmalloc(LINUX_TX_SIZE, GFP_KERNEL); - PRINT_D(TX_DBG, "g_wlan.tx_buffer = %p\n", g_wlan.tx_buffer); + if (!wilc->tx_buffer) + wilc->tx_buffer = kmalloc(LINUX_TX_SIZE, GFP_KERNEL); + PRINT_D(TX_DBG, "wilc->tx_buffer = %p\n", wilc->tx_buffer); - if (!g_wlan.tx_buffer) { + if (!wilc->tx_buffer) { ret = -ENOBUFS; PRINT_ER("Can't allocate Tx Buffer"); goto _fail_; } - if (!g_wlan.rx_buffer) - g_wlan.rx_buffer = kmalloc(LINUX_RX_SIZE, GFP_KERNEL); - PRINT_D(TX_DBG, "g_wlan.rx_buffer =%p\n", g_wlan.rx_buffer); - if (!g_wlan.rx_buffer) { + if (!wilc->rx_buffer) + wilc->rx_buffer = kmalloc(LINUX_RX_SIZE, GFP_KERNEL); + PRINT_D(TX_DBG, "wilc->rx_buffer =%p\n", wilc->rx_buffer); + if (!wilc->rx_buffer) { ret = -ENOBUFS; PRINT_ER("Can't allocate Rx Buffer"); goto _fail_; @@ -1665,10 +1628,10 @@ int wilc_wlan_init(struct net_device *dev) _fail_: - kfree(g_wlan.rx_buffer); - g_wlan.rx_buffer = NULL; - kfree(g_wlan.tx_buffer); - g_wlan.tx_buffer = NULL; + kfree(wilc->rx_buffer); + wilc->rx_buffer = NULL; + kfree(wilc->tx_buffer); + wilc->tx_buffer = NULL; return ret; } From ac1da162e488e90be001ebb4057aaf01e565dd28 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:13 +0900 Subject: [PATCH 644/843] staging: wilc1000: sdio/spi: use device print api instead of custom one This patch use device print api instead of driver defined print. Remove varialbe dPrint as well. String "[wilc sdio]" and "[wilc spi]" are also removed from all the print statment if exist because it shows which device the message is related to. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan_sdio.c | 18 +-- drivers/staging/wilc1000/linux_wlan_spi.c | 24 ++-- drivers/staging/wilc1000/wilc_sdio.c | 151 ++++++++++++++------- drivers/staging/wilc1000/wilc_spi.c | 142 +++++++++++-------- 4 files changed, 213 insertions(+), 122 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index ae31f7d89693..66cdca23b1b4 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -52,7 +52,7 @@ int wilc_sdio_cmd52(struct wilc *wilc, sdio_cmd52_t *cmd) sdio_release_host(func); if (ret < 0) { - PRINT_ER("wilc_sdio_cmd52..failed, err(%d)\n", ret); + dev_err(&func->dev, "wilc_sdio_cmd52..failed, err(%d)\n", ret); return 0; } return 1; @@ -83,7 +83,7 @@ int wilc_sdio_cmd53(struct wilc *wilc, sdio_cmd53_t *cmd) if (ret < 0) { - PRINT_ER("wilc_sdio_cmd53..failed, err(%d)\n", ret); + dev_err(&func->dev, "wilc_sdio_cmd53..failed, err(%d)\n", ret); return 0; } @@ -102,16 +102,16 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id gpio = GPIO_NUM; } - PRINT_D(INIT_DBG, "Initializing netdev\n"); + dev_dbg(&func->dev, "Initializing netdev\n"); if (wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, gpio, &wilc_hif_sdio)) { - PRINT_ER("Couldn't initialize netdev\n"); + dev_err(&func->dev, "Couldn't initialize netdev\n"); return -1; } sdio_set_drvdata(func, wilc); wilc->dev = &func->dev; - printk("Driver Initializing success\n"); + dev_info(&func->dev, "Driver Initializing success\n"); return 0; } @@ -139,7 +139,7 @@ int wilc_sdio_enable_interrupt(struct wilc *dev) sdio_release_host(func); if (ret < 0) { - PRINT_ER("can't claim sdio_irq, err(%d)\n", ret); + dev_err(&func->dev, "can't claim sdio_irq, err(%d)\n", ret); ret = -EIO; } return ret; @@ -150,16 +150,16 @@ void wilc_sdio_disable_interrupt(struct wilc *dev) struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev); int ret; - PRINT_D(INIT_DBG, "wilc_sdio_disable_interrupt IN\n"); + dev_dbg(&func->dev, "wilc_sdio_disable_interrupt IN\n"); sdio_claim_host(func); ret = sdio_release_irq(func); if (ret < 0) { - PRINT_ER("can't release sdio_irq, err(%d)\n", ret); + dev_err(&func->dev, "can't release sdio_irq, err(%d)\n", ret); } sdio_release_host(func); - PRINT_D(INIT_DBG, "wilc_sdio_disable_interrupt OUT\n"); + dev_info(&func->dev, "wilc_sdio_disable_interrupt OUT\n"); } int wilc_sdio_init(void) diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index f3ffc9e6d626..01fa6fa0cc1d 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -83,7 +83,7 @@ int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len) return -ENOMEM; tr.rx_buf = r_buffer; - PRINT_D(BUS_DBG, "Request writing %d bytes\n", len); + dev_dbg(&spi->dev, "Request writing %d bytes\n", len); memset(&msg, 0, sizeof(msg)); spi_message_init(&msg); @@ -95,13 +95,17 @@ int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len) ret = spi_sync(spi, &msg); if (ret < 0) { - PRINT_ER("SPI transaction failed\n"); + dev_err(&spi->dev, "SPI transaction failed\n"); } kfree(r_buffer); } else { - PRINT_ER("can't write data with the following length: %d\n", len); - PRINT_ER("FAILED due to NULL buffer or ZERO length check the following length: %d\n", len); + dev_err(&spi->dev, + "can't write data with the following length: %d\n", + len); + dev_err(&spi->dev, + "FAILED due to NULL buffer or ZERO length check the following length: %d\n", + len); ret = -1; } @@ -141,11 +145,13 @@ int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen) ret = spi_sync(spi, &msg); if (ret < 0) { - PRINT_ER("SPI transaction failed\n"); + dev_err(&spi->dev, "SPI transaction failed\n"); } kfree(t_buffer); } else { - PRINT_ER("can't read data with the following length: %u\n", rlen); + dev_err(&spi->dev, + "can't read data with the following length: %u\n", + rlen); ret = -1; } /* change return value to match WILC interface */ @@ -178,10 +184,12 @@ int wilc_spi_write_read(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen) spi_message_add_tail(&tr, &msg); ret = spi_sync(spi, &msg); if (ret < 0) { - PRINT_ER("SPI transaction failed\n"); + dev_err(&spi->dev, "SPI transaction failed\n"); } } else { - PRINT_ER("can't read data with the following length: %u\n", rlen); + dev_err(&spi->dev, + "can't read data with the following length: %u\n", + rlen); ret = -1; } /* change return value to match WILC interface */ diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index a9ad49f70d39..dfa3d3a7fcac 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -18,7 +18,6 @@ typedef struct { bool irq_gpio; u32 block_size; - wilc_debug_func dPrint; int nint; #define MAX_NUN_INT_THRPT_ENH2 (5) /* Max num interrupts allowed in registers 0xf7, 0xf8 */ int has_thrpt_enh3; @@ -37,6 +36,7 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data); static int sdio_set_func0_csa_address(struct wilc *wilc, u32 adr) { + struct sdio_func *func = dev_to_sdio_func(wilc->dev); sdio_cmd52_t cmd; /** @@ -48,21 +48,21 @@ static int sdio_set_func0_csa_address(struct wilc *wilc, u32 adr) cmd.address = 0x10c; cmd.data = (u8)adr; if (!wilc_sdio_cmd52(wilc, &cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10c data...\n"); + dev_err(&func->dev, "Failed cmd52, set 0x10c data...\n"); goto _fail_; } cmd.address = 0x10d; cmd.data = (u8)(adr >> 8); if (!wilc_sdio_cmd52(wilc, &cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10d data...\n"); + dev_err(&func->dev, "Failed cmd52, set 0x10d data...\n"); goto _fail_; } cmd.address = 0x10e; cmd.data = (u8)(adr >> 16); if (!wilc_sdio_cmd52(wilc, &cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10e data...\n"); + dev_err(&func->dev, "Failed cmd52, set 0x10e data...\n"); goto _fail_; } @@ -73,6 +73,7 @@ _fail_: static int sdio_set_func0_block_size(struct wilc *wilc, u32 block_size) { + struct sdio_func *func = dev_to_sdio_func(wilc->dev); sdio_cmd52_t cmd; cmd.read_write = 1; @@ -81,14 +82,14 @@ static int sdio_set_func0_block_size(struct wilc *wilc, u32 block_size) cmd.address = 0x10; cmd.data = (u8)block_size; if (!wilc_sdio_cmd52(wilc, &cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x10 data...\n"); + dev_err(&func->dev, "Failed cmd52, set 0x10 data...\n"); goto _fail_; } cmd.address = 0x11; cmd.data = (u8)(block_size >> 8); if (!wilc_sdio_cmd52(wilc, &cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x11 data...\n"); + dev_err(&func->dev, "Failed cmd52, set 0x11 data...\n"); goto _fail_; } @@ -105,6 +106,7 @@ _fail_: static int sdio_set_func1_block_size(struct wilc *wilc, u32 block_size) { + struct sdio_func *func = dev_to_sdio_func(wilc->dev); sdio_cmd52_t cmd; cmd.read_write = 1; @@ -113,13 +115,13 @@ static int sdio_set_func1_block_size(struct wilc *wilc, u32 block_size) cmd.address = 0x110; cmd.data = (u8)block_size; if (!wilc_sdio_cmd52(wilc, &cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x110 data...\n"); + dev_err(&func->dev, "Failed cmd52, set 0x110 data...\n"); goto _fail_; } cmd.address = 0x111; cmd.data = (u8)(block_size >> 8); if (!wilc_sdio_cmd52(wilc, &cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0x111 data...\n"); + dev_err(&func->dev, "Failed cmd52, set 0x111 data...\n"); goto _fail_; } @@ -130,6 +132,8 @@ _fail_: static int sdio_clear_int(struct wilc *wilc) { + struct sdio_func *func = dev_to_sdio_func(wilc->dev); + if (!g_sdio.irq_gpio) { /* u32 sts; */ sdio_cmd52_t cmd; @@ -146,7 +150,8 @@ static int sdio_clear_int(struct wilc *wilc) u32 reg; if (!sdio_read_reg(wilc, WILC_HOST_RX_CTRL_0, ®)) { - g_sdio.dPrint(N_ERR, "[wilc spi]: Failed read reg (%08x)...\n", WILC_HOST_RX_CTRL_0); + dev_err(&func->dev, "Failed read reg (%08x)...\n", + WILC_HOST_RX_CTRL_0); return 0; } reg &= ~0x1; @@ -163,6 +168,8 @@ static int sdio_clear_int(struct wilc *wilc) ********************************************/ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data) { + struct sdio_func *func = dev_to_sdio_func(wilc->dev); + data = cpu_to_le32(data); if ((addr >= 0xf0) && (addr <= 0xff)) { @@ -174,7 +181,8 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data) cmd.address = addr; cmd.data = data; if (!wilc_sdio_cmd52(wilc, &cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd 52, read reg (%08x) ...\n", addr); + dev_err(&func->dev, + "Failed cmd 52, read reg (%08x) ...\n", addr); goto _fail_; } } else { @@ -196,7 +204,8 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data) cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */ if (!wilc_sdio_cmd53(wilc, &cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53, write reg (%08x)...\n", addr); + dev_err(&func->dev, + "Failed cmd53, write reg (%08x)...\n", addr); goto _fail_; } } @@ -210,6 +219,7 @@ _fail_: static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) { + struct sdio_func *func = dev_to_sdio_func(wilc->dev); u32 block_size = g_sdio.block_size; sdio_cmd53_t cmd; int nblk, nleft; @@ -259,7 +269,8 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) goto _fail_; } if (!wilc_sdio_cmd53(wilc, &cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block send...\n", addr); + dev_err(&func->dev, + "Failed cmd53 [%x], block send...\n", addr); goto _fail_; } if (addr > 0) @@ -280,7 +291,8 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) goto _fail_; } if (!wilc_sdio_cmd53(wilc, &cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], bytes send...\n", addr); + dev_err(&func->dev, + "Failed cmd53 [%x], bytes send...\n", addr); goto _fail_; } } @@ -294,6 +306,8 @@ _fail_: static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data) { + struct sdio_func *func = dev_to_sdio_func(wilc->dev); + if ((addr >= 0xf0) && (addr <= 0xff)) { sdio_cmd52_t cmd; @@ -302,7 +316,8 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data) cmd.raw = 0; cmd.address = addr; if (!wilc_sdio_cmd52(wilc, &cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd 52, read reg (%08x) ...\n", addr); + dev_err(&func->dev, + "Failed cmd 52, read reg (%08x) ...\n", addr); goto _fail_; } *data = cmd.data; @@ -323,7 +338,8 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data) cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */ if (!wilc_sdio_cmd53(wilc, &cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53, read reg (%08x)...\n", addr); + dev_err(&func->dev, + "Failed cmd53, read reg (%08x)...\n", addr); goto _fail_; } } @@ -339,6 +355,7 @@ _fail_: static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) { + struct sdio_func *func = dev_to_sdio_func(wilc->dev); u32 block_size = g_sdio.block_size; sdio_cmd53_t cmd; int nblk, nleft; @@ -388,7 +405,8 @@ static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) goto _fail_; } if (!wilc_sdio_cmd53(wilc, &cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block read...\n", addr); + dev_err(&func->dev, + "Failed cmd53 [%x], block read...\n", addr); goto _fail_; } if (addr > 0) @@ -409,7 +427,8 @@ static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) goto _fail_; } if (!wilc_sdio_cmd53(wilc, &cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], bytes read...\n", addr); + dev_err(&func->dev, + "Failed cmd53 [%x], bytes read...\n", addr); goto _fail_; } } @@ -434,19 +453,20 @@ static int sdio_deinit(struct wilc *wilc) static int sdio_sync(struct wilc *wilc) { + struct sdio_func *func = dev_to_sdio_func(wilc->dev); u32 reg; /** * Disable power sequencer **/ if (!sdio_read_reg(wilc, WILC_MISC, ®)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed read misc reg...\n"); + dev_err(&func->dev, "Failed read misc reg...\n"); return 0; } reg &= ~BIT(8); if (!sdio_write_reg(wilc, WILC_MISC, reg)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed write misc reg...\n"); + dev_err(&func->dev, "Failed write misc reg...\n"); return 0; } @@ -459,13 +479,15 @@ static int sdio_sync(struct wilc *wilc) **/ ret = sdio_read_reg(wilc, WILC_PIN_MUX_0, ®); if (!ret) { - g_sdio.dPrint(N_ERR, "[wilc spi]: Failed read reg (%08x)...\n", WILC_PIN_MUX_0); + dev_err(&func->dev, "Failed read reg (%08x)...\n", + WILC_PIN_MUX_0); return 0; } reg |= BIT(8); ret = sdio_write_reg(wilc, WILC_PIN_MUX_0, reg); if (!ret) { - g_sdio.dPrint(N_ERR, "[wilc spi]: Failed write reg (%08x)...\n", WILC_PIN_MUX_0); + dev_err(&func->dev, "Failed write reg (%08x)...\n", + WILC_PIN_MUX_0); return 0; } @@ -474,13 +496,15 @@ static int sdio_sync(struct wilc *wilc) **/ ret = sdio_read_reg(wilc, WILC_INTR_ENABLE, ®); if (!ret) { - g_sdio.dPrint(N_ERR, "[wilc spi]: Failed read reg (%08x)...\n", WILC_INTR_ENABLE); + dev_err(&func->dev, "Failed read reg (%08x)...\n", + WILC_INTR_ENABLE); return 0; } reg |= BIT(16); ret = sdio_write_reg(wilc, WILC_INTR_ENABLE, reg); if (!ret) { - g_sdio.dPrint(N_ERR, "[wilc spi]: Failed write reg (%08x)...\n", WILC_INTR_ENABLE); + dev_err(&func->dev, "Failed write reg (%08x)...\n", + WILC_INTR_ENABLE); return 0; } } @@ -488,19 +512,19 @@ static int sdio_sync(struct wilc *wilc) return 1; } -static int sdio_init(struct wilc *wilc, wilc_debug_func func) +static int sdio_init(struct wilc *wilc, wilc_debug_func debug_func) { + struct sdio_func *func = dev_to_sdio_func(wilc->dev); sdio_cmd52_t cmd; int loop; u32 chipid; memset(&g_sdio, 0, sizeof(wilc_sdio_t)); - g_sdio.dPrint = func; g_sdio.irq_gpio = (wilc->dev_irq_num); if (!wilc_sdio_init()) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed io init bus...\n"); + dev_err(&func->dev, "Failed io init bus...\n"); return 0; } else { return 0; @@ -515,7 +539,7 @@ static int sdio_init(struct wilc *wilc, wilc_debug_func func) cmd.address = 0x100; cmd.data = 0x80; if (!wilc_sdio_cmd52(wilc, &cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, enable csa...\n"); + dev_err(&func->dev, "Fail cmd 52, enable csa...\n"); goto _fail_; } @@ -523,7 +547,7 @@ static int sdio_init(struct wilc *wilc, wilc_debug_func func) * function 0 block size **/ if (!sdio_set_func0_block_size(wilc, WILC_SDIO_BLOCK_SIZE)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, set func 0 block size...\n"); + dev_err(&func->dev, "Fail cmd 52, set func 0 block size...\n"); goto _fail_; } g_sdio.block_size = WILC_SDIO_BLOCK_SIZE; @@ -537,7 +561,8 @@ static int sdio_init(struct wilc *wilc, wilc_debug_func func) cmd.address = 0x2; cmd.data = 0x2; if (!wilc_sdio_cmd52(wilc, &cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio] Fail cmd 52, set IOE register...\n"); + dev_err(&func->dev, + "Fail cmd 52, set IOE register...\n"); goto _fail_; } @@ -552,7 +577,8 @@ static int sdio_init(struct wilc *wilc, wilc_debug_func func) do { cmd.data = 0; if (!wilc_sdio_cmd52(wilc, &cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, get IOR register...\n"); + dev_err(&func->dev, + "Fail cmd 52, get IOR register...\n"); goto _fail_; } if (cmd.data == 0x2) @@ -560,7 +586,7 @@ static int sdio_init(struct wilc *wilc, wilc_debug_func func) } while (loop--); if (loop <= 0) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail func 1 is not ready...\n"); + dev_err(&func->dev, "Fail func 1 is not ready...\n"); goto _fail_; } @@ -568,7 +594,7 @@ static int sdio_init(struct wilc *wilc, wilc_debug_func func) * func 1 is ready, set func 1 block size **/ if (!sdio_set_func1_block_size(wilc, WILC_SDIO_BLOCK_SIZE)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail set func 1 block size...\n"); + dev_err(&func->dev, "Fail set func 1 block size...\n"); goto _fail_; } @@ -581,7 +607,7 @@ static int sdio_init(struct wilc *wilc, wilc_debug_func func) cmd.address = 0x4; cmd.data = 0x3; if (!wilc_sdio_cmd52(wilc, &cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, set IEN register...\n"); + dev_err(&func->dev, "Fail cmd 52, set IEN register...\n"); goto _fail_; } @@ -589,15 +615,15 @@ static int sdio_init(struct wilc *wilc, wilc_debug_func func) * make sure can read back chip id correctly **/ if (!sdio_read_reg(wilc, 0x1000, &chipid)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd read chip id...\n"); + dev_err(&func->dev, "Fail cmd read chip id...\n"); goto _fail_; } - g_sdio.dPrint(N_ERR, "[wilc sdio]: chipid (%08x)\n", chipid); + dev_err(&func->dev, "chipid (%08x)\n", chipid); if ((chipid & 0xfff) > 0x2a0) g_sdio.has_thrpt_enh3 = 1; else g_sdio.has_thrpt_enh3 = 0; - g_sdio.dPrint(N_ERR, "[wilc sdio]: has_thrpt_enh3 = %d...\n", g_sdio.has_thrpt_enh3); + dev_info(&func->dev, "has_thrpt_enh3 = %d...\n", g_sdio.has_thrpt_enh3); return 1; @@ -637,7 +663,7 @@ static int sdio_read_size(struct wilc *wilc, u32 *size) static int sdio_read_int(struct wilc *wilc, u32 *int_status) { - + struct sdio_func *func = dev_to_sdio_func(wilc->dev); u32 tmp; sdio_cmd52_t cmd; @@ -668,7 +694,9 @@ static int sdio_read_int(struct wilc *wilc, u32 *int_status) tmp |= INT_5; for (i = g_sdio.nint; i < MAX_NUM_INT; i++) { if ((tmp >> (IRG_FLAGS_OFFSET + i)) & 0x1) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Unexpected interrupt (1) : tmp=%x, data=%x\n", tmp, cmd.data); + dev_err(&func->dev, + "Unexpected interrupt (1) : tmp=%x, data=%x\n", + tmp, cmd.data); break; } } @@ -692,6 +720,7 @@ static int sdio_read_int(struct wilc *wilc, u32 *int_status) static int sdio_clear_int_ext(struct wilc *wilc, u32 val) { + struct sdio_func *func = dev_to_sdio_func(wilc->dev); int ret; if (g_sdio.has_thrpt_enh3) { @@ -725,7 +754,9 @@ static int sdio_clear_int_ext(struct wilc *wilc, u32 val) ret = wilc_sdio_cmd52(wilc, &cmd); if (!ret) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0xf8 data (%d) ...\n", __LINE__); + dev_err(&func->dev, + "Failed cmd52, set 0xf8 data (%d) ...\n", + __LINE__); goto _fail_; } @@ -753,7 +784,9 @@ static int sdio_clear_int_ext(struct wilc *wilc, u32 val) ret = wilc_sdio_cmd52(wilc, &cmd); if (!ret) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0xf8 data (%d) ...\n", __LINE__); + dev_err(&func->dev, + "Failed cmd52, set 0xf8 data (%d) ...\n", + __LINE__); goto _fail_; } @@ -766,7 +799,9 @@ static int sdio_clear_int_ext(struct wilc *wilc, u32 val) goto _fail_; for (i = g_sdio.nint; i < MAX_NUM_INT; i++) { if (flags & 1) - g_sdio.dPrint(N_ERR, "[wilc sdio]: Unexpected interrupt cleared %d...\n", i); + dev_err(&func->dev, + "Unexpected interrupt cleared %d...\n", + i); flags >>= 1; } } @@ -796,7 +831,9 @@ static int sdio_clear_int_ext(struct wilc *wilc, u32 val) cmd.data = vmm_ctl; ret = wilc_sdio_cmd52(wilc, &cmd); if (!ret) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd52, set 0xf6 data (%d) ...\n", __LINE__); + dev_err(&func->dev, + "Failed cmd52, set 0xf6 data (%d) ...\n", + __LINE__); goto _fail_; } } @@ -810,14 +847,16 @@ _fail_: static int sdio_sync_ext(struct wilc *wilc, int nint) { + struct sdio_func *func = dev_to_sdio_func(wilc->dev); u32 reg; if (nint > MAX_NUM_INT) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Too many interupts (%d)...\n", nint); + dev_err(&func->dev, "Too many interupts (%d)...\n", nint); return 0; } if (nint > MAX_NUN_INT_THRPT_ENH2) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Error: Cannot support more than 5 interrupts when has_thrpt_enh2=1.\n"); + dev_err(&func->dev, + "Cannot support more than 5 interrupts when has_thrpt_enh2=1.\n"); return 0; } @@ -827,13 +866,13 @@ static int sdio_sync_ext(struct wilc *wilc, int nint) * Disable power sequencer **/ if (!sdio_read_reg(wilc, WILC_MISC, ®)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed read misc reg...\n"); + dev_err(&func->dev, "Failed read misc reg...\n"); return 0; } reg &= ~BIT(8); if (!sdio_write_reg(wilc, WILC_MISC, reg)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed write misc reg...\n"); + dev_err(&func->dev, "Failed write misc reg...\n"); return 0; } @@ -846,13 +885,15 @@ static int sdio_sync_ext(struct wilc *wilc, int nint) **/ ret = sdio_read_reg(wilc, WILC_PIN_MUX_0, ®); if (!ret) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed read reg (%08x)...\n", WILC_PIN_MUX_0); + dev_err(&func->dev, "Failed read reg (%08x)...\n", + WILC_PIN_MUX_0); return 0; } reg |= BIT(8); ret = sdio_write_reg(wilc, WILC_PIN_MUX_0, reg); if (!ret) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed write reg (%08x)...\n", WILC_PIN_MUX_0); + dev_err(&func->dev, "Failed write reg (%08x)...\n", + WILC_PIN_MUX_0); return 0; } @@ -861,7 +902,8 @@ static int sdio_sync_ext(struct wilc *wilc, int nint) **/ ret = sdio_read_reg(wilc, WILC_INTR_ENABLE, ®); if (!ret) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed read reg (%08x)...\n", WILC_INTR_ENABLE); + dev_err(&func->dev, "Failed read reg (%08x)...\n", + WILC_INTR_ENABLE); return 0; } @@ -869,13 +911,16 @@ static int sdio_sync_ext(struct wilc *wilc, int nint) reg |= BIT((27 + i)); ret = sdio_write_reg(wilc, WILC_INTR_ENABLE, reg); if (!ret) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed write reg (%08x)...\n", WILC_INTR_ENABLE); + dev_err(&func->dev, "Failed write reg (%08x)...\n", + WILC_INTR_ENABLE); return 0; } if (nint) { ret = sdio_read_reg(wilc, WILC_INTR2_ENABLE, ®); if (!ret) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed read reg (%08x)...\n", WILC_INTR2_ENABLE); + dev_err(&func->dev, + "Failed read reg (%08x)...\n", + WILC_INTR2_ENABLE); return 0; } @@ -884,7 +929,9 @@ static int sdio_sync_ext(struct wilc *wilc, int nint) ret = sdio_read_reg(wilc, WILC_INTR2_ENABLE, ®); if (!ret) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed write reg (%08x)...\n", WILC_INTR2_ENABLE); + dev_err(&func->dev, + "Failed write reg (%08x)...\n", + WILC_INTR2_ENABLE); return 0; } } diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index c94d86f6cbea..806012599bb3 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -14,7 +14,6 @@ #include "wilc_wfi_netdevice.h" typedef struct { - wilc_debug_func dPrint; int crc_off; int nint; int has_thrpt_enh; @@ -111,6 +110,7 @@ static u8 crc7(u8 crc, const u8 *buffer, u32 len) static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless) { + struct spi_device *spi = to_spi_device(wilc->dev); u8 wb[32], rb[32]; u8 wix, rix; u32 len2; @@ -239,7 +239,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, #undef NUM_DUMMY_BYTES if (len2 > ARRAY_SIZE(wb)) { - PRINT_ER("[wilc spi]: spi buffer size too small (%d) (%zu)\n", + dev_err(&spi->dev, "spi buffer size too small (%d) (%zu)\n", len2, ARRAY_SIZE(wb)); result = N_FAIL; return result; @@ -251,7 +251,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, rix = len; if (!wilc_spi_write_read(wilc, wb, rb, len2)) { - PRINT_ER("[wilc spi]: Failed cmd write, bus error...\n"); + dev_err(&spi->dev, "Failed cmd write, bus error...\n"); result = N_FAIL; return result; } @@ -271,7 +271,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, /* } while(&rptr[1] <= &rb[len2]); */ if (rsp != cmd) { - PRINT_ER("[wilc spi]: Failed cmd response, cmd (%02x)" + dev_err(&spi->dev, "Failed cmd response, cmd (%02x)" ", resp (%02x)\n", cmd, rsp); result = N_FAIL; return result; @@ -282,8 +282,8 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, **/ rsp = rb[rix++]; if (rsp != 0x00) { - PRINT_ER("[wilc spi]: Failed cmd state response " - "state (%02x)\n", rsp); + dev_err(&spi->dev, "Failed cmd state response state (%02x)\n", + rsp); result = N_FAIL; return result; } @@ -310,8 +310,8 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, } while (retry--); if (retry <= 0) { - PRINT_ER("[wilc spi]: Error, data read " - "response (%02x)\n", rsp); + dev_err(&spi->dev, + "Error, data read response (%02x)\n", rsp); result = N_RESET; return result; } @@ -326,7 +326,8 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, b[2] = rb[rix++]; b[3] = rb[rix++]; } else { - PRINT_ER("[wilc spi]: buffer overrun when reading data.\n"); + dev_err(&spi->dev, + "buffer overrun when reading data.\n"); result = N_FAIL; return result; } @@ -339,7 +340,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, crc[0] = rb[rix++]; crc[1] = rb[rix++]; } else { - PRINT_ER("[wilc spi]: buffer overrun when reading crc.\n"); + dev_err(&spi->dev,"buffer overrun when reading crc.\n"); result = N_FAIL; return result; } @@ -366,7 +367,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, * Read bytes **/ if (!wilc_spi_read(wilc, &b[ix], nbytes)) { - PRINT_ER("[wilc spi]: Failed data block read, bus error...\n"); + dev_err(&spi->dev, "Failed data block read, bus error...\n"); result = N_FAIL; goto _error_; } @@ -376,7 +377,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, **/ if (!g_spi.crc_off) { if (!wilc_spi_read(wilc, crc, 2)) { - PRINT_ER("[wilc spi]: Failed data block crc read, bus error...\n"); + dev_err(&spi->dev, "Failed data block crc read, bus error...\n"); result = N_FAIL; goto _error_; } @@ -407,7 +408,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, retry = 10; do { if (!wilc_spi_read(wilc, &rsp, 1)) { - PRINT_ER("[wilc spi]: Failed data response read, bus error...\n"); + dev_err(&spi->dev, "Failed data response read, bus error...\n"); result = N_FAIL; break; } @@ -423,7 +424,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, * Read bytes **/ if (!wilc_spi_read(wilc, &b[ix], nbytes)) { - PRINT_ER("[wilc spi]: Failed data block read, bus error...\n"); + dev_err(&spi->dev, "Failed data block read, bus error...\n"); result = N_FAIL; break; } @@ -433,7 +434,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, **/ if (!g_spi.crc_off) { if (!wilc_spi_read(wilc, crc, 2)) { - PRINT_ER("[wilc spi]: Failed data block crc read, bus error...\n"); + dev_err(&spi->dev, "Failed data block crc read, bus error...\n"); result = N_FAIL; break; } @@ -450,6 +451,7 @@ _error_: static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz) { + struct spi_device *spi = to_spi_device(wilc->dev); int ix, nbytes; int result = 1; u8 cmd, order, crc[2] = {0}; @@ -483,7 +485,8 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz) } cmd |= order; if (!wilc_spi_write(wilc, &cmd, 1)) { - PRINT_ER("[wilc spi]: Failed data block cmd write, bus error...\n"); + dev_err(&spi->dev, + "Failed data block cmd write, bus error...\n"); result = N_FAIL; break; } @@ -492,7 +495,8 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz) * Write data **/ if (!wilc_spi_write(wilc, &b[ix], nbytes)) { - PRINT_ER("[wilc spi]: Failed data block write, bus error...\n"); + dev_err(&spi->dev, + "Failed data block write, bus error...\n"); result = N_FAIL; break; } @@ -502,7 +506,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz) **/ if (!g_spi.crc_off) { if (!wilc_spi_write(wilc, crc, 2)) { - PRINT_ER("[wilc spi]: Failed data block crc write, bus error...\n"); + dev_err(&spi->dev,"Failed data block crc write, bus error...\n"); result = N_FAIL; break; } @@ -527,13 +531,14 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz) static int spi_internal_write(struct wilc *wilc, u32 adr, u32 dat) { + struct spi_device *spi = to_spi_device(wilc->dev); int result; dat = cpu_to_le32(dat); result = spi_cmd_complete(wilc, CMD_INTERNAL_WRITE, adr, (u8 *)&dat, 4, 0); if (result != N_OK) { - PRINT_ER("[wilc spi]: Failed internal write cmd...\n"); + dev_err(&spi->dev, "Failed internal write cmd...\n"); } return result; @@ -541,12 +546,13 @@ static int spi_internal_write(struct wilc *wilc, u32 adr, u32 dat) static int spi_internal_read(struct wilc *wilc, u32 adr, u32 *data) { + struct spi_device *spi = to_spi_device(wilc->dev); int result; result = spi_cmd_complete(wilc, CMD_INTERNAL_READ, adr, (u8 *)data, 4, 0); if (result != N_OK) { - PRINT_ER("[wilc spi]: Failed internal read cmd...\n"); + dev_err(&spi->dev, "Failed internal read cmd...\n"); return 0; } @@ -563,6 +569,7 @@ static int spi_internal_read(struct wilc *wilc, u32 adr, u32 *data) static int wilc_spi_write_reg(struct wilc *wilc, u32 addr, u32 data) { + struct spi_device *spi = to_spi_device(wilc->dev); int result = N_OK; u8 cmd = CMD_SINGLE_WRITE; u8 clockless = 0; @@ -576,7 +583,7 @@ static int wilc_spi_write_reg(struct wilc *wilc, u32 addr, u32 data) result = spi_cmd_complete(wilc, cmd, addr, (u8 *)&data, 4, clockless); if (result != N_OK) { - PRINT_ER("[wilc spi]: Failed cmd, write reg (%08x)...\n", addr); + dev_err(&spi->dev, "Failed cmd, write reg (%08x)...\n", addr); } return result; @@ -584,6 +591,7 @@ static int wilc_spi_write_reg(struct wilc *wilc, u32 addr, u32 data) static int _wilc_spi_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) { + struct spi_device *spi = to_spi_device(wilc->dev); int result; u8 cmd = CMD_DMA_EXT_WRITE; @@ -595,7 +603,8 @@ static int _wilc_spi_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) result = spi_cmd_complete(wilc, cmd, addr, NULL, size, 0); if (result != N_OK) { - PRINT_ER("[wilc spi]: Failed cmd, write block (%08x)...\n", addr); + dev_err(&spi->dev, + "Failed cmd, write block (%08x)...\n", addr); return 0; } @@ -604,7 +613,7 @@ static int _wilc_spi_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) **/ result = spi_data_write(wilc, buf, size); if (result != N_OK) { - PRINT_ER("[wilc spi]: Failed block data write...\n"); + dev_err(&spi->dev, "Failed block data write...\n"); } return 1; @@ -612,12 +621,13 @@ static int _wilc_spi_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) static int wilc_spi_read_reg(struct wilc *wilc, u32 addr, u32 *data) { + struct spi_device *spi = to_spi_device(wilc->dev); int result = N_OK; u8 cmd = CMD_SINGLE_READ; u8 clockless = 0; if (addr < 0x30) { - /* PRINT_ER("***** read addr %d\n\n", addr); */ + /* dev_err(&spi->dev, "***** read addr %d\n\n", addr); */ /* Clockless register*/ cmd = CMD_INTERNAL_READ; clockless = 1; @@ -625,7 +635,7 @@ static int wilc_spi_read_reg(struct wilc *wilc, u32 addr, u32 *data) result = spi_cmd_complete(wilc, cmd, addr, (u8 *)data, 4, clockless); if (result != N_OK) { - PRINT_ER("[wilc spi]: Failed cmd, read reg (%08x)...\n", addr); + dev_err(&spi->dev, "Failed cmd, read reg (%08x)...\n", addr); return 0; } @@ -636,6 +646,7 @@ static int wilc_spi_read_reg(struct wilc *wilc, u32 addr, u32 *data) static int _wilc_spi_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) { + struct spi_device *spi = to_spi_device(wilc->dev); u8 cmd = CMD_DMA_EXT_READ; int result; @@ -644,7 +655,7 @@ static int _wilc_spi_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) result = spi_cmd_complete(wilc, cmd, addr, buf, size, 0); if (result != N_OK) { - PRINT_ER("[wilc spi]: Failed cmd, read block (%08x)...\n", addr); + dev_err(&spi->dev, "Failed cmd, read block (%08x)...\n", addr); return 0; } @@ -659,10 +670,12 @@ static int _wilc_spi_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) static int wilc_spi_clear_int(struct wilc *wilc) { + struct spi_device *spi = to_spi_device(wilc->dev); u32 reg; if (!wilc_spi_read_reg(wilc, WILC_HOST_RX_CTRL_0, ®)) { - PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_HOST_RX_CTRL_0); + dev_err(&spi->dev, "Failed read reg (%08x)...\n", + WILC_HOST_RX_CTRL_0); return 0; } reg &= ~0x1; @@ -680,6 +693,7 @@ static int _wilc_spi_deinit(struct wilc *wilc) static int wilc_spi_sync(struct wilc *wilc) { + struct spi_device *spi = to_spi_device(wilc->dev); u32 reg; int ret; @@ -688,13 +702,15 @@ static int wilc_spi_sync(struct wilc *wilc) **/ ret = wilc_spi_read_reg(wilc, WILC_PIN_MUX_0, ®); if (!ret) { - PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_PIN_MUX_0); + dev_err(&spi->dev,"Failed read reg (%08x)...\n", + WILC_PIN_MUX_0); return 0; } reg |= BIT(8); ret = wilc_spi_write_reg(wilc, WILC_PIN_MUX_0, reg); if (!ret) { - PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_PIN_MUX_0); + dev_err(&spi->dev, "Failed write reg (%08x)...\n", + WILC_PIN_MUX_0); return 0; } @@ -703,13 +719,15 @@ static int wilc_spi_sync(struct wilc *wilc) **/ ret = wilc_spi_read_reg(wilc, WILC_INTR_ENABLE, ®); if (!ret) { - PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_INTR_ENABLE); + dev_err(&spi->dev, "Failed read reg (%08x)...\n", + WILC_INTR_ENABLE); return 0; } reg |= BIT(16); ret = wilc_spi_write_reg(wilc, WILC_INTR_ENABLE, reg); if (!ret) { - PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_INTR_ENABLE); + dev_err(&spi->dev, "Failed write reg (%08x)...\n", + WILC_INTR_ENABLE); return 0; } @@ -718,6 +736,7 @@ static int wilc_spi_sync(struct wilc *wilc) static int _wilc_spi_init(struct wilc *wilc, wilc_debug_func func) { + struct spi_device *spi = to_spi_device(wilc->dev); u32 reg; u32 chipid; @@ -726,7 +745,7 @@ static int _wilc_spi_init(struct wilc *wilc, wilc_debug_func func) if (isinit) { if (!wilc_spi_read_reg(wilc, 0x1000, &chipid)) { - PRINT_ER("[wilc spi]: Fail cmd read chip id...\n"); + dev_err(&spi->dev, "Fail cmd read chip id...\n"); return 0; } return 1; @@ -734,9 +753,8 @@ static int _wilc_spi_init(struct wilc *wilc, wilc_debug_func func) memset(&g_spi, 0, sizeof(wilc_spi_t)); - g_spi.dPrint = func; if (!wilc_spi_init()) { - PRINT_ER("[wilc spi]: Failed io init bus...\n"); + dev_err(&spi->dev, "Failed io init bus...\n"); return 0; } else { return 0; @@ -753,10 +771,11 @@ static int _wilc_spi_init(struct wilc *wilc, wilc_debug_func func) /* Read failed. Try with CRC off. This might happen when module * is removed but chip isn't reset*/ g_spi.crc_off = 1; - PRINT_ER("[wilc spi]: Failed internal read protocol with CRC on, retyring with CRC off...\n"); + dev_err(&spi->dev, "Failed internal read protocol with CRC on, retyring with CRC off...\n"); if (!spi_internal_read(wilc, WILC_SPI_PROTOCOL_OFFSET, ®)) { /* Reaad failed with both CRC on and off, something went bad */ - PRINT_ER("[wilc spi]: Failed internal read protocol...\n"); + dev_err(&spi->dev, + "Failed internal read protocol...\n"); return 0; } } @@ -765,7 +784,7 @@ static int _wilc_spi_init(struct wilc *wilc, wilc_debug_func func) reg &= ~0x70; reg |= (0x5 << 4); if (!spi_internal_write(wilc, WILC_SPI_PROTOCOL_OFFSET, reg)) { - PRINT_ER("[wilc spi %d]: Failed internal write protocol reg...\n", __LINE__); + dev_err(&spi->dev, "[wilc spi %d]: Failed internal write protocol reg...\n", __LINE__); return 0; } g_spi.crc_off = 1; @@ -776,10 +795,10 @@ static int _wilc_spi_init(struct wilc *wilc, wilc_debug_func func) * make sure can read back chip id correctly **/ if (!wilc_spi_read_reg(wilc, 0x1000, &chipid)) { - PRINT_ER("[wilc spi]: Fail cmd read chip id...\n"); + dev_err(&spi->dev, "Fail cmd read chip id...\n"); return 0; } - /* PRINT_ER("[wilc spi]: chipid (%08x)\n", chipid); */ + /* dev_err(&spi->dev, "chipid (%08x)\n", chipid); */ g_spi.has_thrpt_enh = 1; @@ -790,6 +809,7 @@ static int _wilc_spi_init(struct wilc *wilc, wilc_debug_func func) static int wilc_spi_read_size(struct wilc *wilc, u32 *size) { + struct spi_device *spi = to_spi_device(wilc->dev); int ret; if (g_spi.has_thrpt_enh) { @@ -803,7 +823,8 @@ static int wilc_spi_read_size(struct wilc *wilc, u32 *size) ret = wilc_spi_read_reg(wilc, WILC_VMM_TO_HOST_SIZE, &byte_cnt); if (!ret) { - PRINT_ER("[wilc spi]: Failed read WILC_VMM_TO_HOST_SIZE ...\n"); + dev_err(&spi->dev, + "Failed read WILC_VMM_TO_HOST_SIZE ...\n"); goto _fail_; } tmp = (byte_cnt >> 2) & IRQ_DMA_WD_CNT_MASK; @@ -820,6 +841,7 @@ _fail_: static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status) { + struct spi_device *spi = to_spi_device(wilc->dev); int ret; if (g_spi.has_thrpt_enh) { @@ -832,7 +854,8 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status) ret = wilc_spi_read_reg(wilc, WILC_VMM_TO_HOST_SIZE, &byte_cnt); if (!ret) { - PRINT_ER("[wilc spi]: Failed read WILC_VMM_TO_HOST_SIZE ...\n"); + dev_err(&spi->dev, + "Failed read WILC_VMM_TO_HOST_SIZE ...\n"); goto _fail_; } tmp = (byte_cnt >> 2) & IRQ_DMA_WD_CNT_MASK; @@ -861,7 +884,7 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 *int_status) unkmown_mask = ~((1ul << g_spi.nint) - 1); if ((tmp >> IRG_FLAGS_OFFSET) & unkmown_mask) { - PRINT_ER("[wilc spi]: Unexpected interrupt (2): j=%d, tmp=%x, mask=%x\n", j, tmp, unkmown_mask); + dev_err(&spi->dev, "Unexpected interrupt (2): j=%d, tmp=%x, mask=%x\n", j, tmp, unkmown_mask); happended = 1; } } @@ -879,6 +902,7 @@ _fail_: static int wilc_spi_clear_int_ext(struct wilc *wilc, u32 val) { + struct spi_device *spi = to_spi_device(wilc->dev); int ret; if (g_spi.has_thrpt_enh) { @@ -901,12 +925,16 @@ static int wilc_spi_clear_int_ext(struct wilc *wilc, u32 val) flags >>= 1; } if (!ret) { - PRINT_ER("[wilc spi]: Failed wilc_spi_write_reg, set reg %x ...\n", 0x10c8 + i * 4); + dev_err(&spi->dev, + "Failed wilc_spi_write_reg, set reg %x ...\n", + 0x10c8 + i * 4); goto _fail_; } for (i = g_spi.nint; i < MAX_NUM_INT; i++) { if (flags & 1) - PRINT_ER("[wilc spi]: Unexpected interrupt cleared %d...\n", i); + dev_err(&spi->dev, + "Unexpected interrupt cleared %d...\n", + i); flags >>= 1; } } @@ -925,7 +953,8 @@ static int wilc_spi_clear_int_ext(struct wilc *wilc, u32 val) ret = wilc_spi_write_reg(wilc, WILC_VMM_TBL_CTL, tbl_ctl); if (!ret) { - PRINT_ER("[wilc spi]: fail write reg vmm_tbl_ctl...\n"); + dev_err(&spi->dev, + "fail write reg vmm_tbl_ctl...\n"); goto _fail_; } @@ -936,7 +965,7 @@ static int wilc_spi_clear_int_ext(struct wilc *wilc, u32 val) ret = wilc_spi_write_reg(wilc, WILC_VMM_CORE_CTL, 1); if (!ret) { - PRINT_ER("[wilc spi]: fail write reg vmm_core_ctl...\n"); + dev_err(&spi->dev,"fail write reg vmm_core_ctl...\n"); goto _fail_; } } @@ -948,11 +977,12 @@ _fail_: static int wilc_spi_sync_ext(struct wilc *wilc, int nint) { + struct spi_device *spi = to_spi_device(wilc->dev); u32 reg; int ret, i; if (nint > MAX_NUM_INT) { - PRINT_ER("[wilc spi]: Too many interupts (%d)...\n", nint); + dev_err(&spi->dev, "Too many interupts (%d)...\n", nint); return 0; } @@ -963,13 +993,15 @@ static int wilc_spi_sync_ext(struct wilc *wilc, int nint) **/ ret = wilc_spi_read_reg(wilc, WILC_PIN_MUX_0, ®); if (!ret) { - PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_PIN_MUX_0); + dev_err(&spi->dev, "Failed read reg (%08x)...\n", + WILC_PIN_MUX_0); return 0; } reg |= BIT(8); ret = wilc_spi_write_reg(wilc, WILC_PIN_MUX_0, reg); if (!ret) { - PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_PIN_MUX_0); + dev_err(&spi->dev, "Failed write reg (%08x)...\n", + WILC_PIN_MUX_0); return 0; } @@ -978,7 +1010,8 @@ static int wilc_spi_sync_ext(struct wilc *wilc, int nint) **/ ret = wilc_spi_read_reg(wilc, WILC_INTR_ENABLE, ®); if (!ret) { - PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_INTR_ENABLE); + dev_err(&spi->dev, "Failed read reg (%08x)...\n", + WILC_INTR_ENABLE); return 0; } @@ -987,13 +1020,15 @@ static int wilc_spi_sync_ext(struct wilc *wilc, int nint) } ret = wilc_spi_write_reg(wilc, WILC_INTR_ENABLE, reg); if (!ret) { - PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_INTR_ENABLE); + dev_err(&spi->dev, "Failed write reg (%08x)...\n", + WILC_INTR_ENABLE); return 0; } if (nint) { ret = wilc_spi_read_reg(wilc, WILC_INTR2_ENABLE, ®); if (!ret) { - PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_INTR2_ENABLE); + dev_err(&spi->dev, "Failed read reg (%08x)...\n", + WILC_INTR2_ENABLE); return 0; } @@ -1003,7 +1038,8 @@ static int wilc_spi_sync_ext(struct wilc *wilc, int nint) ret = wilc_spi_read_reg(wilc, WILC_INTR2_ENABLE, ®); if (!ret) { - PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_INTR2_ENABLE); + dev_err(&spi->dev, "Failed write reg (%08x)...\n", + WILC_INTR2_ENABLE); return 0; } } From 28b01ff59443155dff491e5ce94ecfeb898e8c9a Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:14 +0900 Subject: [PATCH 645/843] staging: wilc1000: remove wilc_debug_func of hif_init This patch removes wilc_debug_func of hif_init and remove it's related functions as well because it is not used anymore. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_sdio.c | 2 +- drivers/staging/wilc1000/wilc_spi.c | 2 +- drivers/staging/wilc1000/wilc_wlan.c | 2 +- drivers/staging/wilc1000/wilc_wlan.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index dfa3d3a7fcac..efa337965e68 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -512,7 +512,7 @@ static int sdio_sync(struct wilc *wilc) return 1; } -static int sdio_init(struct wilc *wilc, wilc_debug_func debug_func) +static int sdio_init(struct wilc *wilc) { struct sdio_func *func = dev_to_sdio_func(wilc->dev); sdio_cmd52_t cmd; diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index 806012599bb3..478a356de287 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -734,7 +734,7 @@ static int wilc_spi_sync(struct wilc *wilc) return 1; } -static int _wilc_spi_init(struct wilc *wilc, wilc_debug_func func) +static int _wilc_spi_init(struct wilc *wilc) { struct spi_device *spi = to_spi_device(wilc->dev); u32 reg; diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 0427349354f4..32ecc2df91aa 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1587,7 +1587,7 @@ int wilc_wlan_init(struct net_device *dev) PRINT_D(INIT_DBG, "Initializing WILC_Wlan ...\n"); - if (!wilc->hif_func->hif_init(wilc, wilc_debug)) { + if (!wilc->hif_func->hif_init(wilc)) { ret = -EIO; goto _fail_; } diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 366645318ad2..580e1d60221b 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -226,7 +226,7 @@ struct rxq_entry_t { ********************************************/ struct wilc; struct wilc_hif_func { - int (*hif_init)(struct wilc *, wilc_debug_func); + int (*hif_init)(struct wilc *); int (*hif_deinit)(struct wilc *); int (*hif_read_reg)(struct wilc *, u32, u32 *); int (*hif_write_reg)(struct wilc *, u32, u32); From 491a2ed74d7e8152ea16430b4259d38ded59fb4c Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:15 +0900 Subject: [PATCH 646/843] staging: wilc1000: remove unused functions This patch removes unused function pointer hif_sync and hif_clear_int, and removes it's related functions sdio_clear_int, sdio_sync, wilc_spi_clear_int and wilc_spi_sync. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_sdio.c | 94 ---------------------------- drivers/staging/wilc1000/wilc_spi.c | 60 ------------------ drivers/staging/wilc1000/wilc_wlan.h | 2 - 3 files changed, 156 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index efa337965e68..325e274a64d2 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -130,37 +130,6 @@ _fail_: return 0; } -static int sdio_clear_int(struct wilc *wilc) -{ - struct sdio_func *func = dev_to_sdio_func(wilc->dev); - - if (!g_sdio.irq_gpio) { - /* u32 sts; */ - sdio_cmd52_t cmd; - - cmd.read_write = 0; - cmd.function = 1; - cmd.raw = 0; - cmd.address = 0x4; - cmd.data = 0; - wilc_sdio_cmd52(wilc, &cmd); - - return cmd.data; - } else { - u32 reg; - - if (!sdio_read_reg(wilc, WILC_HOST_RX_CTRL_0, ®)) { - dev_err(&func->dev, "Failed read reg (%08x)...\n", - WILC_HOST_RX_CTRL_0); - return 0; - } - reg &= ~0x1; - sdio_write_reg(wilc, WILC_HOST_RX_CTRL_0, reg); - return 1; - } - -} - /******************************************** * * Sdio interfaces @@ -451,67 +420,6 @@ static int sdio_deinit(struct wilc *wilc) return 1; } -static int sdio_sync(struct wilc *wilc) -{ - struct sdio_func *func = dev_to_sdio_func(wilc->dev); - u32 reg; - - /** - * Disable power sequencer - **/ - if (!sdio_read_reg(wilc, WILC_MISC, ®)) { - dev_err(&func->dev, "Failed read misc reg...\n"); - return 0; - } - - reg &= ~BIT(8); - if (!sdio_write_reg(wilc, WILC_MISC, reg)) { - dev_err(&func->dev, "Failed write misc reg...\n"); - return 0; - } - - if (g_sdio.irq_gpio) { - u32 reg; - int ret; - - /** - * interrupt pin mux select - **/ - ret = sdio_read_reg(wilc, WILC_PIN_MUX_0, ®); - if (!ret) { - dev_err(&func->dev, "Failed read reg (%08x)...\n", - WILC_PIN_MUX_0); - return 0; - } - reg |= BIT(8); - ret = sdio_write_reg(wilc, WILC_PIN_MUX_0, reg); - if (!ret) { - dev_err(&func->dev, "Failed write reg (%08x)...\n", - WILC_PIN_MUX_0); - return 0; - } - - /** - * interrupt enable - **/ - ret = sdio_read_reg(wilc, WILC_INTR_ENABLE, ®); - if (!ret) { - dev_err(&func->dev, "Failed read reg (%08x)...\n", - WILC_INTR_ENABLE); - return 0; - } - reg |= BIT(16); - ret = sdio_write_reg(wilc, WILC_INTR_ENABLE, reg); - if (!ret) { - dev_err(&func->dev, "Failed write reg (%08x)...\n", - WILC_INTR_ENABLE); - return 0; - } - } - - return 1; -} - static int sdio_init(struct wilc *wilc) { struct sdio_func *func = dev_to_sdio_func(wilc->dev); @@ -952,8 +860,6 @@ const struct wilc_hif_func wilc_hif_sdio = { .hif_write_reg = sdio_write_reg, .hif_block_rx = sdio_read, .hif_block_tx = sdio_write, - .hif_sync = sdio_sync, - .hif_clear_int = sdio_clear_int, .hif_read_int = sdio_read_int, .hif_clear_int_ext = sdio_clear_int_ext, .hif_read_size = sdio_read_size, diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index 478a356de287..faaeaf7cba86 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -668,21 +668,6 @@ static int _wilc_spi_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) * ********************************************/ -static int wilc_spi_clear_int(struct wilc *wilc) -{ - struct spi_device *spi = to_spi_device(wilc->dev); - u32 reg; - - if (!wilc_spi_read_reg(wilc, WILC_HOST_RX_CTRL_0, ®)) { - dev_err(&spi->dev, "Failed read reg (%08x)...\n", - WILC_HOST_RX_CTRL_0); - return 0; - } - reg &= ~0x1; - wilc_spi_write_reg(wilc, WILC_HOST_RX_CTRL_0, reg); - return 1; -} - static int _wilc_spi_deinit(struct wilc *wilc) { /** @@ -691,49 +676,6 @@ static int _wilc_spi_deinit(struct wilc *wilc) return 1; } -static int wilc_spi_sync(struct wilc *wilc) -{ - struct spi_device *spi = to_spi_device(wilc->dev); - u32 reg; - int ret; - - /** - * interrupt pin mux select - **/ - ret = wilc_spi_read_reg(wilc, WILC_PIN_MUX_0, ®); - if (!ret) { - dev_err(&spi->dev,"Failed read reg (%08x)...\n", - WILC_PIN_MUX_0); - return 0; - } - reg |= BIT(8); - ret = wilc_spi_write_reg(wilc, WILC_PIN_MUX_0, reg); - if (!ret) { - dev_err(&spi->dev, "Failed write reg (%08x)...\n", - WILC_PIN_MUX_0); - return 0; - } - - /** - * interrupt enable - **/ - ret = wilc_spi_read_reg(wilc, WILC_INTR_ENABLE, ®); - if (!ret) { - dev_err(&spi->dev, "Failed read reg (%08x)...\n", - WILC_INTR_ENABLE); - return 0; - } - reg |= BIT(16); - ret = wilc_spi_write_reg(wilc, WILC_INTR_ENABLE, reg); - if (!ret) { - dev_err(&spi->dev, "Failed write reg (%08x)...\n", - WILC_INTR_ENABLE); - return 0; - } - - return 1; -} - static int _wilc_spi_init(struct wilc *wilc) { struct spi_device *spi = to_spi_device(wilc->dev); @@ -1058,8 +1000,6 @@ const struct wilc_hif_func wilc_hif_spi = { .hif_write_reg = wilc_spi_write_reg, .hif_block_rx = _wilc_spi_read, .hif_block_tx = _wilc_spi_write, - .hif_sync = wilc_spi_sync, - .hif_clear_int = wilc_spi_clear_int, .hif_read_int = wilc_spi_read_int, .hif_clear_int_ext = wilc_spi_clear_int_ext, .hif_read_size = wilc_spi_read_size, diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 580e1d60221b..2edd7445f4a3 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -232,8 +232,6 @@ struct wilc_hif_func { int (*hif_write_reg)(struct wilc *, u32, u32); int (*hif_block_rx)(struct wilc *, u32, u8 *, u32); int (*hif_block_tx)(struct wilc *, u32, u8 *, u32); - int (*hif_sync)(struct wilc *); - int (*hif_clear_int)(struct wilc *); int (*hif_read_int)(struct wilc *, u32 *); int (*hif_clear_int_ext)(struct wilc *, u32); int (*hif_read_size)(struct wilc *, u32 *); From 3cf9c9a7ffb7a6b67683259cf21c0c4fde1301d6 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:16 +0900 Subject: [PATCH 647/843] staging: wilc1000: linux_wlan_sdio.c: fix checkpatch warning line over 80 This patch fixes checkpatch warning line over 80 characters. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan_sdio.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index 66cdca23b1b4..78e6808e7e94 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -74,9 +74,11 @@ int wilc_sdio_cmd53(struct wilc *wilc, sdio_cmd53_t *cmd) size = cmd->count; if (cmd->read_write) { /* write */ - ret = sdio_memcpy_toio(func, cmd->address, (void *)cmd->buffer, size); + ret = sdio_memcpy_toio(func, cmd->address, + (void *)cmd->buffer, size); } else { /* read */ - ret = sdio_memcpy_fromio(func, (void *)cmd->buffer, cmd->address, size); + ret = sdio_memcpy_fromio(func, (void *)cmd->buffer, + cmd->address, size); } sdio_release_host(func); @@ -90,7 +92,8 @@ int wilc_sdio_cmd53(struct wilc *wilc, sdio_cmd53_t *cmd) return 1; } -static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) +static int linux_sdio_probe(struct sdio_func *func, + const struct sdio_device_id *id) { struct wilc *wilc; int gpio; @@ -126,7 +129,9 @@ static struct sdio_driver wilc1000_sdio_driver = { .probe = linux_sdio_probe, .remove = linux_sdio_remove, }; -module_driver(wilc1000_sdio_driver, sdio_register_driver, sdio_unregister_driver); +module_driver(wilc1000_sdio_driver, + sdio_register_driver, + sdio_unregister_driver); MODULE_LICENSE("GPL"); int wilc_sdio_enable_interrupt(struct wilc *dev) From 58ed46f795141a6579df88bd506c3458ce6c4918 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:17 +0900 Subject: [PATCH 648/843] staging: wilc1000: linux_wlan_sdio.c: remove braces This patch fixes checkpatch warning braces{} are not necessary for single statment blocks. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan_sdio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index 78e6808e7e94..64fb81b331bd 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -159,9 +159,8 @@ void wilc_sdio_disable_interrupt(struct wilc *dev) sdio_claim_host(func); ret = sdio_release_irq(func); - if (ret < 0) { + if (ret < 0) dev_err(&func->dev, "can't release sdio_irq, err(%d)\n", ret); - } sdio_release_host(func); dev_info(&func->dev, "wilc_sdio_disable_interrupt OUT\n"); From 6f8bded28878ce8c750f33b53a50382ed767eb6c Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:18 +0900 Subject: [PATCH 649/843] staging: wilc1000: wilc_sdio_cmd53: return linux error value This patch changes return value with linux error value, not 1 or 0. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan_sdio.c | 7 ++---- drivers/staging/wilc1000/wilc_sdio.c | 26 +++++++++++++--------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index 64fb81b331bd..a918de942cb4 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -83,13 +83,10 @@ int wilc_sdio_cmd53(struct wilc *wilc, sdio_cmd53_t *cmd) sdio_release_host(func); - - if (ret < 0) { + if (ret) dev_err(&func->dev, "wilc_sdio_cmd53..failed, err(%d)\n", ret); - return 0; - } - return 1; + return ret; } static int linux_sdio_probe(struct sdio_func *func, diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index 325e274a64d2..d1b023ad4afe 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -138,6 +138,7 @@ _fail_: static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data) { struct sdio_func *func = dev_to_sdio_func(wilc->dev); + int ret; data = cpu_to_le32(data); @@ -171,8 +172,8 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data) cmd.count = 4; cmd.buffer = (u8 *)&data; cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */ - - if (!wilc_sdio_cmd53(wilc, &cmd)) { + ret = wilc_sdio_cmd53(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd53, write reg (%08x)...\n", addr); goto _fail_; @@ -191,7 +192,7 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) struct sdio_func *func = dev_to_sdio_func(wilc->dev); u32 block_size = g_sdio.block_size; sdio_cmd53_t cmd; - int nblk, nleft; + int nblk, nleft, ret; cmd.read_write = 1; if (addr > 0) { @@ -237,7 +238,8 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) if (!sdio_set_func0_csa_address(wilc, addr)) goto _fail_; } - if (!wilc_sdio_cmd53(wilc, &cmd)) { + ret = wilc_sdio_cmd53(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd53 [%x], block send...\n", addr); goto _fail_; @@ -259,7 +261,8 @@ static int sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) if (!sdio_set_func0_csa_address(wilc, addr)) goto _fail_; } - if (!wilc_sdio_cmd53(wilc, &cmd)) { + ret = wilc_sdio_cmd53(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd53 [%x], bytes send...\n", addr); goto _fail_; @@ -276,6 +279,7 @@ _fail_: static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data) { struct sdio_func *func = dev_to_sdio_func(wilc->dev); + int ret; if ((addr >= 0xf0) && (addr <= 0xff)) { sdio_cmd52_t cmd; @@ -305,8 +309,8 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data) cmd.buffer = (u8 *)data; cmd.block_size = g_sdio.block_size; /* johnny : prevent it from setting unexpected value */ - - if (!wilc_sdio_cmd53(wilc, &cmd)) { + ret = wilc_sdio_cmd53(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd53, read reg (%08x)...\n", addr); goto _fail_; @@ -327,7 +331,7 @@ static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) struct sdio_func *func = dev_to_sdio_func(wilc->dev); u32 block_size = g_sdio.block_size; sdio_cmd53_t cmd; - int nblk, nleft; + int nblk, nleft, ret; cmd.read_write = 0; if (addr > 0) { @@ -373,7 +377,8 @@ static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) if (!sdio_set_func0_csa_address(wilc, addr)) goto _fail_; } - if (!wilc_sdio_cmd53(wilc, &cmd)) { + ret = wilc_sdio_cmd53(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd53 [%x], block read...\n", addr); goto _fail_; @@ -395,7 +400,8 @@ static int sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) if (!sdio_set_func0_csa_address(wilc, addr)) goto _fail_; } - if (!wilc_sdio_cmd53(wilc, &cmd)) { + ret = wilc_sdio_cmd53(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd53 [%x], bytes read...\n", addr); goto _fail_; From 28e9ad2aca609370e5c7a42e926652dd98ff7ed2 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:19 +0900 Subject: [PATCH 650/843] staging: wilc1000: wilc_sdio_cmd52: return linux error value This patch changes return value with linux error value, not 1 or 0. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan_sdio.c | 6 +-- drivers/staging/wilc1000/wilc_sdio.c | 51 ++++++++++++++-------- 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index a918de942cb4..e25811d2c5b5 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -51,11 +51,9 @@ int wilc_sdio_cmd52(struct wilc *wilc, sdio_cmd52_t *cmd) sdio_release_host(func); - if (ret < 0) { + if (ret) dev_err(&func->dev, "wilc_sdio_cmd52..failed, err(%d)\n", ret); - return 0; - } - return 1; + return ret; } diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index d1b023ad4afe..fa1adcf3b683 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -38,6 +38,7 @@ static int sdio_set_func0_csa_address(struct wilc *wilc, u32 adr) { struct sdio_func *func = dev_to_sdio_func(wilc->dev); sdio_cmd52_t cmd; + int ret; /** * Review: BIG ENDIAN @@ -47,21 +48,24 @@ static int sdio_set_func0_csa_address(struct wilc *wilc, u32 adr) cmd.raw = 0; cmd.address = 0x10c; cmd.data = (u8)adr; - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd52, set 0x10c data...\n"); goto _fail_; } cmd.address = 0x10d; cmd.data = (u8)(adr >> 8); - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd52, set 0x10d data...\n"); goto _fail_; } cmd.address = 0x10e; cmd.data = (u8)(adr >> 16); - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd52, set 0x10e data...\n"); goto _fail_; } @@ -75,20 +79,23 @@ static int sdio_set_func0_block_size(struct wilc *wilc, u32 block_size) { struct sdio_func *func = dev_to_sdio_func(wilc->dev); sdio_cmd52_t cmd; + int ret; cmd.read_write = 1; cmd.function = 0; cmd.raw = 0; cmd.address = 0x10; cmd.data = (u8)block_size; - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd52, set 0x10 data...\n"); goto _fail_; } cmd.address = 0x11; cmd.data = (u8)(block_size >> 8); - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd52, set 0x11 data...\n"); goto _fail_; } @@ -108,19 +115,22 @@ static int sdio_set_func1_block_size(struct wilc *wilc, u32 block_size) { struct sdio_func *func = dev_to_sdio_func(wilc->dev); sdio_cmd52_t cmd; + int ret; cmd.read_write = 1; cmd.function = 0; cmd.raw = 0; cmd.address = 0x110; cmd.data = (u8)block_size; - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd52, set 0x110 data...\n"); goto _fail_; } cmd.address = 0x111; cmd.data = (u8)(block_size >> 8); - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd52, set 0x111 data...\n"); goto _fail_; } @@ -150,7 +160,8 @@ static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data) cmd.raw = 0; cmd.address = addr; cmd.data = data; - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd 52, read reg (%08x) ...\n", addr); goto _fail_; @@ -288,7 +299,8 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data) cmd.function = 0; cmd.raw = 0; cmd.address = addr; - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Failed cmd 52, read reg (%08x) ...\n", addr); goto _fail_; @@ -430,7 +442,7 @@ static int sdio_init(struct wilc *wilc) { struct sdio_func *func = dev_to_sdio_func(wilc->dev); sdio_cmd52_t cmd; - int loop; + int loop, ret; u32 chipid; memset(&g_sdio, 0, sizeof(wilc_sdio_t)); @@ -452,7 +464,8 @@ static int sdio_init(struct wilc *wilc) cmd.raw = 1; cmd.address = 0x100; cmd.data = 0x80; - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Fail cmd 52, enable csa...\n"); goto _fail_; } @@ -474,7 +487,8 @@ static int sdio_init(struct wilc *wilc) cmd.raw = 1; cmd.address = 0x2; cmd.data = 0x2; - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Fail cmd 52, set IOE register...\n"); goto _fail_; @@ -490,7 +504,8 @@ static int sdio_init(struct wilc *wilc) loop = 3; do { cmd.data = 0; - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Fail cmd 52, get IOR register...\n"); goto _fail_; @@ -520,7 +535,8 @@ static int sdio_init(struct wilc *wilc) cmd.raw = 1; cmd.address = 0x4; cmd.data = 0x3; - if (!wilc_sdio_cmd52(wilc, &cmd)) { + ret = wilc_sdio_cmd52(wilc, &cmd); + if (ret) { dev_err(&func->dev, "Fail cmd 52, set IEN register...\n"); goto _fail_; } @@ -548,7 +564,6 @@ _fail_: static int sdio_read_size(struct wilc *wilc, u32 *size) { - u32 tmp; sdio_cmd52_t cmd; @@ -667,7 +682,7 @@ static int sdio_clear_int_ext(struct wilc *wilc, u32 val) cmd.data = reg; ret = wilc_sdio_cmd52(wilc, &cmd); - if (!ret) { + if (ret) { dev_err(&func->dev, "Failed cmd52, set 0xf8 data (%d) ...\n", __LINE__); @@ -697,7 +712,7 @@ static int sdio_clear_int_ext(struct wilc *wilc, u32 val) cmd.data = BIT(i); ret = wilc_sdio_cmd52(wilc, &cmd); - if (!ret) { + if (ret) { dev_err(&func->dev, "Failed cmd52, set 0xf8 data (%d) ...\n", __LINE__); @@ -744,7 +759,7 @@ static int sdio_clear_int_ext(struct wilc *wilc, u32 val) cmd.address = 0xf6; cmd.data = vmm_ctl; ret = wilc_sdio_cmd52(wilc, &cmd); - if (!ret) { + if (ret) { dev_err(&func->dev, "Failed cmd52, set 0xf6 data (%d) ...\n", __LINE__); From 5b46e16702e2413e3e885f4acf122505ecdaa03c Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:20 +0900 Subject: [PATCH 651/843] staging: wilc1000: linux_wlan_spi.c: remove braces for single statement This patches fixes checkpatch warning: braces {} are not necessary for single statement blocks. Remove some comments also. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan_spi.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index 01fa6fa0cc1d..6fcf7b39880e 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -15,7 +15,7 @@ #include "linux_wlan_common.h" #include "wilc_wlan_if.h" -#define USE_SPI_DMA 0 /* johnny add */ +#define USE_SPI_DMA 0 static const struct wilc1000_ops wilc1000_spi_ops; @@ -87,16 +87,13 @@ int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len) memset(&msg, 0, sizeof(msg)); spi_message_init(&msg); -/* [[johnny add */ msg.spi = spi; msg.is_dma_mapped = USE_SPI_DMA; -/* ]] */ spi_message_add_tail(&tr, &msg); ret = spi_sync(spi, &msg); - if (ret < 0) { + if (ret < 0) dev_err(&spi->dev, "SPI transaction failed\n"); - } kfree(r_buffer); } else { @@ -137,16 +134,13 @@ int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen) memset(&msg, 0, sizeof(msg)); spi_message_init(&msg); -/* [[ johnny add */ msg.spi = spi; msg.is_dma_mapped = USE_SPI_DMA; -/* ]] */ spi_message_add_tail(&tr, &msg); ret = spi_sync(spi, &msg); - if (ret < 0) { + if (ret < 0) dev_err(&spi->dev, "SPI transaction failed\n"); - } kfree(t_buffer); } else { dev_err(&spi->dev, @@ -183,9 +177,8 @@ int wilc_spi_write_read(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen) spi_message_add_tail(&tr, &msg); ret = spi_sync(spi, &msg); - if (ret < 0) { + if (ret < 0) dev_err(&spi->dev, "SPI transaction failed\n"); - } } else { dev_err(&spi->dev, "can't read data with the following length: %u\n", From d8506598003ba874317e7dc632339fc9052043a8 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:21 +0900 Subject: [PATCH 652/843] staging: wilc1000: linux_wlan_spi.c: add a blank This patch fixes checkpatch warning: missing a blank like after declarations. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan_spi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index 6fcf7b39880e..190243afb8ce 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -79,6 +79,7 @@ int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len) .delay_usecs = 0, }; char *r_buffer = kzalloc(len, GFP_KERNEL); + if (!r_buffer) return -ENOMEM; @@ -127,6 +128,7 @@ int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen) }; char *t_buffer = kzalloc(rlen, GFP_KERNEL); + if (!t_buffer) return -ENOMEM; From 3bac1c51dc2d61038155b298792e3663b356c0c4 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:22 +0900 Subject: [PATCH 653/843] staging: wilc1000: linux_wlan_spi.c: fix NULL comparison style This patch fixes checkpatch CHECK:comparison to NULL could be written "b". Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index 190243afb8ce..61114057b8f7 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -72,7 +72,7 @@ int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len) int ret; struct spi_message msg; - if (len > 0 && b != NULL) { + if (len > 0 && b) { struct spi_transfer tr = { .tx_buf = b, .len = len, From 369a1d3bd3b357f9c7cc6ccb320c6b2e7680f9f5 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Mon, 21 Dec 2015 14:18:23 +0900 Subject: [PATCH 654/843] staging: wilc1000: replace explicit NULL comparisons with ! This patch replace explicit NULL comparison with ! operator to simplify code. Reported by checkpatch.pl for Comparison to NULL could be written !XXX" or "XXX". Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 71038b1c202d..bdc4537d8760 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -463,7 +463,7 @@ static void CfgScanResult(enum scan_event scan_event, down(&(priv->hSemScanReq)); - if (priv->pstrScanReq != NULL) { + if (priv->pstrScanReq) { cfg80211_scan_done(priv->pstrScanReq, false); priv->u32RcvdChCount = 0; priv->bCfgScanning = false; @@ -474,7 +474,7 @@ static void CfgScanResult(enum scan_event scan_event, down(&(priv->hSemScanReq)); PRINT_D(CFG80211_DBG, "Scan Aborted\n"); - if (priv->pstrScanReq != NULL) { + if (priv->pstrScanReq) { update_scan_time(); refresh_scan(priv, 1, false); @@ -645,7 +645,8 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) for (i = 0; i < request->n_ssids; i++) { - if (request->ssids[i].ssid != NULL && request->ssids[i].ssid_len != 0) { + if (request->ssids[i].ssid && + request->ssids[i].ssid_len != 0) { strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid = kmalloc(request->ssids[i].ssid_len, GFP_KERNEL); memcpy(strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, request->ssids[i].ssid, request->ssids[i].ssid_len); strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen = request->ssids[i].ssid_len; @@ -716,7 +717,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, sme->ssid, sme->ssid_len) == 0) { PRINT_INFO(CFG80211_DBG, "Network with required SSID is found %s\n", sme->ssid); - if (sme->bssid == NULL) { + if (!sme->bssid) { PRINT_INFO(CFG80211_DBG, "BSSID is not passed from the user\n"); break; } else { @@ -1009,12 +1010,12 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, case WLAN_CIPHER_SUITE_TKIP: case WLAN_CIPHER_SUITE_CCMP: if (priv->wdev->iftype == NL80211_IFTYPE_AP || priv->wdev->iftype == NL80211_IFTYPE_P2P_GO) { - if (priv->wilc_gtk[key_index] == NULL) { + if (!priv->wilc_gtk[key_index]) { priv->wilc_gtk[key_index] = kmalloc(sizeof(struct wilc_wfi_key), GFP_KERNEL); priv->wilc_gtk[key_index]->key = NULL; priv->wilc_gtk[key_index]->seq = NULL; } - if (priv->wilc_ptk[key_index] == NULL) { + if (!priv->wilc_ptk[key_index]) { priv->wilc_ptk[key_index] = kmalloc(sizeof(struct wilc_wfi_key), GFP_KERNEL); priv->wilc_ptk[key_index]->key = NULL; priv->wilc_ptk[key_index]->seq = NULL; @@ -1828,12 +1829,12 @@ static int mgmt_tx(struct wiphy *wiphy, if (ieee80211_is_mgmt(mgmt->frame_control)) { mgmt_tx = kmalloc(sizeof(struct p2p_mgmt_data), GFP_KERNEL); - if (mgmt_tx == NULL) { + if (!mgmt_tx) { PRINT_ER("Failed to allocate memory for mgmt_tx structure\n"); return -EFAULT; } mgmt_tx->buff = kmalloc(buf_len, GFP_KERNEL); - if (mgmt_tx->buff == NULL) { + if (!mgmt_tx->buff) { PRINT_ER("Failed to allocate memory for mgmt_tx buff\n"); kfree(mgmt_tx); return -EFAULT; @@ -2037,11 +2038,11 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, PRINT_D(CFG80211_DBG, " Power save Enabled= %d , TimeOut = %d\n", enabled, timeout); - if (wiphy == NULL) + if (!wiphy) return -ENOENT; priv = wiphy_priv(wiphy); - if (priv->hWILCWFIDrv == NULL) { + if (!priv->hWILCWFIDrv) { PRINT_ER("Driver is NULL\n"); return -EIO; } @@ -2451,7 +2452,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, PRINT_D(HOSTAPD_DBG, "Number of supported rates = %d\n", strStaParams.rates_len); - if (params->ht_capa == NULL) { + if (!params->ht_capa) { strStaParams.ht_supported = false; } else { strStaParams.ht_supported = true; @@ -2511,7 +2512,7 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev, PRINT_D(HOSTAPD_DBG, "Deleting station\n"); - if (mac == NULL) { + if (!mac) { PRINT_D(HOSTAPD_DBG, "All associated stations\n"); s32Error = wilc_del_allstation(priv->hWILCWFIDrv, priv->assoc_stainfo.au8Sta_AssociatedBss); } else { @@ -2557,7 +2558,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, PRINT_D(HOSTAPD_DBG, "Number of supported rates = %d\n", strStaParams.rates_len); - if (params->ht_capa == NULL) { + if (!params->ht_capa) { strStaParams.ht_supported = false; } else { strStaParams.ht_supported = true; @@ -2622,7 +2623,7 @@ static struct wireless_dev *add_virtual_intf(struct wiphy *wiphy, PRINT_D(HOSTAPD_DBG, "Monitor interface mode: Initializing mon interface virtual device driver\n"); PRINT_D(HOSTAPD_DBG, "Adding monitor interface[%p]\n", nic->wilc_netdev); new_ifc = WILC_WFI_init_mon_interface(name, nic->wilc_netdev); - if (new_ifc != NULL) { + if (new_ifc) { PRINT_D(HOSTAPD_DBG, "Setting monitor flag in private structure\n"); nic = netdev_priv(priv->wdev->netdev); nic->monitor_flag = 1; @@ -2748,7 +2749,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device *de PRINT_D(CFG80211_DBG, "Registering wifi device\n"); wdev = WILC_WFI_CfgAlloc(); - if (wdev == NULL) { + if (!wdev) { PRINT_ER("CfgAlloc Failed\n"); return NULL; } From 653bb46301617e39e720e60fa2e0a01f946c9a6e Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Mon, 21 Dec 2015 14:18:24 +0900 Subject: [PATCH 655/843] staging: wilc1000: fixes potential null dereference 'wid.val' This patch fixes the error reported by smatch. - Handle_ListenStateExpired() error: potential null dereference 'wid.val' If kmalloc failed, referenced to a NULL pointer. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index d1707f6f0dcc..2289ba344300 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2635,8 +2635,10 @@ static u32 Handle_ListenStateExpired(struct host_if_drv *hif_drv, wid.size = 2; wid.val = kmalloc(wid.size, GFP_KERNEL); - if (!wid.val) + if (!wid.val) { PRINT_ER("Failed to allocate memory\n"); + return -ENOMEM; + } wid.val[0] = u8remain_on_chan_flag; wid.val[1] = FALSE_FRMWR_CHANNEL; From cb3b05c3845815e1fdeff94fcd5e8a57ceff702e Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Mon, 21 Dec 2015 14:18:25 +0900 Subject: [PATCH 656/843] staging: wilc1000: wilc_init(): fixes inconsistent returns This patch fixes the warning reported by smatch. - wilc_init() warn: inconsistent returns 'sem:&hif_drv->sem_cfg_values' No need to up the sema here since down was not called before get here. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 2289ba344300..6dd3076a78e1 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3873,7 +3873,6 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) return result; _fail_timer_2: - up(&hif_drv->sem_cfg_values); del_timer_sync(&hif_drv->connect_timer); del_timer_sync(&hif_drv->scan_timer); kthread_stop(hif_thread_handler); From 6d04d7a0d9b63dfb8942eb5e0855b9be40bc5893 Mon Sep 17 00:00:00 2001 From: Leo Kim Date: Mon, 21 Dec 2015 14:18:26 +0900 Subject: [PATCH 657/843] staging: wilc1000: wilc_deinit(): fixes inconsistent returns This patch fixes the warning reported by smatch. - wilc_deinit() warn: inconsistent returns 'sem:&hif_drv->sem_cfg_values' This semaphore protect a cfg_values variable but cfg_values variables was not used here. So, just remove this line. Signed-off-by: Leo Kim Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 6dd3076a78e1..c8b4d86dc7b7 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3940,8 +3940,6 @@ s32 wilc_deinit(struct host_if_drv *hif_drv) wilc_mq_destroy(&hif_msg_q); } - down(&hif_drv->sem_cfg_values); - ret = remove_handler_in_list(hif_drv); if (ret) result = -ENOENT; From 0f34e924f6cfb0730fc33d9b58a5d91c88239792 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:27 +0900 Subject: [PATCH 658/843] staging: wilc1000: linux_wlan_spi.c: return linux error value return linux error value instead of 0 or 1 and use -EINVAL. Related codes also changed together. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan_spi.c | 14 +++----------- drivers/staging/wilc1000/wilc_spi.c | 18 +++++++++--------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index 61114057b8f7..c7d25425cc54 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -104,13 +104,9 @@ int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len) dev_err(&spi->dev, "FAILED due to NULL buffer or ZERO length check the following length: %d\n", len); - ret = -1; + ret = -EINVAL; } - /* change return value to match WILC interface */ - (ret < 0) ? (ret = 0) : (ret = 1); - - return ret; } @@ -148,10 +144,8 @@ int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen) dev_err(&spi->dev, "can't read data with the following length: %u\n", rlen); - ret = -1; + ret = -EINVAL; } - /* change return value to match WILC interface */ - (ret < 0) ? (ret = 0) : (ret = 1); return ret; } @@ -185,10 +179,8 @@ int wilc_spi_write_read(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen) dev_err(&spi->dev, "can't read data with the following length: %u\n", rlen); - ret = -1; + ret = -EINVAL; } - /* change return value to match WILC interface */ - (ret < 0) ? (ret = 0) : (ret = 1); return ret; } diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index faaeaf7cba86..bd61aac6d7af 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -250,7 +250,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, } rix = len; - if (!wilc_spi_write_read(wilc, wb, rb, len2)) { + if (wilc_spi_write_read(wilc, wb, rb, len2)) { dev_err(&spi->dev, "Failed cmd write, bus error...\n"); result = N_FAIL; return result; @@ -366,7 +366,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, /** * Read bytes **/ - if (!wilc_spi_read(wilc, &b[ix], nbytes)) { + if (wilc_spi_read(wilc, &b[ix], nbytes)) { dev_err(&spi->dev, "Failed data block read, bus error...\n"); result = N_FAIL; goto _error_; @@ -376,7 +376,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, * Read Crc **/ if (!g_spi.crc_off) { - if (!wilc_spi_read(wilc, crc, 2)) { + if (wilc_spi_read(wilc, crc, 2)) { dev_err(&spi->dev, "Failed data block crc read, bus error...\n"); result = N_FAIL; goto _error_; @@ -407,7 +407,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, **/ retry = 10; do { - if (!wilc_spi_read(wilc, &rsp, 1)) { + if (wilc_spi_read(wilc, &rsp, 1)) { dev_err(&spi->dev, "Failed data response read, bus error...\n"); result = N_FAIL; break; @@ -423,7 +423,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, /** * Read bytes **/ - if (!wilc_spi_read(wilc, &b[ix], nbytes)) { + if (wilc_spi_read(wilc, &b[ix], nbytes)) { dev_err(&spi->dev, "Failed data block read, bus error...\n"); result = N_FAIL; break; @@ -433,7 +433,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, * Read Crc **/ if (!g_spi.crc_off) { - if (!wilc_spi_read(wilc, crc, 2)) { + if (wilc_spi_read(wilc, crc, 2)) { dev_err(&spi->dev, "Failed data block crc read, bus error...\n"); result = N_FAIL; break; @@ -484,7 +484,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz) order = 0x2; } cmd |= order; - if (!wilc_spi_write(wilc, &cmd, 1)) { + if (wilc_spi_write(wilc, &cmd, 1)) { dev_err(&spi->dev, "Failed data block cmd write, bus error...\n"); result = N_FAIL; @@ -494,7 +494,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz) /** * Write data **/ - if (!wilc_spi_write(wilc, &b[ix], nbytes)) { + if (wilc_spi_write(wilc, &b[ix], nbytes)) { dev_err(&spi->dev, "Failed data block write, bus error...\n"); result = N_FAIL; @@ -505,7 +505,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz) * Write Crc **/ if (!g_spi.crc_off) { - if (!wilc_spi_write(wilc, crc, 2)) { + if (wilc_spi_write(wilc, crc, 2)) { dev_err(&spi->dev,"Failed data block crc write, bus error...\n"); result = N_FAIL; break; From 51d002931b170ea6f056a4c12ae0a9f7233202e5 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:28 +0900 Subject: [PATCH 659/843] staging: wilc1000: linux_sdio_probe: use return value Return ret from wilc_netdev_init instead of -1 for proper error handling. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan_sdio.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index e25811d2c5b5..4b9cb5562038 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -91,7 +91,7 @@ static int linux_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) { struct wilc *wilc; - int gpio; + int gpio, ret; gpio = -1; if (IS_ENABLED(CONFIG_WILC1000_HW_OOB_INTR)) { @@ -101,10 +101,11 @@ static int linux_sdio_probe(struct sdio_func *func, } dev_dbg(&func->dev, "Initializing netdev\n"); - if (wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, gpio, - &wilc_hif_sdio)) { + ret = wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, gpio, + &wilc_hif_sdio); + if (ret) { dev_err(&func->dev, "Couldn't initialize netdev\n"); - return -1; + return ret; } sdio_set_drvdata(func, wilc); wilc->dev = &func->dev; From 35a4569e72eec439a2d7e6c860ed42c518aa8f76 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:29 +0900 Subject: [PATCH 660/843] staging: wilc1000: linux_wlan_sdio.c: move all the codes to wilc_sdio.c To Combine linux_wlan_sdio.c and wilc_sdio.c as one file, move all the codes in linux_wlan_sdio.c to wilc_sdio.c, and make functions static only. No Modification has not been made except static, just moved them. Function declaration in linux_wlan_sdio.h is needless, so just remove them. linux_wlan_sdio.[ch] will be deleted in the next patch. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan_sdio.c | 160 -------------------- drivers/staging/wilc1000/linux_wlan_sdio.h | 7 - drivers/staging/wilc1000/wilc_sdio.c | 164 ++++++++++++++++++++- 3 files changed, 163 insertions(+), 168 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index 4b9cb5562038..67d99e9d2839 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -8,163 +8,3 @@ #include #include "linux_wlan_sdio.h" - -#define SDIO_MODALIAS "wilc1000_sdio" - -#define SDIO_VENDOR_ID_WILC 0x0296 -#define SDIO_DEVICE_ID_WILC 0x5347 - -static const struct sdio_device_id wilc_sdio_ids[] = { - { SDIO_DEVICE(SDIO_VENDOR_ID_WILC, SDIO_DEVICE_ID_WILC) }, - { }, -}; - - -static void wilc_sdio_interrupt(struct sdio_func *func) -{ - sdio_release_host(func); - wilc_handle_isr(sdio_get_drvdata(func)); - sdio_claim_host(func); -} - -int wilc_sdio_cmd52(struct wilc *wilc, sdio_cmd52_t *cmd) -{ - struct sdio_func *func = container_of(wilc->dev, struct sdio_func, dev); - int ret; - u8 data; - - sdio_claim_host(func); - - func->num = cmd->function; - if (cmd->read_write) { /* write */ - if (cmd->raw) { - sdio_writeb(func, cmd->data, cmd->address, &ret); - data = sdio_readb(func, cmd->address, &ret); - cmd->data = data; - } else { - sdio_writeb(func, cmd->data, cmd->address, &ret); - } - } else { /* read */ - data = sdio_readb(func, cmd->address, &ret); - cmd->data = data; - } - - sdio_release_host(func); - - if (ret) - dev_err(&func->dev, "wilc_sdio_cmd52..failed, err(%d)\n", ret); - return ret; -} - - -int wilc_sdio_cmd53(struct wilc *wilc, sdio_cmd53_t *cmd) -{ - struct sdio_func *func = container_of(wilc->dev, struct sdio_func, dev); - int size, ret; - - sdio_claim_host(func); - - func->num = cmd->function; - func->cur_blksize = cmd->block_size; - if (cmd->block_mode) - size = cmd->count * cmd->block_size; - else - size = cmd->count; - - if (cmd->read_write) { /* write */ - ret = sdio_memcpy_toio(func, cmd->address, - (void *)cmd->buffer, size); - } else { /* read */ - ret = sdio_memcpy_fromio(func, (void *)cmd->buffer, - cmd->address, size); - } - - sdio_release_host(func); - - if (ret) - dev_err(&func->dev, "wilc_sdio_cmd53..failed, err(%d)\n", ret); - - return ret; -} - -static int linux_sdio_probe(struct sdio_func *func, - const struct sdio_device_id *id) -{ - struct wilc *wilc; - int gpio, ret; - - gpio = -1; - if (IS_ENABLED(CONFIG_WILC1000_HW_OOB_INTR)) { - gpio = of_get_gpio(func->dev.of_node, 0); - if (gpio < 0) - gpio = GPIO_NUM; - } - - dev_dbg(&func->dev, "Initializing netdev\n"); - ret = wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, gpio, - &wilc_hif_sdio); - if (ret) { - dev_err(&func->dev, "Couldn't initialize netdev\n"); - return ret; - } - sdio_set_drvdata(func, wilc); - wilc->dev = &func->dev; - - dev_info(&func->dev, "Driver Initializing success\n"); - return 0; -} - -static void linux_sdio_remove(struct sdio_func *func) -{ - wilc_netdev_cleanup(sdio_get_drvdata(func)); -} - -static struct sdio_driver wilc1000_sdio_driver = { - .name = SDIO_MODALIAS, - .id_table = wilc_sdio_ids, - .probe = linux_sdio_probe, - .remove = linux_sdio_remove, -}; -module_driver(wilc1000_sdio_driver, - sdio_register_driver, - sdio_unregister_driver); -MODULE_LICENSE("GPL"); - -int wilc_sdio_enable_interrupt(struct wilc *dev) -{ - struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev); - int ret = 0; - - sdio_claim_host(func); - ret = sdio_claim_irq(func, wilc_sdio_interrupt); - sdio_release_host(func); - - if (ret < 0) { - dev_err(&func->dev, "can't claim sdio_irq, err(%d)\n", ret); - ret = -EIO; - } - return ret; -} - -void wilc_sdio_disable_interrupt(struct wilc *dev) -{ - struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev); - int ret; - - dev_dbg(&func->dev, "wilc_sdio_disable_interrupt IN\n"); - - sdio_claim_host(func); - ret = sdio_release_irq(func); - if (ret < 0) - dev_err(&func->dev, "can't release sdio_irq, err(%d)\n", ret); - sdio_release_host(func); - - dev_info(&func->dev, "wilc_sdio_disable_interrupt OUT\n"); -} - -int wilc_sdio_init(void) -{ - return 1; -} - -MODULE_LICENSE("GPL"); diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h b/drivers/staging/wilc1000/linux_wlan_sdio.h index 8d276c61cdcc..abb23126ca83 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.h +++ b/drivers/staging/wilc1000/linux_wlan_sdio.h @@ -1,8 +1 @@ #include - -int wilc_sdio_init(void); -int wilc_sdio_cmd52(struct wilc *wilc, sdio_cmd52_t *cmd); -int wilc_sdio_cmd53(struct wilc *wilc, sdio_cmd53_t *cmd); - -int wilc_sdio_enable_interrupt(struct wilc *); -void wilc_sdio_disable_interrupt(struct wilc *); diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index fa1adcf3b683..e961b5004902 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -10,8 +10,23 @@ #include #include "wilc_wlan_if.h" #include "wilc_wlan.h" -#include "linux_wlan_sdio.h" #include "wilc_wfi_netdevice.h" +#include +#include +#include +#include +#include +#include + +#define SDIO_MODALIAS "wilc1000_sdio" + +#define SDIO_VENDOR_ID_WILC 0x0296 +#define SDIO_DEVICE_ID_WILC 0x5347 + +static const struct sdio_device_id wilc_sdio_ids[] = { + { SDIO_DEVICE(SDIO_VENDOR_ID_WILC, SDIO_DEVICE_ID_WILC) }, + { }, +}; #define WILC_SDIO_BLOCK_SIZE 512 @@ -28,6 +43,153 @@ static wilc_sdio_t g_sdio; static int sdio_write_reg(struct wilc *wilc, u32 addr, u32 data); static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data); +static void wilc_sdio_interrupt(struct sdio_func *func) +{ + sdio_release_host(func); + wilc_handle_isr(sdio_get_drvdata(func)); + sdio_claim_host(func); +} + +static int wilc_sdio_cmd52(struct wilc *wilc, sdio_cmd52_t *cmd) +{ + struct sdio_func *func = container_of(wilc->dev, struct sdio_func, dev); + int ret; + u8 data; + + sdio_claim_host(func); + + func->num = cmd->function; + if (cmd->read_write) { /* write */ + if (cmd->raw) { + sdio_writeb(func, cmd->data, cmd->address, &ret); + data = sdio_readb(func, cmd->address, &ret); + cmd->data = data; + } else { + sdio_writeb(func, cmd->data, cmd->address, &ret); + } + } else { /* read */ + data = sdio_readb(func, cmd->address, &ret); + cmd->data = data; + } + + sdio_release_host(func); + + if (ret) + dev_err(&func->dev, "wilc_sdio_cmd52..failed, err(%d)\n", ret); + return ret; +} + + +static int wilc_sdio_cmd53(struct wilc *wilc, sdio_cmd53_t *cmd) +{ + struct sdio_func *func = container_of(wilc->dev, struct sdio_func, dev); + int size, ret; + + sdio_claim_host(func); + + func->num = cmd->function; + func->cur_blksize = cmd->block_size; + if (cmd->block_mode) + size = cmd->count * cmd->block_size; + else + size = cmd->count; + + if (cmd->read_write) { /* write */ + ret = sdio_memcpy_toio(func, cmd->address, + (void *)cmd->buffer, size); + } else { /* read */ + ret = sdio_memcpy_fromio(func, (void *)cmd->buffer, + cmd->address, size); + } + + sdio_release_host(func); + + if (ret) + dev_err(&func->dev, "wilc_sdio_cmd53..failed, err(%d)\n", ret); + + return ret; +} + +static int linux_sdio_probe(struct sdio_func *func, + const struct sdio_device_id *id) +{ + struct wilc *wilc; + int gpio, ret; + + gpio = -1; + if (IS_ENABLED(CONFIG_WILC1000_HW_OOB_INTR)) { + gpio = of_get_gpio(func->dev.of_node, 0); + if (gpio < 0) + gpio = GPIO_NUM; + } + + dev_dbg(&func->dev, "Initializing netdev\n"); + ret = wilc_netdev_init(&wilc, &func->dev, HIF_SDIO, gpio, + &wilc_hif_sdio); + if (ret) { + dev_err(&func->dev, "Couldn't initialize netdev\n"); + return ret; + } + sdio_set_drvdata(func, wilc); + wilc->dev = &func->dev; + + dev_info(&func->dev, "Driver Initializing success\n"); + return 0; +} + +static void linux_sdio_remove(struct sdio_func *func) +{ + wilc_netdev_cleanup(sdio_get_drvdata(func)); +} + +static struct sdio_driver wilc1000_sdio_driver = { + .name = SDIO_MODALIAS, + .id_table = wilc_sdio_ids, + .probe = linux_sdio_probe, + .remove = linux_sdio_remove, +}; +module_driver(wilc1000_sdio_driver, + sdio_register_driver, + sdio_unregister_driver); +MODULE_LICENSE("GPL"); + +static int wilc_sdio_enable_interrupt(struct wilc *dev) +{ + struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev); + int ret = 0; + + sdio_claim_host(func); + ret = sdio_claim_irq(func, wilc_sdio_interrupt); + sdio_release_host(func); + + if (ret < 0) { + dev_err(&func->dev, "can't claim sdio_irq, err(%d)\n", ret); + ret = -EIO; + } + return ret; +} + +static void wilc_sdio_disable_interrupt(struct wilc *dev) +{ + struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev); + int ret; + + dev_dbg(&func->dev, "wilc_sdio_disable_interrupt IN\n"); + + sdio_claim_host(func); + ret = sdio_release_irq(func); + if (ret < 0) + dev_err(&func->dev, "can't release sdio_irq, err(%d)\n", ret); + sdio_release_host(func); + + dev_info(&func->dev, "wilc_sdio_disable_interrupt OUT\n"); +} + +static int wilc_sdio_init(void) +{ + return 1; +} + /******************************************** * * Function 0 From 895e5eafadb339030a7a039cb29e4f116a87cc22 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:30 +0900 Subject: [PATCH 661/843] staging: wilc1000: remove unused files This patch removes linux_wlan_sdio.[ch] which is not used anymore. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/Makefile | 2 +- drivers/staging/wilc1000/linux_wlan_sdio.c | 10 ---------- drivers/staging/wilc1000/linux_wlan_sdio.h | 1 - 3 files changed, 1 insertion(+), 12 deletions(-) delete mode 100644 drivers/staging/wilc1000/linux_wlan_sdio.c delete mode 100644 drivers/staging/wilc1000/linux_wlan_sdio.h diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile index 207674376553..09f0ddbb6774 100644 --- a/drivers/staging/wilc1000/Makefile +++ b/drivers/staging/wilc1000/Makefile @@ -14,7 +14,7 @@ wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \ wilc_wlan.o obj-$(CONFIG_WILC1000_SDIO) += wilc1000-sdio.o -wilc1000-sdio-objs += linux_wlan_sdio.o wilc_sdio.o +wilc1000-sdio-objs += wilc_sdio.o obj-$(CONFIG_WILC1000_SPI) += wilc1000-spi.o wilc1000-spi-objs += linux_wlan_spi.o wilc_spi.o diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c deleted file mode 100644 index 67d99e9d2839..000000000000 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "wilc_wfi_netdevice.h" - -#include -#include -#include -#include -#include -#include - -#include "linux_wlan_sdio.h" diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.h b/drivers/staging/wilc1000/linux_wlan_sdio.h deleted file mode 100644 index abb23126ca83..000000000000 --- a/drivers/staging/wilc1000/linux_wlan_sdio.h +++ /dev/null @@ -1 +0,0 @@ -#include From d4312b6fc8522d21832dbd1fa3f1dfb843e5b568 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:31 +0900 Subject: [PATCH 662/843] staging: wilc1000: rename spi function names There are several similar function names, such as wilc_spi_write and _wilc_spi_write. It is likely to be confused after merging linux_wlan_spi.c and wilc_spi.c, so rename following functions properly. Rename wilc_spi_write to wilc_spi_tx, wilc_spi_read to wilc_spi_rx, wilc_spi_write_read to wilc_spi_tx_rx, _wilc_spi_write to wilc_spi_write, _wilc_spi_read to wilc_spi_read. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan_spi.c | 6 ++-- drivers/staging/wilc1000/linux_wlan_spi.h | 6 ++-- drivers/staging/wilc1000/wilc_spi.c | 34 +++++++++++------------ 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index c7d25425cc54..e9ad33f62021 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -66,7 +66,7 @@ int wilc_spi_init(void) return 1; } -int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len) +int wilc_spi_tx(struct wilc *wilc, u8 *b, u32 len) { struct spi_device *spi = to_spi_device(wilc->dev); int ret; @@ -110,7 +110,7 @@ int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len) return ret; } -int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen) +int wilc_spi_rx(struct wilc *wilc, u8 *rb, u32 rlen) { struct spi_device *spi = to_spi_device(wilc->dev); int ret; @@ -150,7 +150,7 @@ int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen) return ret; } -int wilc_spi_write_read(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen) +int wilc_spi_tx_rx(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen) { struct spi_device *spi = to_spi_device(wilc->dev); int ret; diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h b/drivers/staging/wilc1000/linux_wlan_spi.h index 00733aba9179..5ff070b9ace5 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.h +++ b/drivers/staging/wilc1000/linux_wlan_spi.h @@ -5,7 +5,7 @@ #include "wilc_wfi_netdevice.h" int wilc_spi_init(void); -int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len); -int wilc_spi_read(struct wilc *wilc, u8 *rb, u32 rlen); -int wilc_spi_write_read(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen); +int wilc_spi_tx(struct wilc *wilc, u8 *b, u32 len); +int wilc_spi_rx(struct wilc *wilc, u8 *rb, u32 rlen); +int wilc_spi_tx_rx(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen); #endif diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index bd61aac6d7af..ce12d29bf41a 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -21,8 +21,8 @@ typedef struct { static wilc_spi_t g_spi; -static int _wilc_spi_read(struct wilc *wilc, u32, u8 *, u32); -static int _wilc_spi_write(struct wilc *wilc, u32, u8 *, u32); +static int wilc_spi_read(struct wilc *wilc, u32, u8 *, u32); +static int wilc_spi_write(struct wilc *wilc, u32, u8 *, u32); /******************************************** * @@ -250,7 +250,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, } rix = len; - if (wilc_spi_write_read(wilc, wb, rb, len2)) { + if (wilc_spi_tx_rx(wilc, wb, rb, len2)) { dev_err(&spi->dev, "Failed cmd write, bus error...\n"); result = N_FAIL; return result; @@ -366,7 +366,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, /** * Read bytes **/ - if (wilc_spi_read(wilc, &b[ix], nbytes)) { + if (wilc_spi_rx(wilc, &b[ix], nbytes)) { dev_err(&spi->dev, "Failed data block read, bus error...\n"); result = N_FAIL; goto _error_; @@ -376,7 +376,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, * Read Crc **/ if (!g_spi.crc_off) { - if (wilc_spi_read(wilc, crc, 2)) { + if (wilc_spi_rx(wilc, crc, 2)) { dev_err(&spi->dev, "Failed data block crc read, bus error...\n"); result = N_FAIL; goto _error_; @@ -407,7 +407,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, **/ retry = 10; do { - if (wilc_spi_read(wilc, &rsp, 1)) { + if (wilc_spi_rx(wilc, &rsp, 1)) { dev_err(&spi->dev, "Failed data response read, bus error...\n"); result = N_FAIL; break; @@ -423,7 +423,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, /** * Read bytes **/ - if (wilc_spi_read(wilc, &b[ix], nbytes)) { + if (wilc_spi_rx(wilc, &b[ix], nbytes)) { dev_err(&spi->dev, "Failed data block read, bus error...\n"); result = N_FAIL; break; @@ -433,7 +433,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, * Read Crc **/ if (!g_spi.crc_off) { - if (wilc_spi_read(wilc, crc, 2)) { + if (wilc_spi_rx(wilc, crc, 2)) { dev_err(&spi->dev, "Failed data block crc read, bus error...\n"); result = N_FAIL; break; @@ -484,7 +484,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz) order = 0x2; } cmd |= order; - if (wilc_spi_write(wilc, &cmd, 1)) { + if (wilc_spi_tx(wilc, &cmd, 1)) { dev_err(&spi->dev, "Failed data block cmd write, bus error...\n"); result = N_FAIL; @@ -494,7 +494,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz) /** * Write data **/ - if (wilc_spi_write(wilc, &b[ix], nbytes)) { + if (wilc_spi_tx(wilc, &b[ix], nbytes)) { dev_err(&spi->dev, "Failed data block write, bus error...\n"); result = N_FAIL; @@ -505,7 +505,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz) * Write Crc **/ if (!g_spi.crc_off) { - if (wilc_spi_write(wilc, crc, 2)) { + if (wilc_spi_tx(wilc, crc, 2)) { dev_err(&spi->dev,"Failed data block crc write, bus error...\n"); result = N_FAIL; break; @@ -589,7 +589,7 @@ static int wilc_spi_write_reg(struct wilc *wilc, u32 addr, u32 data) return result; } -static int _wilc_spi_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) +static int wilc_spi_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) { struct spi_device *spi = to_spi_device(wilc->dev); int result; @@ -644,7 +644,7 @@ static int wilc_spi_read_reg(struct wilc *wilc, u32 addr, u32 *data) return 1; } -static int _wilc_spi_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) +static int wilc_spi_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) { struct spi_device *spi = to_spi_device(wilc->dev); u8 cmd = CMD_DMA_EXT_READ; @@ -998,12 +998,12 @@ const struct wilc_hif_func wilc_hif_spi = { .hif_deinit = _wilc_spi_deinit, .hif_read_reg = wilc_spi_read_reg, .hif_write_reg = wilc_spi_write_reg, - .hif_block_rx = _wilc_spi_read, - .hif_block_tx = _wilc_spi_write, + .hif_block_rx = wilc_spi_read, + .hif_block_tx = wilc_spi_write, .hif_read_int = wilc_spi_read_int, .hif_clear_int_ext = wilc_spi_clear_int_ext, .hif_read_size = wilc_spi_read_size, - .hif_block_tx_ext = _wilc_spi_write, - .hif_block_rx_ext = _wilc_spi_read, + .hif_block_tx_ext = wilc_spi_write, + .hif_block_rx_ext = wilc_spi_read, .hif_sync_ext = wilc_spi_sync_ext, }; From 2769d9422e631559bc672dda9cdb7a5916db4527 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:32 +0900 Subject: [PATCH 663/843] staging: wilc1000: remove unneeded function wilc_spi_init in linux_wlan_spi.c is unneeded. It just return true. Rename _wilc_spi_init in wlan_spi.c to wilc_spi_init. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan_spi.c | 5 ----- drivers/staging/wilc1000/linux_wlan_spi.h | 1 - drivers/staging/wilc1000/wilc_spi.c | 11 ++--------- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index e9ad33f62021..06935cfb3eff 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -61,11 +61,6 @@ struct spi_driver wilc1000_spi_driver = { module_spi_driver(wilc1000_spi_driver); MODULE_LICENSE("GPL"); -int wilc_spi_init(void) -{ - return 1; -} - int wilc_spi_tx(struct wilc *wilc, u8 *b, u32 len) { struct spi_device *spi = to_spi_device(wilc->dev); diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h b/drivers/staging/wilc1000/linux_wlan_spi.h index 5ff070b9ace5..d41c16a136b4 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.h +++ b/drivers/staging/wilc1000/linux_wlan_spi.h @@ -4,7 +4,6 @@ #include #include "wilc_wfi_netdevice.h" -int wilc_spi_init(void); int wilc_spi_tx(struct wilc *wilc, u8 *b, u32 len); int wilc_spi_rx(struct wilc *wilc, u8 *rb, u32 rlen); int wilc_spi_tx_rx(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen); diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index ce12d29bf41a..0f730cd7fcf3 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -676,7 +676,7 @@ static int _wilc_spi_deinit(struct wilc *wilc) return 1; } -static int _wilc_spi_init(struct wilc *wilc) +static int wilc_spi_init(struct wilc *wilc) { struct spi_device *spi = to_spi_device(wilc->dev); u32 reg; @@ -695,13 +695,6 @@ static int _wilc_spi_init(struct wilc *wilc) memset(&g_spi, 0, sizeof(wilc_spi_t)); - if (!wilc_spi_init()) { - dev_err(&spi->dev, "Failed io init bus...\n"); - return 0; - } else { - return 0; - } - /** * configure protocol **/ @@ -994,7 +987,7 @@ static int wilc_spi_sync_ext(struct wilc *wilc, int nint) * ********************************************/ const struct wilc_hif_func wilc_hif_spi = { - .hif_init = _wilc_spi_init, + .hif_init = wilc_spi_init, .hif_deinit = _wilc_spi_deinit, .hif_read_reg = wilc_spi_read_reg, .hif_write_reg = wilc_spi_write_reg, From 43a7622935c72a6724d62d7fb5da35fbe7328f0e Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:33 +0900 Subject: [PATCH 664/843] staging: wilc1000: linux_wlan_spi.c: move all the codes to wilc_spi.c This patch moves all the codes in linux_wlan_spi.c to wilc_spi.c to make one spi module. Make wilc_spi_tx, wilc_spi_rx and wilc_spi_tx_rx static functions. Remove function declaration in linux_wlan_spi.h, which is unnedded now. No modification has been made inside the codes. linux_wlan_spi.[ch] will be remove in the next patch. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan_spi.c | 165 -------------------- drivers/staging/wilc1000/linux_wlan_spi.h | 4 - drivers/staging/wilc1000/wilc_spi.c | 178 +++++++++++++++++++++- 3 files changed, 177 insertions(+), 170 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index 06935cfb3eff..c4315f558597 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -14,168 +14,3 @@ #include "wilc_wfi_netdevice.h" #include "linux_wlan_common.h" #include "wilc_wlan_if.h" - -#define USE_SPI_DMA 0 - -static const struct wilc1000_ops wilc1000_spi_ops; - -static int wilc_bus_probe(struct spi_device *spi) -{ - int ret, gpio; - struct wilc *wilc; - - gpio = of_get_gpio(spi->dev.of_node, 0); - if (gpio < 0) - gpio = GPIO_NUM; - - ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, GPIO_NUM, &wilc_hif_spi); - if (ret) - return ret; - - spi_set_drvdata(spi, wilc); - wilc->dev = &spi->dev; - - return 0; -} - -static int wilc_bus_remove(struct spi_device *spi) -{ - wilc_netdev_cleanup(spi_get_drvdata(spi)); - return 0; -} - -static const struct of_device_id wilc1000_of_match[] = { - { .compatible = "atmel,wilc_spi", }, - {} -}; -MODULE_DEVICE_TABLE(of, wilc1000_of_match); - -struct spi_driver wilc1000_spi_driver = { - .driver = { - .name = MODALIAS, - .of_match_table = wilc1000_of_match, - }, - .probe = wilc_bus_probe, - .remove = wilc_bus_remove, -}; -module_spi_driver(wilc1000_spi_driver); -MODULE_LICENSE("GPL"); - -int wilc_spi_tx(struct wilc *wilc, u8 *b, u32 len) -{ - struct spi_device *spi = to_spi_device(wilc->dev); - int ret; - struct spi_message msg; - - if (len > 0 && b) { - struct spi_transfer tr = { - .tx_buf = b, - .len = len, - .delay_usecs = 0, - }; - char *r_buffer = kzalloc(len, GFP_KERNEL); - - if (!r_buffer) - return -ENOMEM; - - tr.rx_buf = r_buffer; - dev_dbg(&spi->dev, "Request writing %d bytes\n", len); - - memset(&msg, 0, sizeof(msg)); - spi_message_init(&msg); - msg.spi = spi; - msg.is_dma_mapped = USE_SPI_DMA; - spi_message_add_tail(&tr, &msg); - - ret = spi_sync(spi, &msg); - if (ret < 0) - dev_err(&spi->dev, "SPI transaction failed\n"); - - kfree(r_buffer); - } else { - dev_err(&spi->dev, - "can't write data with the following length: %d\n", - len); - dev_err(&spi->dev, - "FAILED due to NULL buffer or ZERO length check the following length: %d\n", - len); - ret = -EINVAL; - } - - return ret; -} - -int wilc_spi_rx(struct wilc *wilc, u8 *rb, u32 rlen) -{ - struct spi_device *spi = to_spi_device(wilc->dev); - int ret; - - if (rlen > 0) { - struct spi_message msg; - struct spi_transfer tr = { - .rx_buf = rb, - .len = rlen, - .delay_usecs = 0, - - }; - char *t_buffer = kzalloc(rlen, GFP_KERNEL); - - if (!t_buffer) - return -ENOMEM; - - tr.tx_buf = t_buffer; - - memset(&msg, 0, sizeof(msg)); - spi_message_init(&msg); - msg.spi = spi; - msg.is_dma_mapped = USE_SPI_DMA; - spi_message_add_tail(&tr, &msg); - - ret = spi_sync(spi, &msg); - if (ret < 0) - dev_err(&spi->dev, "SPI transaction failed\n"); - kfree(t_buffer); - } else { - dev_err(&spi->dev, - "can't read data with the following length: %u\n", - rlen); - ret = -EINVAL; - } - - return ret; -} - -int wilc_spi_tx_rx(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen) -{ - struct spi_device *spi = to_spi_device(wilc->dev); - int ret; - - if (rlen > 0) { - struct spi_message msg; - struct spi_transfer tr = { - .rx_buf = rb, - .tx_buf = wb, - .len = rlen, - .bits_per_word = 8, - .delay_usecs = 0, - - }; - - memset(&msg, 0, sizeof(msg)); - spi_message_init(&msg); - msg.spi = spi; - msg.is_dma_mapped = USE_SPI_DMA; - - spi_message_add_tail(&tr, &msg); - ret = spi_sync(spi, &msg); - if (ret < 0) - dev_err(&spi->dev, "SPI transaction failed\n"); - } else { - dev_err(&spi->dev, - "can't read data with the following length: %u\n", - rlen); - ret = -EINVAL; - } - - return ret; -} diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h b/drivers/staging/wilc1000/linux_wlan_spi.h index d41c16a136b4..32e39267c4c3 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.h +++ b/drivers/staging/wilc1000/linux_wlan_spi.h @@ -3,8 +3,4 @@ #include #include "wilc_wfi_netdevice.h" - -int wilc_spi_tx(struct wilc *wilc, u8 *b, u32 len); -int wilc_spi_rx(struct wilc *wilc, u8 *rb, u32 rlen); -int wilc_spi_tx_rx(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen); #endif diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index 0f730cd7fcf3..86de50c9f7f5 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -6,11 +6,22 @@ /* */ /* */ /* //////////////////////////////////////////////////////////////////////////// */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "linux_wlan_common.h" #include #include "wilc_wlan_if.h" #include "wilc_wlan.h" -#include "linux_wlan_spi.h" #include "wilc_wfi_netdevice.h" typedef struct { @@ -107,6 +118,171 @@ static u8 crc7(u8 crc, const u8 *buffer, u32 len) #define DATA_PKT_SZ_8K (8 * 1024) #define DATA_PKT_SZ DATA_PKT_SZ_8K +#define USE_SPI_DMA 0 + +static const struct wilc1000_ops wilc1000_spi_ops; + +static int wilc_bus_probe(struct spi_device *spi) +{ + int ret, gpio; + struct wilc *wilc; + + gpio = of_get_gpio(spi->dev.of_node, 0); + if (gpio < 0) + gpio = GPIO_NUM; + + ret = wilc_netdev_init(&wilc, NULL, HIF_SPI, GPIO_NUM, &wilc_hif_spi); + if (ret) + return ret; + + spi_set_drvdata(spi, wilc); + wilc->dev = &spi->dev; + + return 0; +} + +static int wilc_bus_remove(struct spi_device *spi) +{ + wilc_netdev_cleanup(spi_get_drvdata(spi)); + return 0; +} + +static const struct of_device_id wilc1000_of_match[] = { + { .compatible = "atmel,wilc_spi", }, + {} +}; +MODULE_DEVICE_TABLE(of, wilc1000_of_match); + +struct spi_driver wilc1000_spi_driver = { + .driver = { + .name = MODALIAS, + .of_match_table = wilc1000_of_match, + }, + .probe = wilc_bus_probe, + .remove = wilc_bus_remove, +}; +module_spi_driver(wilc1000_spi_driver); +MODULE_LICENSE("GPL"); + +static int wilc_spi_tx(struct wilc *wilc, u8 *b, u32 len) +{ + struct spi_device *spi = to_spi_device(wilc->dev); + int ret; + struct spi_message msg; + + if (len > 0 && b) { + struct spi_transfer tr = { + .tx_buf = b, + .len = len, + .delay_usecs = 0, + }; + char *r_buffer = kzalloc(len, GFP_KERNEL); + + if (!r_buffer) + return -ENOMEM; + + tr.rx_buf = r_buffer; + dev_dbg(&spi->dev, "Request writing %d bytes\n", len); + + memset(&msg, 0, sizeof(msg)); + spi_message_init(&msg); + msg.spi = spi; + msg.is_dma_mapped = USE_SPI_DMA; + spi_message_add_tail(&tr, &msg); + + ret = spi_sync(spi, &msg); + if (ret < 0) + dev_err(&spi->dev, "SPI transaction failed\n"); + + kfree(r_buffer); + } else { + dev_err(&spi->dev, + "can't write data with the following length: %d\n", + len); + dev_err(&spi->dev, + "FAILED due to NULL buffer or ZERO length check the following length: %d\n", + len); + ret = -EINVAL; + } + + return ret; +} + +static int wilc_spi_rx(struct wilc *wilc, u8 *rb, u32 rlen) +{ + struct spi_device *spi = to_spi_device(wilc->dev); + int ret; + + if (rlen > 0) { + struct spi_message msg; + struct spi_transfer tr = { + .rx_buf = rb, + .len = rlen, + .delay_usecs = 0, + + }; + char *t_buffer = kzalloc(rlen, GFP_KERNEL); + + if (!t_buffer) + return -ENOMEM; + + tr.tx_buf = t_buffer; + + memset(&msg, 0, sizeof(msg)); + spi_message_init(&msg); + msg.spi = spi; + msg.is_dma_mapped = USE_SPI_DMA; + spi_message_add_tail(&tr, &msg); + + ret = spi_sync(spi, &msg); + if (ret < 0) + dev_err(&spi->dev, "SPI transaction failed\n"); + kfree(t_buffer); + } else { + dev_err(&spi->dev, + "can't read data with the following length: %u\n", + rlen); + ret = -EINVAL; + } + + return ret; +} + +static int wilc_spi_tx_rx(struct wilc *wilc, u8 *wb, u8 *rb, u32 rlen) +{ + struct spi_device *spi = to_spi_device(wilc->dev); + int ret; + + if (rlen > 0) { + struct spi_message msg; + struct spi_transfer tr = { + .rx_buf = rb, + .tx_buf = wb, + .len = rlen, + .bits_per_word = 8, + .delay_usecs = 0, + + }; + + memset(&msg, 0, sizeof(msg)); + spi_message_init(&msg); + msg.spi = spi; + msg.is_dma_mapped = USE_SPI_DMA; + + spi_message_add_tail(&tr, &msg); + ret = spi_sync(spi, &msg); + if (ret < 0) + dev_err(&spi->dev, "SPI transaction failed\n"); + } else { + dev_err(&spi->dev, + "can't read data with the following length: %u\n", + rlen); + ret = -EINVAL; + } + + return ret; +} + static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, u8 clockless) { From 523fc23f1179606492aa8f0252ef7f631f27346f Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:34 +0900 Subject: [PATCH 665/843] staging: wilc1000: remove unused files This patch removes linux_wlan_spi.[ch] which are not used anymore. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/Makefile | 2 +- drivers/staging/wilc1000/linux_wlan_spi.c | 16 ---------------- drivers/staging/wilc1000/linux_wlan_spi.h | 6 ------ 3 files changed, 1 insertion(+), 23 deletions(-) delete mode 100644 drivers/staging/wilc1000/linux_wlan_spi.c delete mode 100644 drivers/staging/wilc1000/linux_wlan_spi.h diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile index 09f0ddbb6774..20a5cb9d4f4c 100644 --- a/drivers/staging/wilc1000/Makefile +++ b/drivers/staging/wilc1000/Makefile @@ -17,4 +17,4 @@ obj-$(CONFIG_WILC1000_SDIO) += wilc1000-sdio.o wilc1000-sdio-objs += wilc_sdio.o obj-$(CONFIG_WILC1000_SPI) += wilc1000-spi.o -wilc1000-spi-objs += linux_wlan_spi.o wilc_spi.o +wilc1000-spi-objs += wilc_spi.o diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c deleted file mode 100644 index c4315f558597..000000000000 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "linux_wlan_spi.h" -#include "wilc_wfi_netdevice.h" -#include "linux_wlan_common.h" -#include "wilc_wlan_if.h" diff --git a/drivers/staging/wilc1000/linux_wlan_spi.h b/drivers/staging/wilc1000/linux_wlan_spi.h deleted file mode 100644 index 32e39267c4c3..000000000000 --- a/drivers/staging/wilc1000/linux_wlan_spi.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef LINUX_WLAN_SPI_H -#define LINUX_WLAN_SPI_H - -#include -#include "wilc_wfi_netdevice.h" -#endif From 320edd03fb7549f3908b37b1c91dae32f5132305 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:35 +0900 Subject: [PATCH 666/843] staging: wilc1000: remove unneeded extern variable This patch removes unnedded extern variable WILC_WFI_devs[] which is not used. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 68a159f36f14..b9961f079e27 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -227,7 +227,6 @@ struct WILC_WFI_mon_priv { int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic); -extern struct net_device *WILC_WFI_devs[]; void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset); void wilc_mac_indicate(struct wilc *wilc, int flag); void wilc_rx_complete(struct wilc *wilc); From a4cac4810104b010572ebcb7de419effef3ff33b Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:36 +0900 Subject: [PATCH 667/843] staging: wilc1000: move perInterface_wlan_t to wilc_vif perInterface_wlan_t and wilc_vif are all about interface control informations. We will combine those two structures and maintain as one network interface control information. Move all the members of perInterface_wlan_t to wilc_vif and remove the structure. Rename perInterace_wlan_t to wilc_vif and rename variable name nic to vif which is proper name for it. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 6 +- drivers/staging/wilc1000/linux_wlan.c | 251 +++++++++--------- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 148 +++++------ drivers/staging/wilc1000/wilc_wfi_netdevice.h | 21 +- drivers/staging/wilc1000/wilc_wlan.c | 60 ++--- 5 files changed, 241 insertions(+), 245 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index c8b4d86dc7b7..23bd8d306c8b 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3779,11 +3779,11 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) s32 result = 0; struct host_if_drv *hif_drv; int err; - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wilc; - nic = netdev_priv(dev); - wilc = nic->wilc; + vif = netdev_priv(dev); + wilc = vif->wilc; PRINT_D(HOSTINF_DBG, "Initializing host interface for client %d\n", clients_count + 1); diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 92ca0723c8b6..263d9d84c8cf 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -64,7 +64,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event struct host_if_drv *hif_drv; struct net_device *dev; u8 *ip_addr_buf; - perInterface_wlan_t *nic; + struct wilc_vif *vif; u8 null_ip[4] = {0}; char wlan_dev_name[5] = "wlan0"; @@ -90,8 +90,8 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event return NOTIFY_DONE; } hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv; - nic = netdev_priv(dev); - if (!nic || !hif_drv) { + vif = netdev_priv(dev); + if (!vif || !hif_drv) { PRINT_D(GENERIC_DBG, "No Wireless Priv\n"); return NOTIFY_DONE; } @@ -104,7 +104,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event PRINT_INFO(GENERIC_DBG, "\n ============== IP Address Obtained ===============\n\n"); - if (nic->iftype == STATION_MODE || nic->iftype == CLIENT_MODE) { + if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) { hif_drv->IFC_UP = 1; wilc_optaining_ip = false; del_timer(&wilc_during_ip_timer); @@ -120,7 +120,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n", ip_addr_buf[0], ip_addr_buf[1], ip_addr_buf[2], ip_addr_buf[3]); - wilc_setup_ipaddress(hif_drv, ip_addr_buf, nic->u8IfIdx); + wilc_setup_ipaddress(hif_drv, ip_addr_buf, vif->u8IfIdx); break; @@ -128,7 +128,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event PRINT_D(GENERIC_DBG, "dev_state_ev_handler event=NETDEV_DOWN %p\n", dev); PRINT_INFO(GENERIC_DBG, "\n ============== IP Address Released ===============\n\n"); - if (nic->iftype == STATION_MODE || nic->iftype == CLIENT_MODE) { + if (vif->iftype == STATION_MODE || vif->iftype == CLIENT_MODE) { hif_drv->IFC_UP = 0; wilc_optaining_ip = false; } @@ -145,7 +145,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event ip_addr_buf[0], ip_addr_buf[1], ip_addr_buf[2], ip_addr_buf[3]); - wilc_setup_ipaddress(hif_drv, ip_addr_buf, nic->u8IfIdx); + wilc_setup_ipaddress(hif_drv, ip_addr_buf, vif->u8IfIdx); break; @@ -161,12 +161,12 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event static irqreturn_t isr_uh_routine(int irq, void *user_data) { - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wilc; struct net_device *dev = (struct net_device *)user_data; - nic = netdev_priv(dev); - wilc = nic->wilc; + vif = netdev_priv(dev); + wilc = vif->wilc; PRINT_D(INT_DBG, "Interrupt received UH\n"); if (wilc->close) { @@ -178,11 +178,11 @@ static irqreturn_t isr_uh_routine(int irq, void *user_data) static irqreturn_t isr_bh_routine(int irq, void *userdata) { - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wilc; - nic = netdev_priv(userdata); - wilc = nic->wilc; + vif = netdev_priv(userdata); + wilc = vif->wilc; if (wilc->close) { PRINT_ER("Driver is CLOSING: Can't handle BH interrupt\n"); @@ -198,11 +198,11 @@ static irqreturn_t isr_bh_routine(int irq, void *userdata) static int init_irq(struct net_device *dev) { int ret = 0; - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wl; - nic = netdev_priv(dev); - wl = nic->wilc; + vif = netdev_priv(dev); + wl = vif->wilc; if ((gpio_request(wl->gpio, "WILC_INTR") == 0) && (gpio_direction_input(wl->gpio) == 0)) { @@ -230,11 +230,11 @@ static int init_irq(struct net_device *dev) static void deinit_irq(struct net_device *dev) { - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wilc; - nic = netdev_priv(dev); - wilc = nic->wilc; + vif = netdev_priv(dev); + wilc = vif->wilc; /* Deintialize IRQ */ if (wilc->dev_irq_num) { @@ -311,11 +311,11 @@ int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid) { int i = 0; int ret = -1; - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wilc; - nic = netdev_priv(wilc_netdev); - wilc = nic->wilc; + vif = netdev_priv(wilc_netdev); + wilc = vif->wilc; for (i = 0; i < wilc->vif_num; i++) if (wilc->vif[i].ndev == wilc_netdev) { @@ -345,7 +345,7 @@ int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc) static int linux_wlan_txq_task(void *vp) { int ret, txq_count; - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wl; struct net_device *dev = vp; #if defined USE_TX_BACKOFF_DELAY_IF_NO_BUFFERS @@ -357,8 +357,8 @@ static int linux_wlan_txq_task(void *vp) int backoff_weight = TX_BACKOFF_WEIGHT_MIN; #endif - nic = netdev_priv(dev); - wl = nic->wilc; + vif = netdev_priv(dev); + wl = vif->wilc; up(&wl->txq_thread_started); while (1) { @@ -417,31 +417,31 @@ void wilc_rx_complete(struct wilc *nic) int wilc_wlan_get_firmware(struct net_device *dev) { - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wilc; int ret = 0; const struct firmware *wilc_firmware; char *firmware; - nic = netdev_priv(dev); - wilc = nic->wilc; + vif = netdev_priv(dev); + wilc = vif->wilc; - if (nic->iftype == AP_MODE) { + if (vif->iftype == AP_MODE) { firmware = AP_FIRMWARE; - } else if (nic->iftype == STATION_MODE) { + } else if (vif->iftype == STATION_MODE) { firmware = STA_FIRMWARE; } else { PRINT_D(INIT_DBG, "Get P2P_CONCURRENCY_FIRMWARE\n"); firmware = P2P_CONCURRENCY_FIRMWARE; } - if (!nic) { - PRINT_ER("NIC is NULL\n"); + if (!vif) { + PRINT_ER("vif is NULL\n"); goto _fail_; } - if (!(&nic->wilc_netdev->dev)) { - PRINT_ER("&nic->wilc_netdev->dev is NULL\n"); + if (!(&vif->wilc_netdev->dev)) { + PRINT_ER("&vif->wilc_netdev->dev is NULL\n"); goto _fail_; } @@ -459,12 +459,12 @@ _fail_: static int linux_wlan_start_firmware(struct net_device *dev) { - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wilc; int ret = 0; - nic = netdev_priv(dev); - wilc = nic->wilc; + vif = netdev_priv(dev); + wilc = vif->wilc; PRINT_D(INIT_DBG, "Starting Firmware ...\n"); ret = wilc_wlan_start(wilc); @@ -486,12 +486,12 @@ static int linux_wlan_start_firmware(struct net_device *dev) static int wilc1000_firmware_download(struct net_device *dev) { - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wilc; int ret = 0; - nic = netdev_priv(dev); - wilc = nic->wilc; + vif = netdev_priv(dev); + wilc = vif->wilc; if (!wilc->firmware) { PRINT_ER("Firmware buffer is NULL\n"); @@ -734,11 +734,11 @@ _fail_: void wilc1000_wlan_deinit(struct net_device *dev) { - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wl; - nic = netdev_priv(dev); - wl = nic->wilc; + vif = netdev_priv(dev); + wl = vif->wilc; if (!wl) { netdev_err(dev, "wl is NULL\n"); @@ -794,11 +794,11 @@ void wilc1000_wlan_deinit(struct net_device *dev) static int wlan_init_locks(struct net_device *dev) { - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wl; - nic = netdev_priv(dev); - wl = nic->wilc; + vif = netdev_priv(dev); + wl = vif->wilc; PRINT_D(INIT_DBG, "Initializing Locks ...\n"); @@ -820,11 +820,11 @@ static int wlan_init_locks(struct net_device *dev) static int wlan_deinit_locks(struct net_device *dev) { - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wilc; - nic = netdev_priv(dev); - wilc = nic->wilc; + vif = netdev_priv(dev); + wilc = vif->wilc; PRINT_D(INIT_DBG, "De-Initializing Locks\n"); @@ -839,11 +839,11 @@ static int wlan_deinit_locks(struct net_device *dev) static int wlan_initialize_threads(struct net_device *dev) { - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wilc; - nic = netdev_priv(dev); - wilc = nic->wilc; + vif = netdev_priv(dev); + wilc = vif->wilc; PRINT_D(INIT_DBG, "Initializing Threads ...\n"); PRINT_D(INIT_DBG, "Creating kthread for transmission\n"); @@ -861,10 +861,10 @@ static int wlan_initialize_threads(struct net_device *dev) static void wlan_deinitialize_threads(struct net_device *dev) { - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wl; - nic = netdev_priv(dev); - wl = nic->wilc; + vif = netdev_priv(dev); + wl = vif->wilc; wl->close = 1; PRINT_D(INIT_DBG, "Deinitializing Threads\n"); @@ -878,11 +878,10 @@ static void wlan_deinitialize_threads(struct net_device *dev) } } -int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) +int wilc1000_wlan_init(struct net_device *dev, struct wilc_vif *vif) { - perInterface_wlan_t *nic = p_nic; int ret = 0; - struct wilc *wl = nic->wilc; + struct wilc *wl = vif->wilc; if (!wl->initialized) { wl->mac_status = WILC_MAC_STATUS_INIT; @@ -992,7 +991,7 @@ static int mac_init_fn(struct net_device *ndev) int wilc_mac_open(struct net_device *ndev) { - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wilc; unsigned char mac_add[ETH_ALEN] = {0}; @@ -1001,17 +1000,17 @@ int wilc_mac_open(struct net_device *ndev) struct wilc_priv *priv; struct wilc *wl; - nic = netdev_priv(ndev); - wl = nic->wilc; + vif = netdev_priv(ndev); + wl = vif->wilc; if (!wl|| !wl->dev) { netdev_err(ndev, "wilc1000: SPI device not ready\n"); return -ENODEV; } - nic = netdev_priv(ndev); - wilc = nic->wilc; - priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy); + vif = netdev_priv(ndev); + wilc = vif->wilc; + priv = wiphy_priv(vif->wilc_netdev->ieee80211_ptr->wiphy); PRINT_D(INIT_DBG, "MAC OPEN[%p]\n", ndev); ret = wilc_init_host_int(ndev); @@ -1022,7 +1021,7 @@ int wilc_mac_open(struct net_device *ndev) } PRINT_D(INIT_DBG, "*** re-init ***\n"); - ret = wilc1000_wlan_init(ndev, nic); + ret = wilc1000_wlan_init(ndev, vif); if (ret < 0) { PRINT_ER("Failed to initialize wilc1000\n"); wilc_deinit_host_int(ndev); @@ -1051,25 +1050,25 @@ int wilc_mac_open(struct net_device *ndev) return -EINVAL; } - wilc_mgmt_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy, - nic->wilc_netdev->ieee80211_ptr, - nic->g_struct_frame_reg[0].frame_type, - nic->g_struct_frame_reg[0].reg); - wilc_mgmt_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy, - nic->wilc_netdev->ieee80211_ptr, - nic->g_struct_frame_reg[1].frame_type, - nic->g_struct_frame_reg[1].reg); + wilc_mgmt_frame_register(vif->wilc_netdev->ieee80211_ptr->wiphy, + vif->wilc_netdev->ieee80211_ptr, + vif->g_struct_frame_reg[0].frame_type, + vif->g_struct_frame_reg[0].reg); + wilc_mgmt_frame_register(vif->wilc_netdev->ieee80211_ptr->wiphy, + vif->wilc_netdev->ieee80211_ptr, + vif->g_struct_frame_reg[1].frame_type, + vif->g_struct_frame_reg[1].reg); netif_wake_queue(ndev); wl->open_ifcs++; - nic->mac_opened = 1; + vif->mac_opened = 1; return 0; } static struct net_device_stats *mac_stats(struct net_device *dev) { - perInterface_wlan_t *nic = netdev_priv(dev); + struct wilc_vif *vif= netdev_priv(dev); - return &nic->netstats; + return &vif->netstats; } static void wilc_set_multicast_list(struct net_device *dev) @@ -1137,7 +1136,7 @@ static void linux_wlan_tx_complete(void *priv, int status) int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev) { - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct tx_complete_data *tx_data = NULL; int queue_count; char *udp_buf; @@ -1145,8 +1144,8 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev) struct ethhdr *eth_h; struct wilc *wilc; - nic = netdev_priv(ndev); - wilc = nic->wilc; + vif = netdev_priv(ndev); + wilc = vif->wilc; PRINT_D(TX_DBG, "Sending packet just received from TCP/IP\n"); @@ -1181,9 +1180,9 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev) PRINT_D(TX_DBG, "Sending packet - Size = %d - Address = %p - SKB = %p\n", tx_data->size, tx_data->buff, tx_data->skb); PRINT_D(TX_DBG, "Adding tx packet to TX Queue\n"); - nic->netstats.tx_packets++; - nic->netstats.tx_bytes += tx_data->size; - tx_data->pBssid = wilc->vif[nic->u8IfIdx].bssid; + vif->netstats.tx_packets++; + vif->netstats.tx_bytes += tx_data->size; + tx_data->pBssid = wilc->vif[vif->u8IfIdx].bssid; queue_count = wilc_wlan_txq_add_net_pkt(ndev, (void *)tx_data, tx_data->buff, tx_data->size, linux_wlan_tx_complete); @@ -1199,20 +1198,20 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev) int wilc_mac_close(struct net_device *ndev) { struct wilc_priv *priv; - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct host_if_drv *hif_drv; struct wilc *wl; - nic = netdev_priv(ndev); + vif = netdev_priv(ndev); - if (!nic || !nic->wilc_netdev || !nic->wilc_netdev->ieee80211_ptr || - !nic->wilc_netdev->ieee80211_ptr->wiphy) { - PRINT_ER("nic = NULL\n"); + if (!vif || !vif->wilc_netdev || !vif->wilc_netdev->ieee80211_ptr || + !vif->wilc_netdev->ieee80211_ptr->wiphy) { + PRINT_ER("vif = NULL\n"); return 0; } - priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy); - wl = nic->wilc; + priv = wiphy_priv(vif->wilc_netdev->ieee80211_ptr->wiphy); + wl = vif->wilc; if (!priv) { PRINT_ER("priv = NULL\n"); @@ -1240,10 +1239,10 @@ int wilc_mac_close(struct net_device *ndev) return 0; } - if (nic->wilc_netdev) { - netif_stop_queue(nic->wilc_netdev); + if (vif->wilc_netdev) { + netif_stop_queue(vif->wilc_netdev); - wilc_deinit_host_int(nic->wilc_netdev); + wilc_deinit_host_int(vif->wilc_netdev); } if (wl->open_ifcs == 0) { @@ -1254,7 +1253,7 @@ int wilc_mac_close(struct net_device *ndev) } up(&close_exit_sync); - nic->mac_opened = 0; + vif->mac_opened = 0; return 0; } @@ -1264,13 +1263,13 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) u8 *buff = NULL; s8 rssi; u32 size = 0, length = 0; - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc_priv *priv; s32 ret = 0; struct wilc *wilc; - nic = netdev_priv(ndev); - wilc = nic->wilc; + vif = netdev_priv(ndev); + wilc = vif->wilc; if (!wilc->initialized) return 0; @@ -1289,7 +1288,7 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) return PTR_ERR(buff); if (strncasecmp(buff, "RSSI", length) == 0) { - priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy); + priv = wiphy_priv(vif->wilc_netdev->ieee80211_ptr->wiphy); ret = wilc_get_rssi(priv->hWILCWFIDrv, &rssi); if (ret) PRINT_ER("Failed to send get rssi param's message queue "); @@ -1331,14 +1330,14 @@ void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset) unsigned char *buff_to_send = NULL; struct sk_buff *skb; struct net_device *wilc_netdev; - perInterface_wlan_t *nic; + struct wilc_vif *vif; wilc_netdev = get_if_handler(wilc, buff); if (!wilc_netdev) return; buff += pkt_offset; - nic = netdev_priv(wilc_netdev); + vif = netdev_priv(wilc_netdev); if (size > 0) { frame_len = size; @@ -1360,8 +1359,8 @@ void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset) memcpy(skb_put(skb, frame_len), buff_to_send, frame_len); skb->protocol = eth_type_trans(skb, wilc_netdev); - nic->netstats.rx_packets++; - nic->netstats.rx_bytes += frame_len; + vif->netstats.rx_packets++; + vif->netstats.rx_bytes += frame_len; skb->ip_summed = CHECKSUM_UNNECESSARY; stats = netif_rx(skb); PRINT_D(RX_DBG, "netif_rx ret value is: %d\n", stats); @@ -1371,32 +1370,32 @@ void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset) void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size) { int i = 0; - perInterface_wlan_t *nic; + struct wilc_vif *vif; for (i = 0; i < wilc->vif_num; i++) { - nic = netdev_priv(wilc->vif[i].ndev); - if (nic->monitor_flag) { + vif = netdev_priv(wilc->vif[i].ndev); + if (vif->monitor_flag) { WILC_WFI_monitor_rx(buff, size); return; } } - nic = netdev_priv(wilc->vif[1].ndev); - if ((buff[0] == nic->g_struct_frame_reg[0].frame_type && nic->g_struct_frame_reg[0].reg) || - (buff[0] == nic->g_struct_frame_reg[1].frame_type && nic->g_struct_frame_reg[1].reg)) + vif = netdev_priv(wilc->vif[1].ndev); + if ((buff[0] == vif->g_struct_frame_reg[0].frame_type && vif->g_struct_frame_reg[0].reg) || + (buff[0] == vif->g_struct_frame_reg[1].frame_type && vif->g_struct_frame_reg[1].reg)) WILC_WFI_p2p_rx(wilc->vif[1].ndev, buff, size); } void wilc_netdev_cleanup(struct wilc *wilc) { int i = 0; - perInterface_wlan_t *nic[NUM_CONCURRENT_IFC]; + struct wilc_vif *vif[NUM_CONCURRENT_IFC]; if (wilc && (wilc->vif[0].ndev || wilc->vif[1].ndev)) { unregister_inetaddr_notifier(&g_dev_notifier); for (i = 0; i < NUM_CONCURRENT_IFC; i++) - nic[i] = netdev_priv(wilc->vif[i].ndev); + vif[i] = netdev_priv(wilc->vif[i].ndev); } if (wilc && wilc->firmware) @@ -1407,7 +1406,7 @@ void wilc_netdev_cleanup(struct wilc *wilc) for (i = 0; i < NUM_CONCURRENT_IFC; i++) if (wilc->vif[i].ndev) - if (nic[i]->mac_opened) + if (vif[i]->mac_opened) wilc_mac_close(wilc->vif[i].ndev); for (i = 0; i < NUM_CONCURRENT_IFC; i++) { @@ -1425,7 +1424,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, int gpio, const struct wilc_hif_func *ops) { int i; - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct net_device *ndev; struct wilc *wl; @@ -1443,23 +1442,23 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, register_inetaddr_notifier(&g_dev_notifier); for (i = 0; i < NUM_CONCURRENT_IFC; i++) { - ndev = alloc_etherdev(sizeof(perInterface_wlan_t)); + ndev = alloc_etherdev(sizeof(struct wilc_vif)); if (!ndev) { PRINT_ER("Failed to allocate ethernet dev\n"); return -1; } - nic = netdev_priv(ndev); - memset(nic, 0, sizeof(perInterface_wlan_t)); + vif = netdev_priv(ndev); + memset(vif, 0, sizeof(struct wilc_vif)); if (i == 0) strcpy(ndev->name, "wlan%d"); else strcpy(ndev->name, "p2p%d"); - nic->u8IfIdx = wl->vif_num; - nic->wilc_netdev = ndev; - nic->wilc = *wilc; + vif->u8IfIdx = wl->vif_num; + vif->wilc_netdev = ndev; + vif->wilc = *wilc; wl->vif[wl->vif_num].ndev = ndev; wl->vif_num++; ndev->netdev_ops = &wilc_netdev_ops; @@ -1476,13 +1475,13 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, return -1; } - nic->wilc_netdev->ieee80211_ptr = wdev; - nic->wilc_netdev->ml_priv = nic; - wdev->netdev = nic->wilc_netdev; - nic->netstats.rx_packets = 0; - nic->netstats.tx_packets = 0; - nic->netstats.rx_bytes = 0; - nic->netstats.tx_bytes = 0; + vif->wilc_netdev->ieee80211_ptr = wdev; + vif->wilc_netdev->ml_priv = vif; + wdev->netdev = vif->wilc_netdev; + vif->netstats.rx_packets = 0; + vif->netstats.tx_packets = 0; + vif->netstats.rx_bytes = 0; + vif->netstats.tx_bytes = 0; } if (register_netdev(ndev)) { @@ -1491,8 +1490,8 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, return -1; } - nic->iftype = STATION_MODE; - nic->mac_opened = 0; + vif->iftype = STATION_MODE; + vif->mac_opened = 0; } return 0; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index bdc4537d8760..8ec12f8ea81d 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -500,14 +500,14 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, struct host_if_drv *pstrWFIDrv; u8 NullBssid[ETH_ALEN] = {0}; struct wilc *wl; - perInterface_wlan_t *nic; + struct wilc_vif *vif; wilc_connecting = 0; priv = (struct wilc_priv *)pUserVoid; dev = priv->dev; - nic = netdev_priv(dev); - wl = nic->wilc; + vif = netdev_priv(dev); + wl = vif->wilc; pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv; if (enuConnDisconnEvent == CONN_DISCONN_EVENT_CONN_RESP) { @@ -952,11 +952,11 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, u8 u8pmode = NO_ENCRYPT; enum AUTHTYPE tenuAuth_type = ANY; struct wilc *wl; - perInterface_wlan_t *nic; + struct wilc_vif *vif; priv = wiphy_priv(wiphy); - nic = netdev_priv(netdev); - wl = nic->wilc; + vif = netdev_priv(netdev); + wl = vif->wilc; PRINT_D(CFG80211_DBG, "Adding key with cipher suite = %x\n", params->cipher); @@ -1203,11 +1203,11 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev, { struct wilc_priv *priv; struct wilc *wl; - perInterface_wlan_t *nic; + struct wilc_vif *vif; priv = wiphy_priv(wiphy); - nic = netdev_priv(netdev); - wl = nic->wilc; + vif = netdev_priv(netdev); + wl = vif->wilc; if (netdev == wl->vif[0].ndev) { g_ptk_keys_saved = false; @@ -1322,14 +1322,14 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, const u8 *mac, struct station_info *sinfo) { struct wilc_priv *priv; - perInterface_wlan_t *nic; + struct wilc_vif *vif; u32 i = 0; u32 associatedsta = 0; u32 inactive_time = 0; priv = wiphy_priv(wiphy); - nic = netdev_priv(dev); + vif = netdev_priv(dev); - if (nic->iftype == AP_MODE || nic->iftype == GO_MODE) { + if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) { PRINT_D(HOSTAPD_DBG, "Getting station parameters\n"); PRINT_INFO(HOSTAPD_DBG, ": %x%x%x%x%x\n", mac[0], mac[1], mac[2], mac[3], mac[4]); @@ -1353,7 +1353,7 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, PRINT_D(CFG80211_DBG, "Inactive time %d\n", sinfo->inactive_time); } - if (nic->iftype == STATION_MODE) { + if (vif->iftype == STATION_MODE) { struct rf_info strStatistics; wilc_get_statistics(priv->hWILCWFIDrv, &strStatistics); @@ -1816,10 +1816,10 @@ static int mgmt_tx(struct wiphy *wiphy, struct wilc_priv *priv; struct host_if_drv *pstrWFIDrv; u32 i; - perInterface_wlan_t *nic; + struct wilc_vif *vif; u32 buf_len = len + sizeof(p2p_vendor_spec) + sizeof(p2p_local_random); - nic = netdev_priv(wdev->netdev); + vif = netdev_priv(wdev->netdev); priv = wiphy_priv(wiphy); pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv; @@ -1890,9 +1890,9 @@ static int mgmt_tx(struct wiphy *wiphy, for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < len; i++) { if (buf[i] == P2PELEM_ATTR_ID && !(memcmp(p2p_oui, &buf[i + 2], 4))) { if (buf[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_RSP) - WILC_WFI_CfgParseTxAction(&mgmt_tx->buff[i + 6], len - (i + 6), true, nic->iftype); + WILC_WFI_CfgParseTxAction(&mgmt_tx->buff[i + 6], len - (i + 6), true, vif->iftype); else - WILC_WFI_CfgParseTxAction(&mgmt_tx->buff[i + 6], len - (i + 6), false, nic->iftype); + WILC_WFI_CfgParseTxAction(&mgmt_tx->buff[i + 6], len - (i + 6), false, vif->iftype); break; } } @@ -1966,12 +1966,12 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev, u16 frame_type, bool reg) { struct wilc_priv *priv; - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wl; priv = wiphy_priv(wiphy); - nic = netdev_priv(priv->wdev->netdev); - wl = nic->wilc; + vif = netdev_priv(priv->wdev->netdev); + wl = vif->wilc; if (!frame_type) return; @@ -1980,15 +1980,15 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev, switch (frame_type) { case PROBE_REQ: { - nic->g_struct_frame_reg[0].frame_type = frame_type; - nic->g_struct_frame_reg[0].reg = reg; + vif->g_struct_frame_reg[0].frame_type = frame_type; + vif->g_struct_frame_reg[0].reg = reg; } break; case ACTION: { - nic->g_struct_frame_reg[1].frame_type = frame_type; - nic->g_struct_frame_reg[1].reg = reg; + vif->g_struct_frame_reg[1].frame_type = frame_type; + vif->g_struct_frame_reg[1].reg = reg; } break; @@ -2058,15 +2058,15 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, enum nl80211_iftype type, u32 *flags, struct vif_params *params) { struct wilc_priv *priv; - perInterface_wlan_t *nic; + struct wilc_vif *vif; u8 interface_type; u16 TID = 0; u8 i; struct wilc *wl; - nic = netdev_priv(dev); + vif = netdev_priv(dev); priv = wiphy_priv(wiphy); - wl = nic->wilc; + wl = vif->wilc; PRINT_D(HOSTAPD_DBG, "In Change virtual interface function\n"); PRINT_D(HOSTAPD_DBG, "Wireless interface name =%s\n", dev->name); @@ -2088,12 +2088,12 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, dev->ieee80211_ptr->iftype = type; priv->wdev->iftype = type; - nic->monitor_flag = 0; - nic->iftype = STATION_MODE; + vif->monitor_flag = 0; + vif->iftype = STATION_MODE; memset(priv->assoc_stainfo.au8Sta_AssociatedBss, 0, MAX_NUM_STA * ETH_ALEN); - interface_type = nic->iftype; - nic->iftype = STATION_MODE; + interface_type = vif->iftype; + vif->iftype = STATION_MODE; if (wl->initialized) { wilc_del_all_rx_ba_session(priv->hWILCWFIDrv, @@ -2103,9 +2103,9 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, up(&wl->cfg_event); wilc1000_wlan_deinit(dev); - wilc1000_wlan_init(dev, nic); + wilc1000_wlan_init(dev, vif); wilc_initialized = 1; - nic->iftype = interface_type; + vif->iftype = interface_type; wilc_set_wfi_drv_handler(wl->vif[0].hif_drv); wilc_set_mac_address(wl->vif[0].hif_drv, @@ -2147,11 +2147,11 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, if (wl->initialized) { for (i = 0; i < num_reg_frame; i++) { - PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type, - nic->g_struct_frame_reg[i].reg); + PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type, + vif->g_struct_frame_reg[i].reg); wilc_frame_register(priv->hWILCWFIDrv, - nic->g_struct_frame_reg[i].frame_type, - nic->g_struct_frame_reg[i].reg); + vif->g_struct_frame_reg[i].frame_type, + vif->g_struct_frame_reg[i].reg); } } @@ -2171,17 +2171,17 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, dev->ieee80211_ptr->iftype = type; priv->wdev->iftype = type; - nic->monitor_flag = 0; + vif->monitor_flag = 0; PRINT_D(HOSTAPD_DBG, "Downloading P2P_CONCURRENCY_FIRMWARE\n"); - nic->iftype = CLIENT_MODE; + vif->iftype = CLIENT_MODE; if (wl->initialized) { wilc_wait_msg_queue_idle(); wilc1000_wlan_deinit(dev); - wilc1000_wlan_init(dev, nic); + wilc1000_wlan_init(dev, vif); wilc_initialized = 1; wilc_set_wfi_drv_handler(wl->vif[0].hif_drv); @@ -2227,11 +2227,11 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, if (wl->initialized) { for (i = 0; i < num_reg_frame; i++) { - PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type, - nic->g_struct_frame_reg[i].reg); + PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type, + vif->g_struct_frame_reg[i].reg); wilc_frame_register(priv->hWILCWFIDrv, - nic->g_struct_frame_reg[i].frame_type, - nic->g_struct_frame_reg[i].reg); + vif->g_struct_frame_reg[i].frame_type, + vif->g_struct_frame_reg[i].reg); } } } @@ -2242,23 +2242,23 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_AP %d\n", type); dev->ieee80211_ptr->iftype = type; priv->wdev->iftype = type; - nic->iftype = AP_MODE; + vif->iftype = AP_MODE; PRINT_D(CORECONFIG_DBG, "priv->hWILCWFIDrv[%p]\n", priv->hWILCWFIDrv); PRINT_D(HOSTAPD_DBG, "Downloading AP firmware\n"); wilc_wlan_get_firmware(dev); if (wl->initialized) { - nic->iftype = AP_MODE; + vif->iftype = AP_MODE; wilc_mac_close(dev); wilc_mac_open(dev); for (i = 0; i < num_reg_frame; i++) { - PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type, - nic->g_struct_frame_reg[i].reg); + PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type, + vif->g_struct_frame_reg[i].reg); wilc_frame_register(priv->hWILCWFIDrv, - nic->g_struct_frame_reg[i].frame_type, - nic->g_struct_frame_reg[i].reg); + vif->g_struct_frame_reg[i].frame_type, + vif->g_struct_frame_reg[i].reg); } } break; @@ -2282,11 +2282,11 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, PRINT_D(HOSTAPD_DBG, "Downloading P2P_CONCURRENCY_FIRMWARE\n"); - nic->iftype = GO_MODE; + vif->iftype = GO_MODE; wilc_wait_msg_queue_idle(); wilc1000_wlan_deinit(dev); - wilc1000_wlan_init(dev, nic); + wilc1000_wlan_init(dev, vif); wilc_initialized = 1; wilc_set_wfi_drv_handler(wl->vif[0].hif_drv); @@ -2331,11 +2331,11 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, if (wl->initialized) { for (i = 0; i < num_reg_frame; i++) { - PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", nic->g_struct_frame_reg[i].frame_type, - nic->g_struct_frame_reg[i].reg); + PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type, + vif->g_struct_frame_reg[i].reg); wilc_frame_register(priv->hWILCWFIDrv, - nic->g_struct_frame_reg[i].frame_type, - nic->g_struct_frame_reg[i].reg); + vif->g_struct_frame_reg[i].frame_type, + vif->g_struct_frame_reg[i].reg); } } break; @@ -2355,11 +2355,11 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev, struct wilc_priv *priv; s32 s32Error = 0; struct wilc *wl; - perInterface_wlan_t *nic; + struct wilc_vif *vif; priv = wiphy_priv(wiphy); - nic = netdev_priv(dev); - wl = nic->wilc; + vif = netdev_priv(dev); + wl = vif ->wilc; PRINT_D(HOSTAPD_DBG, "Starting ap\n"); PRINT_D(HOSTAPD_DBG, "Interval = %d\n DTIM period = %d\n Head length = %zu Tail length = %zu\n", @@ -2429,15 +2429,15 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, s32 s32Error = 0; struct wilc_priv *priv; struct add_sta_param strStaParams = { {0} }; - perInterface_wlan_t *nic; + struct wilc_vif *vif; if (!wiphy) return -EFAULT; priv = wiphy_priv(wiphy); - nic = netdev_priv(dev); + vif = netdev_priv(dev); - if (nic->iftype == AP_MODE || nic->iftype == GO_MODE) { + if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) { memcpy(strStaParams.bssid, mac, ETH_ALEN); memcpy(priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid], mac, ETH_ALEN); strStaParams.aid = params->aid; @@ -2500,15 +2500,15 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev, const u8 *mac = params->mac; s32 s32Error = 0; struct wilc_priv *priv; - perInterface_wlan_t *nic; + struct wilc_vif *vif; if (!wiphy) return -EFAULT; priv = wiphy_priv(wiphy); - nic = netdev_priv(dev); + vif = netdev_priv(dev); - if (nic->iftype == AP_MODE || nic->iftype == GO_MODE) { + if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) { PRINT_D(HOSTAPD_DBG, "Deleting station\n"); @@ -2533,7 +2533,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, s32 s32Error = 0; struct wilc_priv *priv; struct add_sta_param strStaParams = { {0} }; - perInterface_wlan_t *nic; + struct wilc_vif *vif; PRINT_D(HOSTAPD_DBG, "Change station paramters\n"); @@ -2542,9 +2542,9 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, return -EFAULT; priv = wiphy_priv(wiphy); - nic = netdev_priv(dev); + vif = netdev_priv(dev); - if (nic->iftype == AP_MODE || nic->iftype == GO_MODE) { + if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) { memcpy(strStaParams.bssid, mac, ETH_ALEN); strStaParams.aid = params->aid; strStaParams.rates_len = params->supported_rates_len; @@ -2606,7 +2606,7 @@ static struct wireless_dev *add_virtual_intf(struct wiphy *wiphy, u32 *flags, struct vif_params *params) { - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc_priv *priv; struct net_device *new_ifc = NULL; @@ -2616,17 +2616,17 @@ static struct wireless_dev *add_virtual_intf(struct wiphy *wiphy, PRINT_D(HOSTAPD_DBG, "Adding monitor interface[%p]\n", priv->wdev->netdev); - nic = netdev_priv(priv->wdev->netdev); + vif = netdev_priv(priv->wdev->netdev); if (type == NL80211_IFTYPE_MONITOR) { PRINT_D(HOSTAPD_DBG, "Monitor interface mode: Initializing mon interface virtual device driver\n"); - PRINT_D(HOSTAPD_DBG, "Adding monitor interface[%p]\n", nic->wilc_netdev); - new_ifc = WILC_WFI_init_mon_interface(name, nic->wilc_netdev); + PRINT_D(HOSTAPD_DBG, "Adding monitor interface[%p]\n", vif->wilc_netdev); + new_ifc = WILC_WFI_init_mon_interface(name, vif->wilc_netdev); if (new_ifc) { PRINT_D(HOSTAPD_DBG, "Setting monitor flag in private structure\n"); - nic = netdev_priv(priv->wdev->netdev); - nic->monitor_flag = 1; + vif = netdev_priv(priv->wdev->netdev); + vif->monitor_flag = 1; } else PRINT_ER("Error in initializing monitor interface\n "); } diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index b9961f079e27..0d0449706de1 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -149,6 +149,14 @@ typedef struct { } struct_frame_reg; struct wilc_vif { + u8 u8IfIdx; + u8 iftype; + int monitor_flag; + int mac_opened; + struct_frame_reg g_struct_frame_reg[num_reg_frame]; + struct net_device *wilc_netdev; + struct net_device_stats netstats; + struct wilc *wilc; u8 src_addr[ETH_ALEN]; u8 bssid[ETH_ALEN]; struct host_if_drv *hif_drv; @@ -210,22 +218,11 @@ struct wilc { struct device *dev; }; -typedef struct { - u8 u8IfIdx; - u8 iftype; - int monitor_flag; - int mac_opened; - struct_frame_reg g_struct_frame_reg[num_reg_frame]; - struct net_device *wilc_netdev; - struct net_device_stats netstats; - struct wilc *wilc; -} perInterface_wlan_t; - struct WILC_WFI_mon_priv { struct net_device *real_ndev; }; -int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic); +int wilc1000_wlan_init(struct net_device *dev, struct wilc_vif *vif); void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset); void wilc_mac_indicate(struct wilc *wilc, int flag); diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 32ecc2df91aa..768a42c22dd4 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -72,11 +72,11 @@ wilc_wlan_txq_remove_from_head(struct net_device *dev) { struct txq_entry_t *tqe; unsigned long flags; - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wilc; - nic = netdev_priv(dev); - wilc = nic->wilc; + vif = netdev_priv(dev); + wilc = vif->wilc; spin_lock_irqsave(&wilc->txq_spinlock, flags); if (wilc->txq_head) { @@ -97,11 +97,11 @@ static void wilc_wlan_txq_add_to_tail(struct net_device *dev, struct txq_entry_t *tqe) { unsigned long flags; - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wilc; - nic = netdev_priv(dev); - wilc = nic->wilc; + vif = netdev_priv(dev); + wilc = vif->wilc; spin_lock_irqsave(&wilc->txq_spinlock, flags); @@ -239,11 +239,11 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe) unsigned short h_proto; int i; unsigned long flags; - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wilc; - nic = netdev_priv(dev); - wilc = nic->wilc; + vif = netdev_priv(dev); + wilc = vif->wilc; eth_hdr_ptr = &buffer[0]; @@ -301,13 +301,13 @@ static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe) static int wilc_wlan_txq_filter_dup_tcp_ack(struct net_device *dev) { - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wilc; u32 i = 0; u32 dropped = 0; - nic = netdev_priv(dev); - wilc = nic->wilc; + vif = netdev_priv(dev); + wilc = vif->wilc; spin_lock_irqsave(&wilc->txq_spinlock, wilc->txq_spinlock_flags); for (i = pending_base; i < (pending_base + pending_acks); i++) { @@ -397,10 +397,10 @@ int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer, u32 buffer_size, wilc_tx_complete_func_t func) { struct txq_entry_t *tqe; - perInterface_wlan_t *nic = netdev_priv(dev); + struct wilc_vif *vif = netdev_priv(dev); struct wilc *wilc; - wilc = nic->wilc; + wilc = vif->wilc; if (wilc->quit) return 0; @@ -429,10 +429,10 @@ int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer, u32 buffer_size, wilc_tx_complete_func_t func) { struct txq_entry_t *tqe; - perInterface_wlan_t *nic = netdev_priv(dev); + struct wilc_vif *vif = netdev_priv(dev); struct wilc *wilc; - wilc = nic->wilc; + wilc = vif->wilc; if (wilc->quit) return 0; @@ -676,11 +676,11 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) int counter; int timeout; u32 vmm_table[WILC_VMM_TBL_SIZE]; - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wilc; - nic = netdev_priv(dev); - wilc = nic->wilc; + vif = netdev_priv(dev); + wilc = vif->wilc; txb = wilc->tx_buffer; wilc->txq_exit = 0; @@ -1348,11 +1348,11 @@ void wilc_wlan_cleanup(struct net_device *dev) struct rxq_entry_t *rqe; u32 reg = 0; int ret; - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wilc; - nic = netdev_priv(dev); - wilc = nic->wilc; + vif = netdev_priv(dev); + wilc = vif->wilc; wilc->quit = 1; do { @@ -1510,11 +1510,11 @@ static u32 init_chip(struct net_device *dev) { u32 chipid; u32 reg, ret = 0; - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wilc; - nic = netdev_priv(dev); - wilc = nic->wilc; + vif = netdev_priv(dev); + wilc = vif->wilc; acquire_bus(wilc, ACQUIRE_ONLY); @@ -1580,10 +1580,10 @@ _fail_: int wilc_wlan_init(struct net_device *dev) { int ret = 0; - perInterface_wlan_t *nic = netdev_priv(dev); + struct wilc_vif *vif = netdev_priv(dev); struct wilc *wilc; - wilc = nic->wilc; + wilc = vif->wilc; PRINT_D(INIT_DBG, "Initializing WILC_Wlan ...\n"); @@ -1640,11 +1640,11 @@ u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value) { u16 ret; u32 reg; - perInterface_wlan_t *nic; + struct wilc_vif *vif; struct wilc *wilc; - nic = netdev_priv(dev); - wilc = nic->wilc; + vif = netdev_priv(dev); + wilc = vif->wilc; mutex_lock(&wilc->hif_cs); ret = wilc->hif_func->hif_read_reg(wilc, WILC_CHANGING_VIR_IF, From 1f435d2ef4cdb9c451f768d6c2e827351a55c64b Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:37 +0900 Subject: [PATCH 668/843] staging: wilc1000: change vif to pointer to refence real private data vif of struct has it's own memory which is not necessary because we have allocated vif from netdev_priv. Change vif to pointer type and assign vif which is netdev private data. Change it's operator on related codes as well. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 65 ++++++++--------- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 72 +++++++++---------- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +- 3 files changed, 70 insertions(+), 69 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 263d9d84c8cf..810d7ce37468 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -289,9 +289,9 @@ static struct net_device *get_if_handler(struct wilc *wilc, u8 *mac_header) bssid1 = mac_header + 4; for (i = 0; i < wilc->vif_num; i++) - if (!memcmp(bssid1, wilc->vif[i].bssid, ETH_ALEN) || - !memcmp(bssid, wilc->vif[i].bssid, ETH_ALEN)) - return wilc->vif[i].ndev; + if (!memcmp(bssid1, wilc->vif[i]->bssid, ETH_ALEN) || + !memcmp(bssid, wilc->vif[i]->bssid, ETH_ALEN)) + return wilc->vif[i]->ndev; PRINT_INFO(INIT_DBG, "Invalide handle\n"); for (i = 0; i < 25; i++) @@ -299,9 +299,9 @@ static struct net_device *get_if_handler(struct wilc *wilc, u8 *mac_header) bssid = mac_header + 18; bssid1 = mac_header + 12; for (i = 0; i < wilc->vif_num; i++) - if (!memcmp(bssid1, wilc->vif[i].bssid, ETH_ALEN) || - !memcmp(bssid, wilc->vif[i].bssid, ETH_ALEN)) - return wilc->vif[i].ndev; + if (!memcmp(bssid1, wilc->vif[i]->bssid, ETH_ALEN) || + !memcmp(bssid, wilc->vif[i]->bssid, ETH_ALEN)) + return wilc->vif[i]->ndev; PRINT_INFO(INIT_DBG, "\n"); return NULL; @@ -318,8 +318,8 @@ int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid) wilc = vif->wilc; for (i = 0; i < wilc->vif_num; i++) - if (wilc->vif[i].ndev == wilc_netdev) { - memcpy(wilc->vif[i].bssid, bssid, 6); + if (wilc->vif[i]->ndev == wilc_netdev) { + memcpy(wilc->vif[i]->bssid, bssid, 6); ret = 0; break; } @@ -334,7 +334,7 @@ int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc) u8 ret_val = 0; for (i = 0; i < wilc->vif_num; i++) - if (memcmp(wilc->vif[i].bssid, null_bssid, 6)) + if (memcmp(wilc->vif[i]->bssid, null_bssid, 6)) ret_val++; return ret_val; @@ -384,10 +384,10 @@ static int linux_wlan_txq_task(void *vp) if (txq_count < FLOW_CONTROL_LOWER_THRESHOLD) { PRINT_D(TX_DBG, "Waking up queue\n"); - if (netif_queue_stopped(wl->vif[0].ndev)) - netif_wake_queue(wl->vif[0].ndev); - if (netif_queue_stopped(wl->vif[1].ndev)) - netif_wake_queue(wl->vif[1].ndev); + if (netif_queue_stopped(wl->vif[0]->ndev)) + netif_wake_queue(wl->vif[0]->ndev); + if (netif_queue_stopped(wl->vif[1]->ndev)) + netif_wake_queue(wl->vif[1]->ndev); } if (ret == WILC_TX_ERR_NO_BUF) { @@ -1034,14 +1034,14 @@ int wilc_mac_open(struct net_device *ndev) PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add); for (i = 0; i < wl->vif_num; i++) { - if (ndev == wl->vif[i].ndev) { - memcpy(wl->vif[i].src_addr, mac_add, ETH_ALEN); - wl->vif[i].hif_drv = priv->hWILCWFIDrv; + if (ndev == wl->vif[i]->ndev) { + memcpy(wl->vif[i]->src_addr, mac_add, ETH_ALEN); + wl->vif[i]->hif_drv = priv->hWILCWFIDrv; break; } } - memcpy(ndev->dev_addr, wl->vif[i].src_addr, ETH_ALEN); + memcpy(ndev->dev_addr, wl->vif[i]->src_addr, ETH_ALEN); if (!is_valid_ether_addr(ndev->dev_addr)) { PRINT_ER("Error: Wrong MAC address\n"); @@ -1182,14 +1182,14 @@ int wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev) PRINT_D(TX_DBG, "Adding tx packet to TX Queue\n"); vif->netstats.tx_packets++; vif->netstats.tx_bytes += tx_data->size; - tx_data->pBssid = wilc->vif[vif->u8IfIdx].bssid; + tx_data->pBssid = wilc->vif[vif->u8IfIdx]->bssid; queue_count = wilc_wlan_txq_add_net_pkt(ndev, (void *)tx_data, tx_data->buff, tx_data->size, linux_wlan_tx_complete); if (queue_count > FLOW_CONTROL_UPPER_THRESHOLD) { - netif_stop_queue(wilc->vif[0].ndev); - netif_stop_queue(wilc->vif[1].ndev); + netif_stop_queue(wilc->vif[0]->ndev); + netif_stop_queue(wilc->vif[1]->ndev); } return 0; @@ -1373,17 +1373,17 @@ void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size) struct wilc_vif *vif; for (i = 0; i < wilc->vif_num; i++) { - vif = netdev_priv(wilc->vif[i].ndev); + vif = netdev_priv(wilc->vif[i]->ndev); if (vif->monitor_flag) { WILC_WFI_monitor_rx(buff, size); return; } } - vif = netdev_priv(wilc->vif[1].ndev); + vif = netdev_priv(wilc->vif[1]->ndev); if ((buff[0] == vif->g_struct_frame_reg[0].frame_type && vif->g_struct_frame_reg[0].reg) || (buff[0] == vif->g_struct_frame_reg[1].frame_type && vif->g_struct_frame_reg[1].reg)) - WILC_WFI_p2p_rx(wilc->vif[1].ndev, buff, size); + WILC_WFI_p2p_rx(wilc->vif[1]->ndev, buff, size); } void wilc_netdev_cleanup(struct wilc *wilc) @@ -1391,28 +1391,28 @@ void wilc_netdev_cleanup(struct wilc *wilc) int i = 0; struct wilc_vif *vif[NUM_CONCURRENT_IFC]; - if (wilc && (wilc->vif[0].ndev || wilc->vif[1].ndev)) { + if (wilc && (wilc->vif[0]->ndev || wilc->vif[1]->ndev)) { unregister_inetaddr_notifier(&g_dev_notifier); for (i = 0; i < NUM_CONCURRENT_IFC; i++) - vif[i] = netdev_priv(wilc->vif[i].ndev); + vif[i] = netdev_priv(wilc->vif[i]->ndev); } if (wilc && wilc->firmware) release_firmware(wilc->firmware); - if (wilc && (wilc->vif[0].ndev || wilc->vif[1].ndev)) { + if (wilc && (wilc->vif[0]->ndev || wilc->vif[1]->ndev)) { wilc_lock_timeout(wilc, &close_exit_sync, 12 * 1000); for (i = 0; i < NUM_CONCURRENT_IFC; i++) - if (wilc->vif[i].ndev) + if (wilc->vif[i]->ndev) if (vif[i]->mac_opened) - wilc_mac_close(wilc->vif[i].ndev); + wilc_mac_close(wilc->vif[i]->ndev); for (i = 0; i < NUM_CONCURRENT_IFC; i++) { - unregister_netdev(wilc->vif[i].ndev); - wilc_free_wiphy(wilc->vif[i].ndev); - free_netdev(wilc->vif[i].ndev); + unregister_netdev(wilc->vif[i]->ndev); + wilc_free_wiphy(wilc->vif[i]->ndev); + free_netdev(wilc->vif[i]->ndev); } } @@ -1459,7 +1459,8 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, vif->u8IfIdx = wl->vif_num; vif->wilc_netdev = ndev; vif->wilc = *wilc; - wl->vif[wl->vif_num].ndev = ndev; + wl->vif[i] = vif; + wl->vif[wl->vif_num]->ndev = ndev; wl->vif_num++; ndev->netdev_ops = &wilc_netdev_ops; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 8ec12f8ea81d..d128fb69002e 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -578,9 +578,9 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, if (!pstrWFIDrv->p2p_connect) wlan_channel = INVALID_CHANNEL; - if ((pstrWFIDrv->IFC_UP) && (dev == wl->vif[1].ndev)) { + if ((pstrWFIDrv->IFC_UP) && (dev == wl->vif[1]->ndev)) { pstrDisconnectNotifInfo->u16reason = 3; - } else if ((!pstrWFIDrv->IFC_UP) && (dev == wl->vif[1].ndev)) { + } else if ((!pstrWFIDrv->IFC_UP) && (dev == wl->vif[1]->ndev)) { pstrDisconnectNotifInfo->u16reason = 1; } cfg80211_disconnected(dev, pstrDisconnectNotifInfo->u16reason, pstrDisconnectNotifInfo->ie, @@ -1118,7 +1118,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, KeyLen = params->key_len - 16; } - if (!g_gtk_keys_saved && netdev == wl->vif[0].ndev) { + if (!g_gtk_keys_saved && netdev == wl->vif[0]->ndev) { g_add_gtk_key_params.key_idx = key_index; g_add_gtk_key_params.pairwise = pairwise; if (!mac_addr) { @@ -1152,7 +1152,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, KeyLen = params->key_len - 16; } - if (!g_ptk_keys_saved && netdev == wl->vif[0].ndev) { + if (!g_ptk_keys_saved && netdev == wl->vif[0]->ndev) { g_add_ptk_key_params.key_idx = key_index; g_add_ptk_key_params.pairwise = pairwise; if (!mac_addr) { @@ -1209,7 +1209,7 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev, vif = netdev_priv(netdev); wl = vif->wilc; - if (netdev == wl->vif[0].ndev) { + if (netdev == wl->vif[0]->ndev) { g_ptk_keys_saved = false; g_gtk_keys_saved = false; g_wep_keys_saved = false; @@ -2097,7 +2097,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, if (wl->initialized) { wilc_del_all_rx_ba_session(priv->hWILCWFIDrv, - wl->vif[0].bssid, TID); + wl->vif[0]->bssid, TID); wilc_wait_msg_queue_idle(); up(&wl->cfg_event); @@ -2107,15 +2107,15 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, wilc_initialized = 1; vif->iftype = interface_type; - wilc_set_wfi_drv_handler(wl->vif[0].hif_drv); - wilc_set_mac_address(wl->vif[0].hif_drv, - wl->vif[0].src_addr); + wilc_set_wfi_drv_handler(wl->vif[0]->hif_drv); + wilc_set_mac_address(wl->vif[0]->hif_drv, + wl->vif[0]->src_addr); wilc_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE); if (g_wep_keys_saved) { - wilc_set_wep_default_keyid(wl->vif[0].hif_drv, + wilc_set_wep_default_keyid(wl->vif[0]->hif_drv, g_key_wep_params.key_idx); - wilc_add_wep_key_bss_sta(wl->vif[0].hif_drv, + wilc_add_wep_key_bss_sta(wl->vif[0]->hif_drv, g_key_wep_params.key, g_key_wep_params.key_len, g_key_wep_params.key_idx); @@ -2130,15 +2130,15 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, PRINT_D(CFG80211_DBG, "gtk %x %x %x\n", g_key_gtk_params.key[0], g_key_gtk_params.key[1], g_key_gtk_params.key[2]); - add_key(wl->vif[0].ndev->ieee80211_ptr->wiphy, - wl->vif[0].ndev, + add_key(wl->vif[0]->ndev->ieee80211_ptr->wiphy, + wl->vif[0]->ndev, g_add_ptk_key_params.key_idx, g_add_ptk_key_params.pairwise, g_add_ptk_key_params.mac_addr, (struct key_params *)(&g_key_ptk_params)); - add_key(wl->vif[0].ndev->ieee80211_ptr->wiphy, - wl->vif[0].ndev, + add_key(wl->vif[0]->ndev->ieee80211_ptr->wiphy, + wl->vif[0]->ndev, g_add_gtk_key_params.key_idx, g_add_gtk_key_params.pairwise, g_add_gtk_key_params.mac_addr, @@ -2167,7 +2167,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_P2P_CLIENT\n"); wilc_del_all_rx_ba_session(priv->hWILCWFIDrv, - wl->vif[0].bssid, TID); + wl->vif[0]->bssid, TID); dev->ieee80211_ptr->iftype = type; priv->wdev->iftype = type; @@ -2184,15 +2184,15 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, wilc1000_wlan_init(dev, vif); wilc_initialized = 1; - wilc_set_wfi_drv_handler(wl->vif[0].hif_drv); - wilc_set_mac_address(wl->vif[0].hif_drv, - wl->vif[0].src_addr); + wilc_set_wfi_drv_handler(wl->vif[0]->hif_drv); + wilc_set_mac_address(wl->vif[0]->hif_drv, + wl->vif[0]->src_addr); wilc_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE); if (g_wep_keys_saved) { - wilc_set_wep_default_keyid(wl->vif[0].hif_drv, + wilc_set_wep_default_keyid(wl->vif[0]->hif_drv, g_key_wep_params.key_idx); - wilc_add_wep_key_bss_sta(wl->vif[0].hif_drv, + wilc_add_wep_key_bss_sta(wl->vif[0]->hif_drv, g_key_wep_params.key, g_key_wep_params.key_len, g_key_wep_params.key_idx); @@ -2207,15 +2207,15 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, PRINT_D(CFG80211_DBG, "gtk %x %x %x\n", g_key_gtk_params.key[0], g_key_gtk_params.key[1], g_key_gtk_params.key[2]); - add_key(wl->vif[0].ndev->ieee80211_ptr->wiphy, - wl->vif[0].ndev, + add_key(wl->vif[0]->ndev->ieee80211_ptr->wiphy, + wl->vif[0]->ndev, g_add_ptk_key_params.key_idx, g_add_ptk_key_params.pairwise, g_add_ptk_key_params.mac_addr, (struct key_params *)(&g_key_ptk_params)); - add_key(wl->vif[0].ndev->ieee80211_ptr->wiphy, - wl->vif[0].ndev, + add_key(wl->vif[0]->ndev->ieee80211_ptr->wiphy, + wl->vif[0]->ndev, g_add_gtk_key_params.key_idx, g_add_gtk_key_params.pairwise, g_add_gtk_key_params.mac_addr, @@ -2271,7 +2271,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, jiffies + msecs_to_jiffies(during_ip_time)); wilc_set_power_mgmt(priv->hWILCWFIDrv, 0, 0); wilc_del_all_rx_ba_session(priv->hWILCWFIDrv, - wl->vif[0].bssid, TID); + wl->vif[0]->bssid, TID); wilc_enable_ps = false; PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_GO\n"); dev->ieee80211_ptr->iftype = type; @@ -2289,15 +2289,15 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, wilc1000_wlan_init(dev, vif); wilc_initialized = 1; - wilc_set_wfi_drv_handler(wl->vif[0].hif_drv); - wilc_set_mac_address(wl->vif[0].hif_drv, - wl->vif[0].src_addr); + wilc_set_wfi_drv_handler(wl->vif[0]->hif_drv); + wilc_set_mac_address(wl->vif[0]->hif_drv, + wl->vif[0]->src_addr); wilc_set_operation_mode(priv->hWILCWFIDrv, AP_MODE); if (g_wep_keys_saved) { - wilc_set_wep_default_keyid(wl->vif[0].hif_drv, + wilc_set_wep_default_keyid(wl->vif[0]->hif_drv, g_key_wep_params.key_idx); - wilc_add_wep_key_bss_sta(wl->vif[0].hif_drv, + wilc_add_wep_key_bss_sta(wl->vif[0]->hif_drv, g_key_wep_params.key, g_key_wep_params.key_len, g_key_wep_params.key_idx); @@ -2314,15 +2314,15 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, g_key_gtk_params.key[1], g_key_gtk_params.key[2], g_key_gtk_params.cipher); - add_key(wl->vif[0].ndev->ieee80211_ptr->wiphy, - wl->vif[0].ndev, + add_key(wl->vif[0]->ndev->ieee80211_ptr->wiphy, + wl->vif[0]->ndev, g_add_ptk_key_params.key_idx, g_add_ptk_key_params.pairwise, g_add_ptk_key_params.mac_addr, (struct key_params *)(&g_key_ptk_params)); - add_key(wl->vif[0].ndev->ieee80211_ptr->wiphy, - wl->vif[0].ndev, + add_key(wl->vif[0]->ndev->ieee80211_ptr->wiphy, + wl->vif[0]->ndev, g_add_gtk_key_params.key_idx, g_add_gtk_key_params.pairwise, g_add_gtk_key_params.mac_addr, @@ -2370,7 +2370,7 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev, if (s32Error != 0) PRINT_ER("Error in setting channel\n"); - wilc_wlan_set_bssid(dev, wl->vif[0].src_addr); + wilc_wlan_set_bssid(dev, wl->vif[0]->src_addr); s32Error = wilc_add_beacon(priv->hWILCWFIDrv, settings->beacon_interval, diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 0d0449706de1..9f5eac8acd07 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -172,7 +172,7 @@ struct wilc { int dev_irq_num; int close; u8 vif_num; - struct wilc_vif vif[NUM_CONCURRENT_IFC]; + struct wilc_vif *vif[NUM_CONCURRENT_IFC]; u8 open_ifcs; struct semaphore txq_add_to_head_cs; From 1006b5c71cbd8f4f89a67a6b4c4648aa9154199b Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:38 +0900 Subject: [PATCH 669/843] staging: wilc1000: remove duplicate netdev There are two net_device pointer which is the same because two structures are merged into wilc_vif in previous patch. Remove wilc_netdev and change with ndev. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/linux_wlan.c | 35 +++++++++---------- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 4 +-- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 - 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 810d7ce37468..bb3ff49e8e67 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -440,8 +440,8 @@ int wilc_wlan_get_firmware(struct net_device *dev) goto _fail_; } - if (!(&vif->wilc_netdev->dev)) { - PRINT_ER("&vif->wilc_netdev->dev is NULL\n"); + if (!(&vif->ndev->dev)) { + PRINT_ER("&vif->ndev->dev is NULL\n"); goto _fail_; } @@ -1010,7 +1010,7 @@ int wilc_mac_open(struct net_device *ndev) vif = netdev_priv(ndev); wilc = vif->wilc; - priv = wiphy_priv(vif->wilc_netdev->ieee80211_ptr->wiphy); + priv = wiphy_priv(vif->ndev->ieee80211_ptr->wiphy); PRINT_D(INIT_DBG, "MAC OPEN[%p]\n", ndev); ret = wilc_init_host_int(ndev); @@ -1050,12 +1050,12 @@ int wilc_mac_open(struct net_device *ndev) return -EINVAL; } - wilc_mgmt_frame_register(vif->wilc_netdev->ieee80211_ptr->wiphy, - vif->wilc_netdev->ieee80211_ptr, + wilc_mgmt_frame_register(vif->ndev->ieee80211_ptr->wiphy, + vif->ndev->ieee80211_ptr, vif->g_struct_frame_reg[0].frame_type, vif->g_struct_frame_reg[0].reg); - wilc_mgmt_frame_register(vif->wilc_netdev->ieee80211_ptr->wiphy, - vif->wilc_netdev->ieee80211_ptr, + wilc_mgmt_frame_register(vif->ndev->ieee80211_ptr->wiphy, + vif->ndev->ieee80211_ptr, vif->g_struct_frame_reg[1].frame_type, vif->g_struct_frame_reg[1].reg); netif_wake_queue(ndev); @@ -1204,13 +1204,13 @@ int wilc_mac_close(struct net_device *ndev) vif = netdev_priv(ndev); - if (!vif || !vif->wilc_netdev || !vif->wilc_netdev->ieee80211_ptr || - !vif->wilc_netdev->ieee80211_ptr->wiphy) { + if (!vif || !vif->ndev || !vif->ndev->ieee80211_ptr || + !vif->ndev->ieee80211_ptr->wiphy) { PRINT_ER("vif = NULL\n"); return 0; } - priv = wiphy_priv(vif->wilc_netdev->ieee80211_ptr->wiphy); + priv = wiphy_priv(vif->ndev->ieee80211_ptr->wiphy); wl = vif->wilc; if (!priv) { @@ -1239,10 +1239,10 @@ int wilc_mac_close(struct net_device *ndev) return 0; } - if (vif->wilc_netdev) { - netif_stop_queue(vif->wilc_netdev); + if (vif->ndev) { + netif_stop_queue(vif->ndev); - wilc_deinit_host_int(vif->wilc_netdev); + wilc_deinit_host_int(vif->ndev); } if (wl->open_ifcs == 0) { @@ -1288,7 +1288,7 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) return PTR_ERR(buff); if (strncasecmp(buff, "RSSI", length) == 0) { - priv = wiphy_priv(vif->wilc_netdev->ieee80211_ptr->wiphy); + priv = wiphy_priv(vif->ndev->ieee80211_ptr->wiphy); ret = wilc_get_rssi(priv->hWILCWFIDrv, &rssi); if (ret) PRINT_ER("Failed to send get rssi param's message queue "); @@ -1457,7 +1457,6 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, strcpy(ndev->name, "p2p%d"); vif->u8IfIdx = wl->vif_num; - vif->wilc_netdev = ndev; vif->wilc = *wilc; wl->vif[i] = vif; wl->vif[wl->vif_num]->ndev = ndev; @@ -1476,9 +1475,9 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, return -1; } - vif->wilc_netdev->ieee80211_ptr = wdev; - vif->wilc_netdev->ml_priv = vif; - wdev->netdev = vif->wilc_netdev; + vif->ndev->ieee80211_ptr = wdev; + vif->ndev->ml_priv = vif; + wdev->netdev = vif->ndev; vif->netstats.rx_packets = 0; vif->netstats.tx_packets = 0; vif->netstats.rx_bytes = 0; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index d128fb69002e..87f8d0db3579 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -2621,8 +2621,8 @@ static struct wireless_dev *add_virtual_intf(struct wiphy *wiphy, if (type == NL80211_IFTYPE_MONITOR) { PRINT_D(HOSTAPD_DBG, "Monitor interface mode: Initializing mon interface virtual device driver\n"); - PRINT_D(HOSTAPD_DBG, "Adding monitor interface[%p]\n", vif->wilc_netdev); - new_ifc = WILC_WFI_init_mon_interface(name, vif->wilc_netdev); + PRINT_D(HOSTAPD_DBG, "Adding monitor interface[%p]\n", vif->ndev); + new_ifc = WILC_WFI_init_mon_interface(name, vif->ndev); if (new_ifc) { PRINT_D(HOSTAPD_DBG, "Setting monitor flag in private structure\n"); vif = netdev_priv(priv->wdev->netdev); diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 9f5eac8acd07..98ac8ed04a06 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -154,7 +154,6 @@ struct wilc_vif { int monitor_flag; int mac_opened; struct_frame_reg g_struct_frame_reg[num_reg_frame]; - struct net_device *wilc_netdev; struct net_device_stats netstats; struct wilc *wilc; u8 src_addr[ETH_ALEN]; From cf60106bfc2fa17d6f1346991e74af92b8f53055 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:39 +0900 Subject: [PATCH 670/843] staging: wilc1000: pass vif to hostIFthread We will pass vif, which is currently being used as net_device, instead of hif_dev. This is the first step to use index of vif to pass to the driver. Add new argument vif to all the functions that send message to hostIFthread and set vif to msg.vif. As a result, hostIfthread will get vif. In later patch, we will remove drv of host_if_msg and use vif instead of it. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 234 +++++++++++------- drivers/staging/wilc1000/host_interface.h | 165 ++++++------ drivers/staging/wilc1000/linux_wlan.c | 22 +- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 166 +++++++------ 4 files changed, 341 insertions(+), 246 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 23bd8d306c8b..3dd2833f7e72 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -194,6 +194,7 @@ struct host_if_msg { u16 id; union message_body body; struct host_if_drv *drv; + struct wilc_vif *vif; }; struct join_bss_param { @@ -389,9 +390,13 @@ static s32 handle_set_operation_mode(struct host_if_drv *hif_drv, return result; } -static s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx); +static s32 host_int_get_ipaddress(struct wilc_vif *vif, + struct host_if_drv *hif_drv, + u8 *u16ipadd, u8 idx); -static s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 *ip_addr, u8 idx) +static s32 handle_set_ip_address(struct wilc_vif *vif, + struct host_if_drv *hif_drv, u8 *ip_addr, + u8 idx) { s32 result = 0; struct wid wid; @@ -413,7 +418,7 @@ static s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 *ip_addr, u8 id result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, get_id_from_handler(hif_drv)); - host_int_get_ipaddress(hif_drv, firmware_ip_addr, idx); + host_int_get_ipaddress(vif, hif_drv, firmware_ip_addr, idx); if (result) { PRINT_ER("Failed to set IP address\n"); @@ -425,7 +430,8 @@ static s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 *ip_addr, u8 id return result; } -static s32 handle_get_ip_address(struct host_if_drv *hif_drv, u8 idx) +static s32 handle_get_ip_address(struct wilc_vif *vif, + struct host_if_drv *hif_drv, u8 idx) { s32 result = 0; struct wid wid; @@ -445,7 +451,7 @@ static s32 handle_get_ip_address(struct host_if_drv *hif_drv, u8 idx) kfree(wid.val); if (memcmp(get_ip[idx], set_ip[idx], IP_ALEN) != 0) - wilc_setup_ipaddress(hif_drv, set_ip[idx], idx); + wilc_setup_ipaddress(vif, hif_drv, set_ip[idx], idx); if (result != 0) { PRINT_ER("Failed to get IP address\n"); @@ -1493,7 +1499,8 @@ static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen); -static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, +static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif, + struct host_if_drv *hif_drv, struct rcvd_async_info *pstrRcvdGnrlAsyncInfo) { s32 result = 0; @@ -1622,7 +1629,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, if ((u8MacStatus == MAC_CONNECTED) && (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { - wilc_set_power_mgmt(hif_drv, 0, 0); + wilc_set_power_mgmt(vif, hif_drv, 0, 0); PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n"); hif_drv->hif_state = HOST_IF_CONNECTED; @@ -1668,7 +1675,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, if (hif_drv->usr_conn_req.conn_result) { wilc_optaining_ip = false; - wilc_set_power_mgmt(hif_drv, 0, 0); + wilc_set_power_mgmt(vif, hif_drv, 0, 0); hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, @@ -1993,7 +2000,8 @@ _WPAPtk_end_case_: return result; } -static void Handle_Disconnect(struct host_if_drv *hif_drv) +static void Handle_Disconnect(struct wilc_vif *vif, + struct host_if_drv *hif_drv) { struct wid wid; @@ -2008,7 +2016,7 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv) PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); wilc_optaining_ip = false; - wilc_set_power_mgmt(hif_drv, 0, 0); + wilc_set_power_mgmt(vif, hif_drv, 0, 0); eth_zero_addr(wilc_connected_ssid); @@ -2079,14 +2087,15 @@ static void Handle_Disconnect(struct host_if_drv *hif_drv) up(&hif_drv->sem_test_disconn_block); } -void wilc_resolve_disconnect_aberration(struct host_if_drv *hif_drv) +void wilc_resolve_disconnect_aberration(struct wilc_vif *vif, + struct host_if_drv *hif_drv) { if (!hif_drv) return; if ((hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) || (hif_drv->hif_state == HOST_IF_CONNECTING)) { PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n"); - wilc_disconnect(hif_drv, 1); + wilc_disconnect(vif, hif_drv, 1); } } @@ -2792,12 +2801,14 @@ static int hostIFthread(void *pvArg) struct host_if_msg msg; struct host_if_drv *hif_drv; struct wilc *wilc = (struct wilc*)pvArg; + struct wilc_vif *vif; memset(&msg, 0, sizeof(struct host_if_msg)); while (1) { wilc_mq_recv(&hif_msg_q, &msg, sizeof(struct host_if_msg), &u32Ret); hif_drv = (struct host_if_drv *)msg.drv; + vif = msg.vif; if (msg.id == HOST_IF_MSG_EXIT) { PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n"); break; @@ -2840,7 +2851,8 @@ static int hostIFthread(void *pvArg) break; case HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO: - Handle_RcvdGnrlAsyncInfo(msg.drv, &msg.body.async_info); + Handle_RcvdGnrlAsyncInfo(vif, msg.drv, + &msg.body.async_info); break; case HOST_IF_MSG_KEY: @@ -2856,7 +2868,7 @@ static int hostIFthread(void *pvArg) break; case HOST_IF_MSG_DISCONNECT: - Handle_Disconnect(msg.drv); + Handle_Disconnect(vif, msg.drv); break; case HOST_IF_MSG_RCVD_SCAN_COMPLETE: @@ -2938,14 +2950,15 @@ static int hostIFthread(void *pvArg) case HOST_IF_MSG_SET_IPADDRESS: PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); - handle_set_ip_address(msg.drv, + handle_set_ip_address(vif, msg.drv, msg.body.ip_info.ip_addr, msg.body.ip_info.idx); break; case HOST_IF_MSG_GET_IPADDRESS: PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); - handle_get_ip_address(msg.drv, msg.body.ip_info.idx); + handle_get_ip_address(vif, msg.drv, + msg.body.ip_info.idx); break; case HOST_IF_MSG_SET_MAC_ADDRESS: @@ -3032,7 +3045,8 @@ s32 wilc_remove_key(struct host_if_drv *hif_drv, const u8 *pu8StaAddress) return 0; } -int wilc_remove_wep_key(struct host_if_drv *hif_drv, u8 index) +int wilc_remove_wep_key(struct wilc_vif *vif, + struct host_if_drv *hif_drv, u8 index) { int result = 0; struct host_if_msg msg; @@ -3049,6 +3063,7 @@ int wilc_remove_wep_key(struct host_if_drv *hif_drv, u8 index) msg.body.key_info.type = WEP; msg.body.key_info.action = REMOVEKEY; msg.drv = hif_drv; + msg.vif = vif; msg.body.key_info.attr.wep.index = index; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -3059,7 +3074,8 @@ int wilc_remove_wep_key(struct host_if_drv *hif_drv, u8 index) return result; } -int wilc_set_wep_default_keyid(struct host_if_drv *hif_drv, u8 index) +int wilc_set_wep_default_keyid(struct wilc_vif *vif, + struct host_if_drv *hif_drv, u8 index) { int result = 0; struct host_if_msg msg; @@ -3076,6 +3092,7 @@ int wilc_set_wep_default_keyid(struct host_if_drv *hif_drv, u8 index) msg.body.key_info.type = WEP; msg.body.key_info.action = DEFAULTKEY; msg.drv = hif_drv; + msg.vif = vif; msg.body.key_info.attr.wep.index = index; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -3086,10 +3103,8 @@ int wilc_set_wep_default_keyid(struct host_if_drv *hif_drv, u8 index) return result; } -int wilc_add_wep_key_bss_sta(struct host_if_drv *hif_drv, - const u8 *key, - u8 len, - u8 index) +int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, struct host_if_drv *hif_drv, + const u8 *key, u8 len, u8 index) { int result = 0; struct host_if_msg msg; @@ -3105,6 +3120,7 @@ int wilc_add_wep_key_bss_sta(struct host_if_drv *hif_drv, msg.body.key_info.type = WEP; msg.body.key_info.action = ADDKEY; msg.drv = hif_drv; + msg.vif = vif; msg.body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL); if (!msg.body.key_info.attr.wep.key) return -ENOMEM; @@ -3120,11 +3136,8 @@ int wilc_add_wep_key_bss_sta(struct host_if_drv *hif_drv, return result; } -int wilc_add_wep_key_bss_ap(struct host_if_drv *hif_drv, - const u8 *key, - u8 len, - u8 index, - u8 mode, +int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, struct host_if_drv *hif_drv, + const u8 *key, u8 len, u8 index, u8 mode, enum AUTHTYPE auth_type) { int result = 0; @@ -3146,6 +3159,7 @@ int wilc_add_wep_key_bss_ap(struct host_if_drv *hif_drv, msg.body.key_info.type = WEP; msg.body.key_info.action = ADDKEY_AP; msg.drv = hif_drv; + msg.vif = vif; msg.body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL); if (!msg.body.key_info.attr.wep.key) return -ENOMEM; @@ -3164,10 +3178,10 @@ int wilc_add_wep_key_bss_ap(struct host_if_drv *hif_drv, return result; } -int wilc_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, - u8 ptk_key_len, const u8 *mac_addr, - const u8 *rx_mic, const u8 *tx_mic, - u8 mode, u8 cipher_mode, u8 index) +int wilc_add_ptk(struct wilc_vif *vif, struct host_if_drv *hif_drv, + const u8 *ptk, u8 ptk_key_len, const u8 *mac_addr, + const u8 *rx_mic, const u8 *tx_mic, u8 mode, u8 cipher_mode, + u8 index) { int result = 0; struct host_if_msg msg; @@ -3219,6 +3233,7 @@ int wilc_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, msg.body.key_info.attr.wpa.mac_addr = mac_addr; msg.body.key_info.attr.wpa.mode = cipher_mode; msg.drv = hif_drv; + msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -3230,11 +3245,10 @@ int wilc_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, return result; } -int wilc_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, - u8 gtk_key_len, u8 index, - u32 key_rsc_len, const u8 *key_rsc, - const u8 *rx_mic, const u8 *tx_mic, - u8 mode, u8 cipher_mode) +int wilc_add_rx_gtk(struct wilc_vif *vif, struct host_if_drv *hif_drv, + const u8 *rx_gtk, u8 gtk_key_len, u8 index, + u32 key_rsc_len, const u8 *key_rsc, const u8 *rx_mic, + const u8 *tx_mic, u8 mode, u8 cipher_mode) { int result = 0; struct host_if_msg msg; @@ -3263,6 +3277,7 @@ int wilc_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, msg.id = HOST_IF_MSG_KEY; msg.body.key_info.type = WPA_RX_GTK; msg.drv = hif_drv; + msg.vif = vif; if (mode == AP_MODE) { msg.body.key_info.action = ADDKEY_AP; @@ -3298,7 +3313,8 @@ int wilc_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, return result; } -s32 wilc_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_attr *pu8PmkidInfoArray) +s32 wilc_set_pmkid_info(struct wilc_vif *vif, struct host_if_drv *hif_drv, + struct host_if_pmkid_attr *pu8PmkidInfoArray) { s32 result = 0; struct host_if_msg msg; @@ -3315,6 +3331,7 @@ s32 wilc_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_attr * msg.body.key_info.type = PMKSA; msg.body.key_info.action = ADDKEY; msg.drv = hif_drv; + msg.vif = vif; for (i = 0; i < pu8PmkidInfoArray->numpmkid; i++) { memcpy(msg.body.key_info.attr.pmkid.pmkidlist[i].bssid, @@ -3330,7 +3347,8 @@ s32 wilc_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_attr * return result; } -s32 wilc_get_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress) +s32 wilc_get_mac_address(struct wilc_vif *vif, struct host_if_drv *hif_drv, + u8 *pu8MacAddress) { s32 result = 0; struct host_if_msg msg; @@ -3340,6 +3358,7 @@ s32 wilc_get_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress) msg.id = HOST_IF_MSG_GET_MAC_ADDRESS; msg.body.get_mac_info.mac_addr = pu8MacAddress; msg.drv = hif_drv; + msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) { @@ -3351,7 +3370,8 @@ s32 wilc_get_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress) return result; } -s32 wilc_set_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress) +s32 wilc_set_mac_address(struct wilc_vif *vif, struct host_if_drv *hif_drv, + u8 *pu8MacAddress) { s32 result = 0; struct host_if_msg msg; @@ -3362,6 +3382,7 @@ s32 wilc_set_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress) msg.id = HOST_IF_MSG_SET_MAC_ADDRESS; memcpy(msg.body.set_mac_info.mac_addr, pu8MacAddress, ETH_ALEN); msg.drv = hif_drv; + msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) @@ -3370,12 +3391,12 @@ s32 wilc_set_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress) return result; } -s32 wilc_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid, - const u8 *pu8ssid, size_t ssidLen, - const u8 *pu8IEs, size_t IEsLen, - wilc_connect_result pfConnectResult, void *pvUserArg, - u8 u8security, enum AUTHTYPE tenuAuth_type, - u8 u8channel, void *pJoinParams) +s32 wilc_set_join_req(struct wilc_vif *vif, struct host_if_drv *hif_drv, + u8 *pu8bssid, const u8 *pu8ssid, size_t ssidLen, + const u8 *pu8IEs, size_t IEsLen, + wilc_connect_result pfConnectResult, void *pvUserArg, + u8 u8security, enum AUTHTYPE tenuAuth_type, + u8 u8channel, void *pJoinParams) { s32 result = 0; struct host_if_msg msg; @@ -3401,6 +3422,7 @@ s32 wilc_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid, msg.body.con_info.arg = pvUserArg; msg.body.con_info.params = pJoinParams; msg.drv = hif_drv ; + msg.vif = vif; if (pu8bssid) { msg.body.con_info.bssid = kmalloc(6, GFP_KERNEL); @@ -3437,7 +3459,7 @@ s32 wilc_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid, return result; } -s32 wilc_flush_join_req(struct host_if_drv *hif_drv) +s32 wilc_flush_join_req(struct wilc_vif *vif, struct host_if_drv *hif_drv) { s32 result = 0; struct host_if_msg msg; @@ -3452,6 +3474,7 @@ s32 wilc_flush_join_req(struct host_if_drv *hif_drv) msg.id = HOST_IF_MSG_FLUSH_CONNECT; msg.drv = hif_drv; + msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) { @@ -3462,7 +3485,8 @@ s32 wilc_flush_join_req(struct host_if_drv *hif_drv) return result; } -s32 wilc_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode) +s32 wilc_disconnect(struct wilc_vif *vif, struct host_if_drv *hif_drv, + u16 u16ReasonCode) { s32 result = 0; struct host_if_msg msg; @@ -3476,6 +3500,7 @@ s32 wilc_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode) msg.id = HOST_IF_MSG_DISCONNECT; msg.drv = hif_drv; + msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) @@ -3517,7 +3542,8 @@ static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, return result; } -int wilc_set_mac_chnl_num(struct host_if_drv *hif_drv, u8 channel) +int wilc_set_mac_chnl_num(struct wilc_vif *vif, struct host_if_drv *hif_drv, + u8 channel) { int result; struct host_if_msg msg; @@ -3531,6 +3557,7 @@ int wilc_set_mac_chnl_num(struct host_if_drv *hif_drv, u8 channel) msg.id = HOST_IF_MSG_SET_CHANNEL; msg.body.channel_info.set_ch = channel; msg.drv = hif_drv; + msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) { @@ -3559,7 +3586,7 @@ int wilc_wait_msg_queue_idle(void) return result; } -int wilc_set_wfi_drv_handler(struct host_if_drv *hif_drv) +int wilc_set_wfi_drv_handler(struct wilc_vif *vif, struct host_if_drv *hif_drv) { int result = 0; struct host_if_msg msg; @@ -3568,6 +3595,7 @@ int wilc_set_wfi_drv_handler(struct host_if_drv *hif_drv) msg.id = HOST_IF_MSG_SET_WFIDRV_HANDLER; msg.body.drv.handler = get_id_from_handler(hif_drv); msg.drv = hif_drv; + msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) { @@ -3578,7 +3606,8 @@ int wilc_set_wfi_drv_handler(struct host_if_drv *hif_drv) return result; } -int wilc_set_operation_mode(struct host_if_drv *hif_drv, u32 mode) +int wilc_set_operation_mode(struct wilc_vif *vif, struct host_if_drv *hif_drv, + u32 mode) { int result = 0; struct host_if_msg msg; @@ -3587,6 +3616,7 @@ int wilc_set_operation_mode(struct host_if_drv *hif_drv, u32 mode) msg.id = HOST_IF_MSG_SET_OPERATION_MODE; msg.body.mode.mode = mode; msg.drv = hif_drv; + msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) { @@ -3597,7 +3627,7 @@ int wilc_set_operation_mode(struct host_if_drv *hif_drv, u32 mode) return result; } -s32 wilc_get_inactive_time(struct host_if_drv *hif_drv, +s32 wilc_get_inactive_time(struct wilc_vif *vif, struct host_if_drv *hif_drv, const u8 *mac, u32 *pu32InactiveTime) { s32 result = 0; @@ -3613,6 +3643,7 @@ s32 wilc_get_inactive_time(struct host_if_drv *hif_drv, msg.id = HOST_IF_MSG_GET_INACTIVETIME; msg.drv = hif_drv; + msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) @@ -3625,7 +3656,8 @@ s32 wilc_get_inactive_time(struct host_if_drv *hif_drv, return result; } -s32 wilc_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi) +s32 wilc_get_rssi(struct wilc_vif *vif, struct host_if_drv *hif_drv, + s8 *ps8Rssi) { s32 result = 0; struct host_if_msg msg; @@ -3633,6 +3665,7 @@ s32 wilc_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi) memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_GET_RSSI; msg.drv = hif_drv; + msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) { @@ -3652,7 +3685,8 @@ s32 wilc_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi) return result; } -s32 wilc_get_statistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics) +s32 wilc_get_statistics(struct wilc_vif *vif, struct host_if_drv *hif_drv, + struct rf_info *pstrStatistics) { s32 result = 0; struct host_if_msg msg; @@ -3661,6 +3695,7 @@ s32 wilc_get_statistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatist msg.id = HOST_IF_MSG_GET_STATISTICS; msg.body.data = (char *)pstrStatistics; msg.drv = hif_drv; + msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) { @@ -3672,11 +3707,11 @@ s32 wilc_get_statistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatist return result; } -s32 wilc_scan(struct host_if_drv *hif_drv, u8 u8ScanSource, - u8 u8ScanType, u8 *pu8ChnlFreqList, - u8 u8ChnlListLen, const u8 *pu8IEs, - size_t IEsLen, wilc_scan_result ScanResult, - void *pvUserArg, struct hidden_network *pstrHiddenNetwork) +s32 wilc_scan(struct wilc_vif *vif, struct host_if_drv *hif_drv, + u8 u8ScanSource, u8 u8ScanType, u8 *pu8ChnlFreqList, + u8 u8ChnlListLen, const u8 *pu8IEs, + size_t IEsLen, wilc_scan_result ScanResult, + void *pvUserArg, struct hidden_network *pstrHiddenNetwork) { s32 result = 0; struct host_if_msg msg; @@ -3698,6 +3733,7 @@ s32 wilc_scan(struct host_if_drv *hif_drv, u8 u8ScanSource, PRINT_D(HOSTINF_DBG, "pstrHiddenNetwork IS EQUAL TO NULL\n"); msg.drv = hif_drv; + msg.vif = vif; msg.body.scan_info.src = u8ScanSource; msg.body.scan_info.type = u8ScanType; msg.body.scan_info.result = ScanResult; @@ -3725,7 +3761,7 @@ s32 wilc_scan(struct host_if_drv *hif_drv, u8 u8ScanSource, return result; } -s32 wilc_hif_set_cfg(struct host_if_drv *hif_drv, +s32 wilc_hif_set_cfg(struct wilc_vif *vif, struct host_if_drv *hif_drv, struct cfg_param_val *pstrCfgParamVal) { s32 result = 0; @@ -3740,6 +3776,7 @@ s32 wilc_hif_set_cfg(struct host_if_drv *hif_drv, msg.id = HOST_IF_MSG_CFG_PARAMS; msg.body.cfg_info.cfg_attr_info = *pstrCfgParamVal; msg.drv = hif_drv; + msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -3882,7 +3919,7 @@ _fail_: return result; } -s32 wilc_deinit(struct host_if_drv *hif_drv) +s32 wilc_deinit(struct wilc_vif *vif, struct host_if_drv *hif_drv) { s32 result = 0; struct host_if_msg msg; @@ -3909,7 +3946,7 @@ s32 wilc_deinit(struct host_if_drv *hif_drv) del_timer_sync(&hif_drv->remain_on_ch_timer); - wilc_set_wfi_drv_handler(NULL); + wilc_set_wfi_drv_handler(vif, NULL); down(&hif_sema_driver); if (hif_drv->usr_scan_req.scan_result) { @@ -3930,6 +3967,7 @@ s32 wilc_deinit(struct host_if_drv *hif_drv) msg.id = HOST_IF_MSG_EXIT; msg.drv = hif_drv; + msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result != 0) @@ -4051,11 +4089,11 @@ void wilc_scan_complete_received(u8 *pu8Buffer, u32 u32Length) return; } -s32 wilc_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID, - u32 u32duration, u16 chan, - wilc_remain_on_chan_expired RemainOnChanExpired, - wilc_remain_on_chan_ready RemainOnChanReady, - void *pvUserArg) +s32 wilc_remain_on_channel(struct wilc_vif *vif, struct host_if_drv *hif_drv, + u32 u32SessionID, u32 u32duration, u16 chan, + wilc_remain_on_chan_expired RemainOnChanExpired, + wilc_remain_on_chan_ready RemainOnChanReady, + void *pvUserArg) { s32 result = 0; struct host_if_msg msg; @@ -4075,6 +4113,7 @@ s32 wilc_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID, msg.body.remain_on_ch.u32duration = u32duration; msg.body.remain_on_ch.id = u32SessionID; msg.drv = hif_drv; + msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) @@ -4083,7 +4122,8 @@ s32 wilc_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID, return result; } -s32 wilc_listen_state_expired(struct host_if_drv *hif_drv, u32 u32SessionID) +s32 wilc_listen_state_expired(struct wilc_vif *vif, + struct host_if_drv *hif_drv, u32 u32SessionID) { s32 result = 0; struct host_if_msg msg; @@ -4098,6 +4138,7 @@ s32 wilc_listen_state_expired(struct host_if_drv *hif_drv, u32 u32SessionID) memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; msg.drv = hif_drv; + msg.vif = vif; msg.body.remain_on_ch.id = u32SessionID; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -4107,7 +4148,8 @@ s32 wilc_listen_state_expired(struct host_if_drv *hif_drv, u32 u32SessionID) return result; } -s32 wilc_frame_register(struct host_if_drv *hif_drv, u16 u16FrameType, bool bReg) +s32 wilc_frame_register(struct wilc_vif *vif, struct host_if_drv *hif_drv, + u16 u16FrameType, bool bReg) { s32 result = 0; struct host_if_msg msg; @@ -4138,6 +4180,7 @@ s32 wilc_frame_register(struct host_if_drv *hif_drv, u16 u16FrameType, bool bReg msg.body.reg_frame.frame_type = u16FrameType; msg.body.reg_frame.reg = bReg; msg.drv = hif_drv; + msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) @@ -4146,9 +4189,10 @@ s32 wilc_frame_register(struct host_if_drv *hif_drv, u16 u16FrameType, bool bReg return result; } -s32 wilc_add_beacon(struct host_if_drv *hif_drv, u32 u32Interval, - u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head, - u32 u32TailLen, u8 *pu8Tail) +s32 wilc_add_beacon(struct wilc_vif *vif, struct host_if_drv *hif_drv, + u32 u32Interval, + u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head, + u32 u32TailLen, u8 *pu8Tail) { s32 result = 0; struct host_if_msg msg; @@ -4165,6 +4209,7 @@ s32 wilc_add_beacon(struct host_if_drv *hif_drv, u32 u32Interval, msg.id = HOST_IF_MSG_ADD_BEACON; msg.drv = hif_drv; + msg.vif = vif; pstrSetBeaconParam->interval = u32Interval; pstrSetBeaconParam->dtim_period = u32DTIMPeriod; pstrSetBeaconParam->head_len = u32HeadLen; @@ -4200,7 +4245,7 @@ ERRORHANDLER: return result; } -int wilc_del_beacon(struct host_if_drv *hif_drv) +int wilc_del_beacon(struct wilc_vif *vif, struct host_if_drv *hif_drv) { int result = 0; struct host_if_msg msg; @@ -4212,6 +4257,7 @@ int wilc_del_beacon(struct host_if_drv *hif_drv) msg.id = HOST_IF_MSG_DEL_BEACON; msg.drv = hif_drv; + msg.vif = vif; PRINT_D(HOSTINF_DBG, "Setting deleting beacon message queue params\n"); result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -4221,7 +4267,7 @@ int wilc_del_beacon(struct host_if_drv *hif_drv) return result; } -int wilc_add_station(struct host_if_drv *hif_drv, +int wilc_add_station(struct wilc_vif *vif, struct host_if_drv *hif_drv, struct add_sta_param *sta_param) { int result = 0; @@ -4239,6 +4285,7 @@ int wilc_add_station(struct host_if_drv *hif_drv, msg.id = HOST_IF_MSG_ADD_STATION; msg.drv = hif_drv; + msg.vif = vif; memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param)); if (add_sta_info->rates_len > 0) { @@ -4255,7 +4302,8 @@ int wilc_add_station(struct host_if_drv *hif_drv, return result; } -int wilc_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr) +int wilc_del_station(struct wilc_vif *vif, struct host_if_drv *hif_drv, + const u8 *mac_addr) { int result = 0; struct host_if_msg msg; @@ -4272,6 +4320,7 @@ int wilc_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr) msg.id = HOST_IF_MSG_DEL_STATION; msg.drv = hif_drv; + msg.vif = vif; if (!mac_addr) eth_broadcast_addr(del_sta_info->mac_addr); @@ -4284,7 +4333,7 @@ int wilc_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr) return result; } -s32 wilc_del_allstation(struct host_if_drv *hif_drv, +s32 wilc_del_allstation(struct wilc_vif *vif, struct host_if_drv *hif_drv, u8 pu8MacAddr[][ETH_ALEN]) { s32 result = 0; @@ -4305,6 +4354,7 @@ s32 wilc_del_allstation(struct host_if_drv *hif_drv, msg.id = HOST_IF_MSG_DEL_ALL_STA; msg.drv = hif_drv; + msg.vif = vif; for (i = 0; i < MAX_NUM_STA; i++) { if (memcmp(pu8MacAddr[i], au8Zero_Buff, ETH_ALEN)) { @@ -4335,7 +4385,7 @@ s32 wilc_del_allstation(struct host_if_drv *hif_drv, return result; } -s32 wilc_edit_station(struct host_if_drv *hif_drv, +s32 wilc_edit_station(struct wilc_vif *vif, struct host_if_drv *hif_drv, struct add_sta_param *pstrStaParams) { s32 result = 0; @@ -4353,6 +4403,7 @@ s32 wilc_edit_station(struct host_if_drv *hif_drv, msg.id = HOST_IF_MSG_EDIT_STATION; msg.drv = hif_drv; + msg.vif = vif; memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param)); if (pstrAddStationMsg->rates_len > 0) { @@ -4373,9 +4424,8 @@ s32 wilc_edit_station(struct host_if_drv *hif_drv, return result; } -s32 wilc_set_power_mgmt(struct host_if_drv *hif_drv, - bool bIsEnabled, - u32 u32Timeout) +s32 wilc_set_power_mgmt(struct wilc_vif *vif, struct host_if_drv *hif_drv, + bool bIsEnabled, u32 u32Timeout) { s32 result = 0; struct host_if_msg msg; @@ -4394,6 +4444,7 @@ s32 wilc_set_power_mgmt(struct host_if_drv *hif_drv, msg.id = HOST_IF_MSG_POWER_MGMT; msg.drv = hif_drv; + msg.vif = vif; pstrPowerMgmtParam->enabled = bIsEnabled; pstrPowerMgmtParam->timeout = u32Timeout; @@ -4404,9 +4455,10 @@ s32 wilc_set_power_mgmt(struct host_if_drv *hif_drv, return result; } -s32 wilc_setup_multicast_filter(struct host_if_drv *hif_drv, - bool bIsEnabled, - u32 u32count) +s32 wilc_setup_multicast_filter(struct wilc_vif *vif, + struct host_if_drv *hif_drv, + bool bIsEnabled, + u32 u32count) { s32 result = 0; struct host_if_msg msg; @@ -4423,6 +4475,7 @@ s32 wilc_setup_multicast_filter(struct host_if_drv *hif_drv, msg.id = HOST_IF_MSG_SET_MULTICAST_FILTER; msg.drv = hif_drv; + msg.vif = vif; pstrMulticastFilterParam->enabled = bIsEnabled; pstrMulticastFilterParam->cnt = u32count; @@ -4598,9 +4651,10 @@ void wilc_free_join_params(void *pJoinParams) PRINT_ER("Unable to FREE null pointer\n"); } -s32 wilc_del_all_rx_ba_session(struct host_if_drv *hif_drv, - char *pBSSID, - char TID) +s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif, + struct host_if_drv *hif_drv, + char *pBSSID, + char TID) { s32 result = 0; struct host_if_msg msg; @@ -4618,6 +4672,7 @@ s32 wilc_del_all_rx_ba_session(struct host_if_drv *hif_drv, memcpy(pBASessionInfo->bssid, pBSSID, ETH_ALEN); pBASessionInfo->tid = TID; msg.drv = hif_drv; + msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) @@ -4628,7 +4683,8 @@ s32 wilc_del_all_rx_ba_session(struct host_if_drv *hif_drv, return result; } -s32 wilc_setup_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx) +s32 wilc_setup_ipaddress(struct wilc_vif *vif, struct host_if_drv *hif_drv, + u8 *u16ipadd, u8 idx) { s32 result = 0; struct host_if_msg msg; @@ -4646,6 +4702,7 @@ s32 wilc_setup_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx) msg.body.ip_info.ip_addr = u16ipadd; msg.drv = hif_drv; + msg.vif = vif; msg.body.ip_info.idx = idx; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -4655,7 +4712,9 @@ s32 wilc_setup_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx) return result; } -static s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx) +static s32 host_int_get_ipaddress(struct wilc_vif *vif, + struct host_if_drv *hif_drv, + u8 *u16ipadd, u8 idx) { s32 result = 0; struct host_if_msg msg; @@ -4671,6 +4730,7 @@ static s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 msg.body.ip_info.ip_addr = u16ipadd; msg.drv = hif_drv; + msg.vif = vif; msg.body.ip_info.idx = idx; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 4f5300d096eb..ccbbe73c7ee5 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -305,97 +305,104 @@ struct add_sta_param { u16 flags_set; }; +struct wilc_vif; s32 wilc_remove_key(struct host_if_drv *hWFIDrv, const u8 *pu8StaAddress); -int wilc_remove_wep_key(struct host_if_drv *wfi_drv, u8 index); -int wilc_set_wep_default_keyid(struct host_if_drv *hif_drv, u8 index); -int wilc_add_wep_key_bss_sta(struct host_if_drv *hif_drv, - const u8 *key, u8 len, u8 index); -int wilc_add_wep_key_bss_ap(struct host_if_drv *hif_drv, - const u8 *key, u8 len, u8 index, u8 mode, - enum AUTHTYPE auth_type); -s32 wilc_add_ptk(struct host_if_drv *hWFIDrv, const u8 *pu8Ptk, - u8 u8PtkKeylen, const u8 *mac_addr, - const u8 *pu8RxMic, const u8 *pu8TxMic, - u8 mode, u8 u8Ciphermode, u8 u8Idx); -s32 wilc_get_inactive_time(struct host_if_drv *hWFIDrv, const u8 *mac, - u32 *pu32InactiveTime); -s32 wilc_add_rx_gtk(struct host_if_drv *hWFIDrv, const u8 *pu8RxGtk, - u8 u8GtkKeylen, u8 u8KeyIdx, - u32 u32KeyRSClen, const u8 *KeyRSC, - const u8 *pu8RxMic, const u8 *pu8TxMic, - u8 mode, u8 u8Ciphermode); +int wilc_remove_wep_key(struct wilc_vif *vif, + struct host_if_drv *hif_drv, u8 index); +int wilc_set_wep_default_keyid(struct wilc_vif *vif, + struct host_if_drv *hif_drv, u8 index); +int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, struct host_if_drv *hif_drv, + const u8 *key, u8 len, u8 index); +int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, struct host_if_drv *hif_drv, + const u8 *key, u8 len, u8 index, u8 mode, + enum AUTHTYPE auth_type); +s32 wilc_add_ptk(struct wilc_vif *vif, struct host_if_drv *hif_drv, + const u8 *pu8Ptk, u8 u8PtkKeylen, const u8 *mac_addr, + const u8 *pu8RxMic, const u8 *pu8TxMic, + u8 mode, u8 u8Ciphermode, u8 u8Idx); +s32 wilc_get_inactive_time(struct wilc_vif *vif, struct host_if_drv *hif_drv, + const u8 *mac, u32 *pu32InactiveTime); +s32 wilc_add_rx_gtk(struct wilc_vif *vif, struct host_if_drv *hif_drv, + const u8 *pu8RxGtk, u8 u8GtkKeylen, u8 u8KeyIdx, + u32 u32KeyRSClen, const u8 *KeyRSC, + const u8 *pu8RxMic, const u8 *pu8TxMic, + u8 mode, u8 u8Ciphermode); s32 wilc_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk, u8 u8KeyIdx); -s32 wilc_set_pmkid_info(struct host_if_drv *hWFIDrv, - struct host_if_pmkid_attr *pu8PmkidInfoArray); -s32 wilc_get_mac_address(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress); -s32 wilc_set_mac_address(struct host_if_drv *hWFIDrv, u8 *pu8MacAddress); +s32 wilc_set_pmkid_info(struct wilc_vif *vif, struct host_if_drv *hif_drv, + struct host_if_pmkid_attr *pu8PmkidInfoArray); +s32 wilc_get_mac_address(struct wilc_vif *vif, struct host_if_drv *hif_drv, + u8 *pu8MacAddress); +s32 wilc_set_mac_address(struct wilc_vif *vif, struct host_if_drv *hif_drv, + u8 *pu8MacAddress); int wilc_wait_msg_queue_idle(void); s32 wilc_set_start_scan_req(struct host_if_drv *hWFIDrv, u8 scanSource); -s32 wilc_set_join_req(struct host_if_drv *hWFIDrv, u8 *pu8bssid, - const u8 *pu8ssid, size_t ssidLen, - const u8 *pu8IEs, size_t IEsLen, - wilc_connect_result pfConnectResult, void *pvUserArg, - u8 u8security, enum AUTHTYPE tenuAuth_type, - u8 u8channel, void *pJoinParams); -s32 wilc_flush_join_req(struct host_if_drv *hWFIDrv); -s32 wilc_disconnect(struct host_if_drv *hWFIDrv, u16 u16ReasonCode); -int wilc_set_mac_chnl_num(struct host_if_drv *wfi_drv, u8 channel); -s32 wilc_get_rssi(struct host_if_drv *hWFIDrv, s8 *ps8Rssi); -s32 wilc_scan(struct host_if_drv *hWFIDrv, u8 u8ScanSource, - u8 u8ScanType, u8 *pu8ChnlFreqList, - u8 u8ChnlListLen, const u8 *pu8IEs, - size_t IEsLen, wilc_scan_result ScanResult, - void *pvUserArg, struct hidden_network *pstrHiddenNetwork); -s32 wilc_hif_set_cfg(struct host_if_drv *hWFIDrv, +s32 wilc_set_join_req(struct wilc_vif *vif, struct host_if_drv *hif_drv, + u8 *pu8bssid, const u8 *pu8ssid, size_t ssidLen, + const u8 *pu8IEs, size_t IEsLen, + wilc_connect_result pfConnectResult, void *pvUserArg, + u8 u8security, enum AUTHTYPE tenuAuth_type, + u8 u8channel, void *pJoinParams); +s32 wilc_flush_join_req(struct wilc_vif *vif, struct host_if_drv *hif_drv); +s32 wilc_disconnect(struct wilc_vif *vif, struct host_if_drv *hif_drv, + u16 u16ReasonCode); +int wilc_set_mac_chnl_num(struct wilc_vif *vif, struct host_if_drv *hif_drv, + u8 channel); +s32 wilc_get_rssi(struct wilc_vif *vif, struct host_if_drv *hif_drv, + s8 *ps8Rssi); +s32 wilc_scan(struct wilc_vif *vif, struct host_if_drv *hif_drv, + u8 u8ScanSource, u8 u8ScanType, u8 *pu8ChnlFreqList, + u8 u8ChnlListLen, const u8 *pu8IEs, + size_t IEsLen, wilc_scan_result ScanResult, + void *pvUserArg, struct hidden_network *pstrHiddenNetwork); +s32 wilc_hif_set_cfg(struct wilc_vif *vif, struct host_if_drv *hif_drv, struct cfg_param_val *pstrCfgParamVal); s32 wilc_init(struct net_device *dev, struct host_if_drv **phWFIDrv); -s32 wilc_deinit(struct host_if_drv *hWFIDrv); -s32 wilc_add_beacon(struct host_if_drv *hWFIDrv, u32 u32Interval, - u32 u32DTIMPeriod, - u32 u32HeadLen, - u8 *pu8Head, - u32 u32TailLen, - u8 *pu8tail); -int wilc_del_beacon(struct host_if_drv *hif_drv); -int wilc_add_station(struct host_if_drv *hif_drv, - struct add_sta_param *sta_param); -s32 wilc_del_allstation(struct host_if_drv *hWFIDrv, +s32 wilc_deinit(struct wilc_vif *vif, struct host_if_drv *hif_drv); +s32 wilc_add_beacon(struct wilc_vif *vif, struct host_if_drv *hif_drv, + u32 u32Interval, + u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head, + u32 u32TailLen, u8 *pu8Tail); +int wilc_del_beacon(struct wilc_vif *vif, struct host_if_drv *hif_drv); +int wilc_add_station(struct wilc_vif *vif, struct host_if_drv *hif_drv, + struct add_sta_param *sta_param); +s32 wilc_del_allstation(struct wilc_vif *vif, struct host_if_drv *hif_drv, u8 pu8MacAddr[][ETH_ALEN]); -int wilc_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr); -s32 wilc_edit_station(struct host_if_drv *hWFIDrv, +int wilc_del_station(struct wilc_vif *vif, struct host_if_drv *hif_drv, + const u8 *mac_addr); +s32 wilc_edit_station(struct wilc_vif *vif, struct host_if_drv *hif_drv, struct add_sta_param *pstrStaParams); -s32 wilc_set_power_mgmt(struct host_if_drv *hWFIDrv, - bool bIsEnabled, - u32 u32Timeout); -s32 wilc_setup_multicast_filter(struct host_if_drv *hWFIDrv, - bool bIsEnabled, - u32 u32count); -s32 wilc_setup_ipaddress(struct host_if_drv *hWFIDrv, - u8 *pu8IPAddr, - u8 idx); -s32 wilc_del_all_rx_ba_session(struct host_if_drv *hWFIDrv, - char *pBSSID, - char TID); -s32 wilc_remain_on_channel(struct host_if_drv *hWFIDrv, - u32 u32SessionID, - u32 u32duration, - u16 chan, - wilc_remain_on_chan_expired RemainOnChanExpired, - wilc_remain_on_chan_ready RemainOnChanReady, - void *pvUserArg); -s32 wilc_listen_state_expired(struct host_if_drv *hWFIDrv, u32 u32SessionID); -s32 wilc_frame_register(struct host_if_drv *hWFIDrv, - u16 u16FrameType, - bool bReg); -int wilc_set_wfi_drv_handler(struct host_if_drv *address); -int wilc_set_operation_mode(struct host_if_drv *wfi_drv, u32 mode); +s32 wilc_set_power_mgmt(struct wilc_vif *vif, struct host_if_drv *hif_drv, + bool bIsEnabled, u32 u32Timeout); +s32 wilc_setup_multicast_filter(struct wilc_vif *vif, + struct host_if_drv *hif_drv, + bool bIsEnabled, + u32 u32count); +s32 wilc_setup_ipaddress(struct wilc_vif *vif, struct host_if_drv *hif_drv, + u8 *u16ipadd, u8 idx); +s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif, + struct host_if_drv *hif_drv, + char *pBSSID, + char TID); +s32 wilc_remain_on_channel(struct wilc_vif *vif, struct host_if_drv *hif_drv, + u32 u32SessionID, u32 u32duration, u16 chan, + wilc_remain_on_chan_expired RemainOnChanExpired, + wilc_remain_on_chan_ready RemainOnChanReady, + void *pvUserArg); +s32 wilc_listen_state_expired(struct wilc_vif *vif, + struct host_if_drv *hif_drv, u32 u32SessionID); +s32 wilc_frame_register(struct wilc_vif *vif, struct host_if_drv *hif_drv, + u16 u16FrameType, bool bReg); +int wilc_set_wfi_drv_handler(struct wilc_vif *vif, struct host_if_drv *hif_drv); +int wilc_set_operation_mode(struct wilc_vif *vif, struct host_if_drv *hif_drv, + u32 mode); void wilc_free_join_params(void *pJoinParams); -s32 wilc_get_statistics(struct host_if_drv *hWFIDrv, - struct rf_info *pstrStatistics); -void wilc_resolve_disconnect_aberration(struct host_if_drv *hif_drv); +s32 wilc_get_statistics(struct wilc_vif *vif, struct host_if_drv *hif_drv, + struct rf_info *pstrStatistics); +void wilc_resolve_disconnect_aberration(struct wilc_vif *vif, + struct host_if_drv *hif_drv); extern bool wilc_optaining_ip; extern u8 wilc_connected_ssid[6]; diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index bb3ff49e8e67..60749962ed5a 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -112,7 +112,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event } if (wilc_enable_ps) - wilc_set_power_mgmt(hif_drv, 1, 0); + wilc_set_power_mgmt(vif, hif_drv, 1, 0); PRINT_D(GENERIC_DBG, "[%s] Up IP\n", dev_iface->ifa_label); @@ -120,7 +120,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n", ip_addr_buf[0], ip_addr_buf[1], ip_addr_buf[2], ip_addr_buf[3]); - wilc_setup_ipaddress(hif_drv, ip_addr_buf, vif->u8IfIdx); + wilc_setup_ipaddress(vif, hif_drv, ip_addr_buf, vif->u8IfIdx); break; @@ -134,9 +134,9 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event } if (memcmp(dev_iface->ifa_label, wlan_dev_name, 5) == 0) - wilc_set_power_mgmt(hif_drv, 0, 0); + wilc_set_power_mgmt(vif, hif_drv, 0, 0); - wilc_resolve_disconnect_aberration(hif_drv); + wilc_resolve_disconnect_aberration(vif, hif_drv); PRINT_D(GENERIC_DBG, "[%s] Down IP\n", dev_iface->ifa_label); @@ -145,7 +145,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event ip_addr_buf[0], ip_addr_buf[1], ip_addr_buf[2], ip_addr_buf[3]); - wilc_setup_ipaddress(hif_drv, ip_addr_buf, vif->u8IfIdx); + wilc_setup_ipaddress(vif, hif_drv, ip_addr_buf, vif->u8IfIdx); break; @@ -1030,7 +1030,7 @@ int wilc_mac_open(struct net_device *ndev) wilc_set_machw_change_vir_if(ndev, false); - wilc_get_mac_address(priv->hWILCWFIDrv, mac_add); + wilc_get_mac_address(vif, priv->hWILCWFIDrv, mac_add); PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add); for (i = 0; i < wl->vif_num; i++) { @@ -1076,9 +1076,11 @@ static void wilc_set_multicast_list(struct net_device *dev) struct netdev_hw_addr *ha; struct wilc_priv *priv; struct host_if_drv *hif_drv; + struct wilc_vif *vif; int i = 0; priv = wiphy_priv(dev->ieee80211_ptr->wiphy); + vif = netdev_priv(dev); hif_drv = (struct host_if_drv *)priv->hWILCWFIDrv; if (!dev) @@ -1095,13 +1097,13 @@ static void wilc_set_multicast_list(struct net_device *dev) if ((dev->flags & IFF_ALLMULTI) || (dev->mc.count) > WILC_MULTICAST_TABLE_SIZE) { PRINT_D(INIT_DBG, "Disable multicast filter, retrive all multicast packets\n"); - wilc_setup_multicast_filter(hif_drv, false, 0); + wilc_setup_multicast_filter(vif, hif_drv, false, 0); return; } if ((dev->mc.count) == 0) { PRINT_D(INIT_DBG, "Enable multicast filter, retrive directed packets only.\n"); - wilc_setup_multicast_filter(hif_drv, true, 0); + wilc_setup_multicast_filter(vif, hif_drv, true, 0); return; } @@ -1117,7 +1119,7 @@ static void wilc_set_multicast_list(struct net_device *dev) i++; } - wilc_setup_multicast_filter(hif_drv, true, (dev->mc.count)); + wilc_setup_multicast_filter(vif, hif_drv, true, (dev->mc.count)); return; } @@ -1289,7 +1291,7 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) if (strncasecmp(buff, "RSSI", length) == 0) { priv = wiphy_priv(vif->ndev->ieee80211_ptr->wiphy); - ret = wilc_get_rssi(priv->hWILCWFIDrv, &rssi); + ret = wilc_get_rssi(vif, priv->hWILCWFIDrv, &rssi); if (ret) PRINT_ER("Failed to send get rssi param's message queue "); PRINT_INFO(GENERIC_DBG, "RSSI :%d\n", rssi); diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 87f8d0db3579..309a0cc6446e 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -595,14 +595,16 @@ static int set_channel(struct wiphy *wiphy, u32 channelnum = 0; struct wilc_priv *priv; int result = 0; + struct wilc_vif *vif; priv = wiphy_priv(wiphy); + vif = netdev_priv(priv->dev); channelnum = ieee80211_frequency_to_channel(chandef->chan->center_freq); PRINT_D(CFG80211_DBG, "Setting channel %d with frequency %d\n", channelnum, chandef->chan->center_freq); curr_channel = channelnum; - result = wilc_set_mac_chnl_num(priv->hWILCWFIDrv, channelnum); + result = wilc_set_mac_chnl_num(vif, priv->hWILCWFIDrv, channelnum); if (result != 0) PRINT_ER("Error in setting channel %d\n", channelnum); @@ -617,14 +619,16 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) s32 s32Error = 0; u8 au8ScanChanList[MAX_NUM_SCANNED_NETWORKS]; struct hidden_network strHiddenNetwork; + struct wilc_vif *vif; priv = wiphy_priv(wiphy); + vif = netdev_priv(priv->dev); priv->pstrScanReq = request; priv->u32RcvdChCount = 0; - wilc_set_wfi_drv_handler(priv->hWILCWFIDrv); + wilc_set_wfi_drv_handler(vif, priv->hWILCWFIDrv); reset_shadow_found(); priv->bCfgScanning = true; @@ -656,13 +660,13 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) } } PRINT_D(CFG80211_DBG, "Trigger Scan Request\n"); - s32Error = wilc_scan(priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN, + s32Error = wilc_scan(vif, priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN, au8ScanChanList, request->n_channels, (const u8 *)request->ie, request->ie_len, CfgScanResult, (void *)priv, &strHiddenNetwork); } else { PRINT_D(CFG80211_DBG, "Trigger Scan Request\n"); - s32Error = wilc_scan(priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN, + s32Error = wilc_scan(vif, priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN, au8ScanChanList, request->n_channels, (const u8 *)request->ie, request->ie_len, CfgScanResult, (void *)priv, NULL); @@ -694,13 +698,14 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, struct wilc_priv *priv; struct host_if_drv *pstrWFIDrv; tstrNetworkInfo *pstrNetworkInfo = NULL; - + struct wilc_vif *vif; wilc_connecting = 1; priv = wiphy_priv(wiphy); + vif = netdev_priv(priv->dev); pstrWFIDrv = (struct host_if_drv *)(priv->hWILCWFIDrv); - wilc_set_wfi_drv_handler(priv->hWILCWFIDrv); + wilc_set_wfi_drv_handler(vif, priv->hWILCWFIDrv); PRINT_D(CFG80211_DBG, "Connecting to SSID [%s] on netdev [%p] host if [%p]\n", sme->ssid, dev, priv->hWILCWFIDrv); if (!(strncmp(sme->ssid, "DIRECT-", 7))) { @@ -787,8 +792,8 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, g_key_wep_params.key_idx = sme->key_idx; g_wep_keys_saved = true; - wilc_set_wep_default_keyid(priv->hWILCWFIDrv, sme->key_idx); - wilc_add_wep_key_bss_sta(priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx); + wilc_set_wep_default_keyid(vif, priv->hWILCWFIDrv, sme->key_idx); + wilc_add_wep_key_bss_sta(vif, priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx); } else if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_WEP104) { u8security = ENCRYPT_ENABLED | WEP | WEP_EXTENDED; pcgroup_encrypt_val = "WEP104"; @@ -804,8 +809,8 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, g_key_wep_params.key_idx = sme->key_idx; g_wep_keys_saved = true; - wilc_set_wep_default_keyid(priv->hWILCWFIDrv, sme->key_idx); - wilc_add_wep_key_bss_sta(priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx); + wilc_set_wep_default_keyid(vif, priv->hWILCWFIDrv, sme->key_idx); + wilc_add_wep_key_bss_sta(vif, priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx); } else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) { if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_TKIP) { u8security = ENCRYPT_ENABLED | WPA2 | TKIP; @@ -890,7 +895,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, wilc_wlan_set_bssid(dev, pstrNetworkInfo->au8bssid); - s32Error = wilc_set_join_req(priv->hWILCWFIDrv, pstrNetworkInfo->au8bssid, sme->ssid, + s32Error = wilc_set_join_req(vif, priv->hWILCWFIDrv, pstrNetworkInfo->au8bssid, sme->ssid, sme->ssid_len, sme->ie, sme->ie_len, CfgConnectResult, (void *)priv, u8security, tenuAuth_type, pstrNetworkInfo->u8channel, @@ -911,10 +916,12 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co s32 s32Error = 0; struct wilc_priv *priv; struct host_if_drv *pstrWFIDrv; + struct wilc_vif *vif; u8 NullBssid[ETH_ALEN] = {0}; wilc_connecting = 0; priv = wiphy_priv(wiphy); + vif = netdev_priv(priv->dev); pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv; if (!pstrWFIDrv->p2p_connect) @@ -928,7 +935,7 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co wilc_ie = false; pstrWFIDrv->p2p_timeout = 0; - s32Error = wilc_disconnect(priv->hWILCWFIDrv, reason_code); + s32Error = wilc_disconnect(vif, priv->hWILCWFIDrv, reason_code); if (s32Error != 0) { PRINT_ER("Error in disconnecting: Error(%d)\n", s32Error); s32Error = -EINVAL; @@ -988,7 +995,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, else u8mode = ENCRYPT_ENABLED | WEP | WEP_EXTENDED; - wilc_add_wep_key_bss_ap(priv->hWILCWFIDrv, params->key, params->key_len, key_index, u8mode, tenuAuth_type); + wilc_add_wep_key_bss_ap(vif, priv->hWILCWFIDrv, params->key, params->key_len, key_index, u8mode, tenuAuth_type); break; } if (memcmp(params->key, priv->WILC_WFI_wep_key[key_index], params->key_len)) { @@ -1002,7 +1009,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, for (i = 0; i < params->key_len; i++) PRINT_INFO(CFG80211_DBG, "WEP key value[%d] = %d\n", i, params->key[i]); } - wilc_add_wep_key_bss_sta(priv->hWILCWFIDrv, params->key, params->key_len, key_index); + wilc_add_wep_key_bss_sta(vif, priv->hWILCWFIDrv, params->key, params->key_len, key_index); } break; @@ -1059,7 +1066,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, } - wilc_add_rx_gtk(priv->hWILCWFIDrv, params->key, KeyLen, + wilc_add_rx_gtk(vif, priv->hWILCWFIDrv, params->key, KeyLen, key_index, params->seq_len, params->seq, pu8RxMic, pu8TxMic, AP_MODE, u8gmode); } else { @@ -1103,7 +1110,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, priv->wilc_ptk[key_index]->key_len = params->key_len; priv->wilc_ptk[key_index]->seq_len = params->seq_len; - wilc_add_ptk(priv->hWILCWFIDrv, params->key, KeyLen, mac_addr, + wilc_add_ptk(vif, priv->hWILCWFIDrv, params->key, KeyLen, mac_addr, pu8RxMic, pu8TxMic, AP_MODE, u8pmode, key_index); } break; @@ -1143,7 +1150,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, g_gtk_keys_saved = true; } - wilc_add_rx_gtk(priv->hWILCWFIDrv, params->key, KeyLen, + wilc_add_rx_gtk(vif, priv->hWILCWFIDrv, params->key, KeyLen, key_index, params->seq_len, params->seq, pu8RxMic, pu8TxMic, STATION_MODE, u8mode); } else { if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) { @@ -1177,7 +1184,7 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, g_ptk_keys_saved = true; } - wilc_add_ptk(priv->hWILCWFIDrv, params->key, KeyLen, mac_addr, + wilc_add_ptk(vif, priv->hWILCWFIDrv, params->key, KeyLen, mac_addr, pu8RxMic, pu8TxMic, STATION_MODE, u8mode, key_index); PRINT_D(CFG80211_DBG, "Adding pairwise key\n"); if (INFO) { @@ -1254,7 +1261,7 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev, priv->WILC_WFI_wep_key_len[key_index] = 0; PRINT_D(CFG80211_DBG, "Removing WEP key with index = %d\n", key_index); - wilc_remove_wep_key(priv->hWILCWFIDrv, key_index); + wilc_remove_wep_key(vif, priv->hWILCWFIDrv, key_index); } else { PRINT_D(CFG80211_DBG, "Removing all installed keys\n"); wilc_remove_key(priv->hWILCWFIDrv, mac_addr); @@ -1305,14 +1312,15 @@ static int set_default_key(struct wiphy *wiphy, struct net_device *netdev, u8 ke bool unicast, bool multicast) { struct wilc_priv *priv; - + struct wilc_vif *vif; priv = wiphy_priv(wiphy); + vif = netdev_priv(priv->dev); PRINT_D(CFG80211_DBG, "Setting default key with idx = %d\n", key_index); if (key_index != priv->WILC_WFI_wep_default) { - wilc_set_wep_default_keyid(priv->hWILCWFIDrv, key_index); + wilc_set_wep_default_keyid(vif, priv->hWILCWFIDrv, key_index); } return 0; @@ -1348,7 +1356,7 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, sinfo->filled |= BIT(NL80211_STA_INFO_INACTIVE_TIME); - wilc_get_inactive_time(priv->hWILCWFIDrv, mac, &(inactive_time)); + wilc_get_inactive_time(vif, priv->hWILCWFIDrv, mac, &(inactive_time)); sinfo->inactive_time = 1000 * inactive_time; PRINT_D(CFG80211_DBG, "Inactive time %d\n", sinfo->inactive_time); } @@ -1356,7 +1364,7 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, if (vif->iftype == STATION_MODE) { struct rf_info strStatistics; - wilc_get_statistics(priv->hWILCWFIDrv, &strStatistics); + wilc_get_statistics(vif, priv->hWILCWFIDrv, &strStatistics); sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL) | BIT(NL80211_STA_INFO_RX_PACKETS) | @@ -1394,8 +1402,10 @@ static int set_wiphy_params(struct wiphy *wiphy, u32 changed) s32 s32Error = 0; struct cfg_param_val pstrCfgParamVal; struct wilc_priv *priv; + struct wilc_vif *vif; priv = wiphy_priv(wiphy); + vif = netdev_priv(priv->dev); pstrCfgParamVal.flag = 0; PRINT_D(CFG80211_DBG, "Setting Wiphy params\n"); @@ -1425,7 +1435,7 @@ static int set_wiphy_params(struct wiphy *wiphy, u32 changed) } PRINT_D(CFG80211_DBG, "Setting CFG params in the host interface\n"); - s32Error = wilc_hif_set_cfg(priv->hWILCWFIDrv, &pstrCfgParamVal); + s32Error = wilc_hif_set_cfg(vif, priv->hWILCWFIDrv, &pstrCfgParamVal); if (s32Error) PRINT_ER("Error in setting WIPHY PARAMS\n"); @@ -1439,9 +1449,10 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev, u32 i; s32 s32Error = 0; u8 flag = 0; - + struct wilc_vif *vif; struct wilc_priv *priv = wiphy_priv(wiphy); + vif = netdev_priv(priv->dev); PRINT_D(CFG80211_DBG, "Setting PMKSA\n"); @@ -1468,7 +1479,7 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev, if (!s32Error) { PRINT_D(CFG80211_DBG, "Setting pmkid in the host interface\n"); - s32Error = wilc_set_pmkid_info(priv->hWILCWFIDrv, &priv->pmkid_list); + s32Error = wilc_set_pmkid_info(vif, priv->hWILCWFIDrv, &priv->pmkid_list); } return s32Error; } @@ -1758,8 +1769,10 @@ static int remain_on_channel(struct wiphy *wiphy, { s32 s32Error = 0; struct wilc_priv *priv; + struct wilc_vif *vif; priv = wiphy_priv(wiphy); + vif = netdev_priv(priv->dev); PRINT_D(GENERIC_DBG, "Remaining on channel %d\n", chan->hw_value); @@ -1776,7 +1789,7 @@ static int remain_on_channel(struct wiphy *wiphy, priv->strRemainOnChanParams.u32ListenDuration = duration; priv->strRemainOnChanParams.u32ListenSessionID++; - s32Error = wilc_remain_on_channel(priv->hWILCWFIDrv + s32Error = wilc_remain_on_channel(vif, priv->hWILCWFIDrv , priv->strRemainOnChanParams.u32ListenSessionID , duration , chan->hw_value @@ -1793,12 +1806,14 @@ static int cancel_remain_on_channel(struct wiphy *wiphy, { s32 s32Error = 0; struct wilc_priv *priv; + struct wilc_vif *vif; priv = wiphy_priv(wiphy); + vif = netdev_priv(priv->dev); PRINT_D(CFG80211_DBG, "Cancel remain on channel\n"); - s32Error = wilc_listen_state_expired(priv->hWILCWFIDrv, priv->strRemainOnChanParams.u32ListenSessionID); + s32Error = wilc_listen_state_expired(vif, priv->hWILCWFIDrv, priv->strRemainOnChanParams.u32ListenSessionID); return s32Error; } @@ -1846,7 +1861,7 @@ static int mgmt_tx(struct wiphy *wiphy, if (ieee80211_is_probe_resp(mgmt->frame_control)) { PRINT_D(GENERIC_DBG, "TX: Probe Response\n"); PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value); - wilc_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value); + wilc_set_mac_chnl_num(vif, priv->hWILCWFIDrv, chan->hw_value); curr_channel = chan->hw_value; } else if (ieee80211_is_action(mgmt->frame_control)) { PRINT_D(GENERIC_DBG, "ACTION FRAME:%x\n", (u16)mgmt->frame_control); @@ -1856,7 +1871,7 @@ static int mgmt_tx(struct wiphy *wiphy, if (buf[ACTION_SUBTYPE_ID] != PUBLIC_ACT_VENDORSPEC || buf[P2P_PUB_ACTION_SUBTYPE] != GO_NEG_CONF) { PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value); - wilc_set_mac_chnl_num(priv->hWILCWFIDrv, chan->hw_value); + wilc_set_mac_chnl_num(vif, priv->hWILCWFIDrv, chan->hw_value); curr_channel = chan->hw_value; } switch (buf[ACTION_SUBTYPE_ID]) { @@ -2002,7 +2017,7 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev, PRINT_D(GENERIC_DBG, "Return since mac is closed\n"); return; } - wilc_frame_register(priv->hWILCWFIDrv, frame_type, reg); + wilc_frame_register(vif, priv->hWILCWFIDrv, frame_type, reg); } static int set_cqm_rssi_config(struct wiphy *wiphy, struct net_device *dev, @@ -2016,6 +2031,7 @@ static int dump_station(struct wiphy *wiphy, struct net_device *dev, int idx, u8 *mac, struct station_info *sinfo) { struct wilc_priv *priv; + struct wilc_vif *vif; PRINT_D(CFG80211_DBG, "Dumping station information\n"); @@ -2023,10 +2039,11 @@ static int dump_station(struct wiphy *wiphy, struct net_device *dev, return -ENOENT; priv = wiphy_priv(wiphy); + vif = netdev_priv(priv->dev); sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); - wilc_get_rssi(priv->hWILCWFIDrv, &(sinfo->signal)); + wilc_get_rssi(vif, priv->hWILCWFIDrv, &(sinfo->signal)); return 0; } @@ -2035,6 +2052,7 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, bool enabled, int timeout) { struct wilc_priv *priv; + struct wilc_vif *vif; PRINT_D(CFG80211_DBG, " Power save Enabled= %d , TimeOut = %d\n", enabled, timeout); @@ -2042,13 +2060,14 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, return -ENOENT; priv = wiphy_priv(wiphy); + vif = netdev_priv(priv->dev); if (!priv->hWILCWFIDrv) { PRINT_ER("Driver is NULL\n"); return -EIO; } if (wilc_enable_ps) - wilc_set_power_mgmt(priv->hWILCWFIDrv, enabled, timeout); + wilc_set_power_mgmt(vif, priv->hWILCWFIDrv, enabled, timeout); return 0; @@ -2096,7 +2115,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, vif->iftype = STATION_MODE; if (wl->initialized) { - wilc_del_all_rx_ba_session(priv->hWILCWFIDrv, + wilc_del_all_rx_ba_session(vif, priv->hWILCWFIDrv, wl->vif[0]->bssid, TID); wilc_wait_msg_queue_idle(); @@ -2107,21 +2126,21 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, wilc_initialized = 1; vif->iftype = interface_type; - wilc_set_wfi_drv_handler(wl->vif[0]->hif_drv); - wilc_set_mac_address(wl->vif[0]->hif_drv, + wilc_set_wfi_drv_handler(vif, wl->vif[0]->hif_drv); + wilc_set_mac_address(vif, wl->vif[0]->hif_drv, wl->vif[0]->src_addr); - wilc_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE); + wilc_set_operation_mode(vif, priv->hWILCWFIDrv, STATION_MODE); if (g_wep_keys_saved) { - wilc_set_wep_default_keyid(wl->vif[0]->hif_drv, + wilc_set_wep_default_keyid(vif, wl->vif[0]->hif_drv, g_key_wep_params.key_idx); - wilc_add_wep_key_bss_sta(wl->vif[0]->hif_drv, + wilc_add_wep_key_bss_sta(vif, wl->vif[0]->hif_drv, g_key_wep_params.key, g_key_wep_params.key_len, g_key_wep_params.key_idx); } - wilc_flush_join_req(priv->hWILCWFIDrv); + wilc_flush_join_req(vif, priv->hWILCWFIDrv); if (g_ptk_keys_saved && g_gtk_keys_saved) { PRINT_D(CFG80211_DBG, "ptk %x %x %x\n", g_key_ptk_params.key[0], @@ -2149,24 +2168,24 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, for (i = 0; i < num_reg_frame; i++) { PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type, vif->g_struct_frame_reg[i].reg); - wilc_frame_register(priv->hWILCWFIDrv, + wilc_frame_register(vif, priv->hWILCWFIDrv, vif->g_struct_frame_reg[i].frame_type, vif->g_struct_frame_reg[i].reg); } } wilc_enable_ps = true; - wilc_set_power_mgmt(priv->hWILCWFIDrv, 1, 0); + wilc_set_power_mgmt(vif, priv->hWILCWFIDrv, 1, 0); } break; case NL80211_IFTYPE_P2P_CLIENT: wilc_enable_ps = false; - wilc_set_power_mgmt(priv->hWILCWFIDrv, 0, 0); + wilc_set_power_mgmt(vif, priv->hWILCWFIDrv, 0, 0); wilc_connecting = 0; PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_P2P_CLIENT\n"); - wilc_del_all_rx_ba_session(priv->hWILCWFIDrv, + wilc_del_all_rx_ba_session(vif, priv->hWILCWFIDrv, wl->vif[0]->bssid, TID); dev->ieee80211_ptr->iftype = type; @@ -2184,21 +2203,21 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, wilc1000_wlan_init(dev, vif); wilc_initialized = 1; - wilc_set_wfi_drv_handler(wl->vif[0]->hif_drv); - wilc_set_mac_address(wl->vif[0]->hif_drv, + wilc_set_wfi_drv_handler(vif, wl->vif[0]->hif_drv); + wilc_set_mac_address(vif, wl->vif[0]->hif_drv, wl->vif[0]->src_addr); - wilc_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE); + wilc_set_operation_mode(vif, priv->hWILCWFIDrv, STATION_MODE); if (g_wep_keys_saved) { - wilc_set_wep_default_keyid(wl->vif[0]->hif_drv, + wilc_set_wep_default_keyid(vif, wl->vif[0]->hif_drv, g_key_wep_params.key_idx); - wilc_add_wep_key_bss_sta(wl->vif[0]->hif_drv, + wilc_add_wep_key_bss_sta(vif, wl->vif[0]->hif_drv, g_key_wep_params.key, g_key_wep_params.key_len, g_key_wep_params.key_idx); } - wilc_flush_join_req(priv->hWILCWFIDrv); + wilc_flush_join_req(vif, priv->hWILCWFIDrv); if (g_ptk_keys_saved && g_gtk_keys_saved) { PRINT_D(CFG80211_DBG, "ptk %x %x %x\n", g_key_ptk_params.key[0], @@ -2229,7 +2248,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, for (i = 0; i < num_reg_frame; i++) { PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type, vif->g_struct_frame_reg[i].reg); - wilc_frame_register(priv->hWILCWFIDrv, + wilc_frame_register(vif, priv->hWILCWFIDrv, vif->g_struct_frame_reg[i].frame_type, vif->g_struct_frame_reg[i].reg); } @@ -2256,7 +2275,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, for (i = 0; i < num_reg_frame; i++) { PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type, vif->g_struct_frame_reg[i].reg); - wilc_frame_register(priv->hWILCWFIDrv, + wilc_frame_register(vif, priv->hWILCWFIDrv, vif->g_struct_frame_reg[i].frame_type, vif->g_struct_frame_reg[i].reg); } @@ -2269,8 +2288,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, wilc_optaining_ip = true; mod_timer(&wilc_during_ip_timer, jiffies + msecs_to_jiffies(during_ip_time)); - wilc_set_power_mgmt(priv->hWILCWFIDrv, 0, 0); - wilc_del_all_rx_ba_session(priv->hWILCWFIDrv, + wilc_set_power_mgmt(vif, priv->hWILCWFIDrv, 0, 0); + wilc_del_all_rx_ba_session(vif, priv->hWILCWFIDrv, wl->vif[0]->bssid, TID); wilc_enable_ps = false; PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_GO\n"); @@ -2289,21 +2308,21 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, wilc1000_wlan_init(dev, vif); wilc_initialized = 1; - wilc_set_wfi_drv_handler(wl->vif[0]->hif_drv); - wilc_set_mac_address(wl->vif[0]->hif_drv, + wilc_set_wfi_drv_handler(vif, wl->vif[0]->hif_drv); + wilc_set_mac_address(vif, wl->vif[0]->hif_drv, wl->vif[0]->src_addr); - wilc_set_operation_mode(priv->hWILCWFIDrv, AP_MODE); + wilc_set_operation_mode(vif, priv->hWILCWFIDrv, AP_MODE); if (g_wep_keys_saved) { - wilc_set_wep_default_keyid(wl->vif[0]->hif_drv, + wilc_set_wep_default_keyid(vif, wl->vif[0]->hif_drv, g_key_wep_params.key_idx); - wilc_add_wep_key_bss_sta(wl->vif[0]->hif_drv, + wilc_add_wep_key_bss_sta(vif, wl->vif[0]->hif_drv, g_key_wep_params.key, g_key_wep_params.key_len, g_key_wep_params.key_idx); } - wilc_flush_join_req(priv->hWILCWFIDrv); + wilc_flush_join_req(vif, priv->hWILCWFIDrv); if (g_ptk_keys_saved && g_gtk_keys_saved) { PRINT_D(CFG80211_DBG, "ptk %x %x %x cipher %x\n", g_key_ptk_params.key[0], @@ -2333,7 +2352,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, for (i = 0; i < num_reg_frame; i++) { PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type, vif->g_struct_frame_reg[i].reg); - wilc_frame_register(priv->hWILCWFIDrv, + wilc_frame_register(vif, priv->hWILCWFIDrv, vif->g_struct_frame_reg[i].frame_type, vif->g_struct_frame_reg[i].reg); } @@ -2372,7 +2391,7 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev, wilc_wlan_set_bssid(dev, wl->vif[0]->src_addr); - s32Error = wilc_add_beacon(priv->hWILCWFIDrv, + s32Error = wilc_add_beacon(vif, priv->hWILCWFIDrv, settings->beacon_interval, settings->dtim_period, beacon->head_len, (u8 *)beacon->head, @@ -2385,13 +2404,15 @@ static int change_beacon(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_beacon_data *beacon) { struct wilc_priv *priv; + struct wilc_vif *vif; s32 s32Error = 0; priv = wiphy_priv(wiphy); + vif = netdev_priv(priv->dev); PRINT_D(HOSTAPD_DBG, "Setting beacon\n"); - s32Error = wilc_add_beacon(priv->hWILCWFIDrv, + s32Error = wilc_add_beacon(vif, priv->hWILCWFIDrv, 0, 0, beacon->head_len, (u8 *)beacon->head, @@ -2404,18 +2425,20 @@ static int stop_ap(struct wiphy *wiphy, struct net_device *dev) { s32 s32Error = 0; struct wilc_priv *priv; + struct wilc_vif *vif; u8 NullBssid[ETH_ALEN] = {0}; if (!wiphy) return -EFAULT; priv = wiphy_priv(wiphy); + vif = netdev_priv(priv->dev); PRINT_D(HOSTAPD_DBG, "Deleting beacon\n"); wilc_wlan_set_bssid(dev, NullBssid); - s32Error = wilc_del_beacon(priv->hWILCWFIDrv); + s32Error = wilc_del_beacon(vif, priv->hWILCWFIDrv); if (s32Error) PRINT_ER("Host delete beacon fail\n"); @@ -2486,7 +2509,8 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n", strStaParams.flags_set); - s32Error = wilc_add_station(priv->hWILCWFIDrv, &strStaParams); + s32Error = wilc_add_station(vif, priv->hWILCWFIDrv, + &strStaParams); if (s32Error) PRINT_ER("Host add station fail\n"); } @@ -2514,12 +2538,12 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev, if (!mac) { PRINT_D(HOSTAPD_DBG, "All associated stations\n"); - s32Error = wilc_del_allstation(priv->hWILCWFIDrv, priv->assoc_stainfo.au8Sta_AssociatedBss); + s32Error = wilc_del_allstation(vif, priv->hWILCWFIDrv, priv->assoc_stainfo.au8Sta_AssociatedBss); } else { PRINT_D(HOSTAPD_DBG, "With mac address: %x%x%x%x%x%x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); } - s32Error = wilc_del_station(priv->hWILCWFIDrv, mac); + s32Error = wilc_del_station(vif, priv->hWILCWFIDrv, mac); if (s32Error) PRINT_ER("Host delete station fail\n"); @@ -2592,7 +2616,8 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n", strStaParams.flags_set); - s32Error = wilc_edit_station(priv->hWILCWFIDrv, &strStaParams); + s32Error = wilc_edit_station(vif, priv->hWILCWFIDrv, + &strStaParams); if (s32Error) PRINT_ER("Host edit station fail\n"); } @@ -2825,10 +2850,11 @@ int wilc_init_host_int(struct net_device *net) int wilc_deinit_host_int(struct net_device *net) { int s32Error = 0; - + struct wilc_vif *vif; struct wilc_priv *priv; priv = wdev_priv(net->ieee80211_ptr); + vif = netdev_priv(priv->dev); priv->gbAutoRateAdjusted = false; @@ -2836,7 +2862,7 @@ int wilc_deinit_host_int(struct net_device *net) op_ifcs--; - s32Error = wilc_deinit(priv->hWILCWFIDrv); + s32Error = wilc_deinit(vif, priv->hWILCWFIDrv); clear_shadow_scan(); if (op_ifcs == 0) { From fbf5379bfc2511acadb90e672badb827667a8ec8 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:40 +0900 Subject: [PATCH 671/843] staging: wilc1000: remove argument hif_drv In previous patch we add new argument vif which has hif_drv in it's member. Therefore, no need to pass hif_drv in those functions. Remove argument struct host_if_drv and use hif_drv of vif. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 177 +++++++------- drivers/staging/wilc1000/host_interface.h | 127 ++++------ drivers/staging/wilc1000/linux_wlan.c | 20 +- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 223 +++++++++--------- 4 files changed, 265 insertions(+), 282 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 3dd2833f7e72..421ce0de80f4 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -451,7 +451,7 @@ static s32 handle_get_ip_address(struct wilc_vif *vif, kfree(wid.val); if (memcmp(get_ip[idx], set_ip[idx], IP_ALEN) != 0) - wilc_setup_ipaddress(vif, hif_drv, set_ip[idx], idx); + wilc_setup_ipaddress(vif, set_ip[idx], idx); if (result != 0) { PRINT_ER("Failed to get IP address\n"); @@ -1629,7 +1629,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif, if ((u8MacStatus == MAC_CONNECTED) && (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { - wilc_set_power_mgmt(vif, hif_drv, 0, 0); + wilc_set_power_mgmt(vif, 0, 0); PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n"); hif_drv->hif_state = HOST_IF_CONNECTED; @@ -1675,7 +1675,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif, if (hif_drv->usr_conn_req.conn_result) { wilc_optaining_ip = false; - wilc_set_power_mgmt(vif, hif_drv, 0, 0); + wilc_set_power_mgmt(vif, 0, 0); hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, @@ -2016,7 +2016,7 @@ static void Handle_Disconnect(struct wilc_vif *vif, PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); wilc_optaining_ip = false; - wilc_set_power_mgmt(vif, hif_drv, 0, 0); + wilc_set_power_mgmt(vif, 0, 0); eth_zero_addr(wilc_connected_ssid); @@ -2087,15 +2087,14 @@ static void Handle_Disconnect(struct wilc_vif *vif, up(&hif_drv->sem_test_disconn_block); } -void wilc_resolve_disconnect_aberration(struct wilc_vif *vif, - struct host_if_drv *hif_drv) +void wilc_resolve_disconnect_aberration(struct wilc_vif *vif) { - if (!hif_drv) + if (!vif->hif_drv) return; - if ((hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) || - (hif_drv->hif_state == HOST_IF_CONNECTING)) { + if ((vif->hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) || + (vif->hif_drv->hif_state == HOST_IF_CONNECTING)) { PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n"); - wilc_disconnect(vif, hif_drv, 1); + wilc_disconnect(vif, 1); } } @@ -3045,11 +3044,11 @@ s32 wilc_remove_key(struct host_if_drv *hif_drv, const u8 *pu8StaAddress) return 0; } -int wilc_remove_wep_key(struct wilc_vif *vif, - struct host_if_drv *hif_drv, u8 index) +int wilc_remove_wep_key(struct wilc_vif *vif, u8 index) { int result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; if (!hif_drv) { result = -EFAULT; @@ -3074,11 +3073,11 @@ int wilc_remove_wep_key(struct wilc_vif *vif, return result; } -int wilc_set_wep_default_keyid(struct wilc_vif *vif, - struct host_if_drv *hif_drv, u8 index) +int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index) { int result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; if (!hif_drv) { result = -EFAULT; @@ -3103,11 +3102,12 @@ int wilc_set_wep_default_keyid(struct wilc_vif *vif, return result; } -int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, struct host_if_drv *hif_drv, - const u8 *key, u8 len, u8 index) +int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len, + u8 index) { int result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; if (!hif_drv) { PRINT_ER("driver is null\n"); @@ -3136,12 +3136,12 @@ int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, struct host_if_drv *hif_drv, return result; } -int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, struct host_if_drv *hif_drv, - const u8 *key, u8 len, u8 index, u8 mode, - enum AUTHTYPE auth_type) +int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len, + u8 index, u8 mode, enum AUTHTYPE auth_type) { int result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; int i; if (!hif_drv) { @@ -3178,13 +3178,13 @@ int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, struct host_if_drv *hif_drv, return result; } -int wilc_add_ptk(struct wilc_vif *vif, struct host_if_drv *hif_drv, - const u8 *ptk, u8 ptk_key_len, const u8 *mac_addr, - const u8 *rx_mic, const u8 *tx_mic, u8 mode, u8 cipher_mode, - u8 index) +int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len, + const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic, + u8 mode, u8 cipher_mode, u8 index) { int result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; u8 key_len = ptk_key_len; int i; @@ -3245,13 +3245,14 @@ int wilc_add_ptk(struct wilc_vif *vif, struct host_if_drv *hif_drv, return result; } -int wilc_add_rx_gtk(struct wilc_vif *vif, struct host_if_drv *hif_drv, - const u8 *rx_gtk, u8 gtk_key_len, u8 index, - u32 key_rsc_len, const u8 *key_rsc, const u8 *rx_mic, - const u8 *tx_mic, u8 mode, u8 cipher_mode) +int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len, + u8 index, u32 key_rsc_len, const u8 *key_rsc, + const u8 *rx_mic, const u8 *tx_mic, u8 mode, + u8 cipher_mode) { int result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; u8 key_len = gtk_key_len; if (!hif_drv) { @@ -3313,11 +3314,12 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, struct host_if_drv *hif_drv, return result; } -s32 wilc_set_pmkid_info(struct wilc_vif *vif, struct host_if_drv *hif_drv, +s32 wilc_set_pmkid_info(struct wilc_vif *vif, struct host_if_pmkid_attr *pu8PmkidInfoArray) { s32 result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; u32 i; if (!hif_drv) { @@ -3347,11 +3349,11 @@ s32 wilc_set_pmkid_info(struct wilc_vif *vif, struct host_if_drv *hif_drv, return result; } -s32 wilc_get_mac_address(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u8 *pu8MacAddress) +s32 wilc_get_mac_address(struct wilc_vif *vif, u8 *pu8MacAddress) { s32 result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; memset(&msg, 0, sizeof(struct host_if_msg)); @@ -3370,11 +3372,11 @@ s32 wilc_get_mac_address(struct wilc_vif *vif, struct host_if_drv *hif_drv, return result; } -s32 wilc_set_mac_address(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u8 *pu8MacAddress) +s32 wilc_set_mac_address(struct wilc_vif *vif, u8 *pu8MacAddress) { s32 result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; PRINT_D(GENERIC_DBG, "mac addr = %x:%x:%x\n", pu8MacAddress[0], pu8MacAddress[1], pu8MacAddress[2]); @@ -3391,15 +3393,15 @@ s32 wilc_set_mac_address(struct wilc_vif *vif, struct host_if_drv *hif_drv, return result; } -s32 wilc_set_join_req(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u8 *pu8bssid, const u8 *pu8ssid, size_t ssidLen, - const u8 *pu8IEs, size_t IEsLen, +s32 wilc_set_join_req(struct wilc_vif *vif, u8 *pu8bssid, const u8 *pu8ssid, + size_t ssidLen, const u8 *pu8IEs, size_t IEsLen, wilc_connect_result pfConnectResult, void *pvUserArg, u8 u8security, enum AUTHTYPE tenuAuth_type, u8 u8channel, void *pJoinParams) { s32 result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; if (!hif_drv || !pfConnectResult) { PRINT_ER("Driver is null\n"); @@ -3459,10 +3461,11 @@ s32 wilc_set_join_req(struct wilc_vif *vif, struct host_if_drv *hif_drv, return result; } -s32 wilc_flush_join_req(struct wilc_vif *vif, struct host_if_drv *hif_drv) +s32 wilc_flush_join_req(struct wilc_vif *vif) { s32 result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; if (!join_req) return -EFAULT; @@ -3485,11 +3488,11 @@ s32 wilc_flush_join_req(struct wilc_vif *vif, struct host_if_drv *hif_drv) return result; } -s32 wilc_disconnect(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u16 u16ReasonCode) +s32 wilc_disconnect(struct wilc_vif *vif, u16 u16ReasonCode) { s32 result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; if (!hif_drv) { PRINT_ER("Driver is null\n"); @@ -3542,11 +3545,11 @@ static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, return result; } -int wilc_set_mac_chnl_num(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u8 channel) +int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel) { int result; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; if (!hif_drv) { PRINT_ER("driver is null\n"); @@ -3606,11 +3609,11 @@ int wilc_set_wfi_drv_handler(struct wilc_vif *vif, struct host_if_drv *hif_drv) return result; } -int wilc_set_operation_mode(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u32 mode) +int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode) { int result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_SET_OPERATION_MODE; @@ -3627,11 +3630,12 @@ int wilc_set_operation_mode(struct wilc_vif *vif, struct host_if_drv *hif_drv, return result; } -s32 wilc_get_inactive_time(struct wilc_vif *vif, struct host_if_drv *hif_drv, - const u8 *mac, u32 *pu32InactiveTime) +s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac, + u32 *pu32InactiveTime) { s32 result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; if (!hif_drv) { PRINT_ER("driver is null\n"); @@ -3656,11 +3660,11 @@ s32 wilc_get_inactive_time(struct wilc_vif *vif, struct host_if_drv *hif_drv, return result; } -s32 wilc_get_rssi(struct wilc_vif *vif, struct host_if_drv *hif_drv, - s8 *ps8Rssi) +s32 wilc_get_rssi(struct wilc_vif *vif, s8 *ps8Rssi) { s32 result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_GET_RSSI; @@ -3685,11 +3689,11 @@ s32 wilc_get_rssi(struct wilc_vif *vif, struct host_if_drv *hif_drv, return result; } -s32 wilc_get_statistics(struct wilc_vif *vif, struct host_if_drv *hif_drv, - struct rf_info *pstrStatistics) +s32 wilc_get_statistics(struct wilc_vif *vif, struct rf_info *pstrStatistics) { s32 result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_GET_STATISTICS; @@ -3707,14 +3711,14 @@ s32 wilc_get_statistics(struct wilc_vif *vif, struct host_if_drv *hif_drv, return result; } -s32 wilc_scan(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u8 u8ScanSource, u8 u8ScanType, u8 *pu8ChnlFreqList, - u8 u8ChnlListLen, const u8 *pu8IEs, - size_t IEsLen, wilc_scan_result ScanResult, - void *pvUserArg, struct hidden_network *pstrHiddenNetwork) +s32 wilc_scan(struct wilc_vif *vif, u8 u8ScanSource, u8 u8ScanType, + u8 *pu8ChnlFreqList, u8 u8ChnlListLen, const u8 *pu8IEs, + size_t IEsLen, wilc_scan_result ScanResult, void *pvUserArg, + struct hidden_network *pstrHiddenNetwork) { s32 result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; if (!hif_drv || !ScanResult) { PRINT_ER("hif_drv or ScanResult = NULL\n"); @@ -3761,11 +3765,12 @@ s32 wilc_scan(struct wilc_vif *vif, struct host_if_drv *hif_drv, return result; } -s32 wilc_hif_set_cfg(struct wilc_vif *vif, struct host_if_drv *hif_drv, - struct cfg_param_val *pstrCfgParamVal) +s32 wilc_hif_set_cfg(struct wilc_vif *vif, + struct cfg_param_val *pstrCfgParamVal) { s32 result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; if (!hif_drv) { PRINT_ER("hif_drv NULL\n"); @@ -3919,10 +3924,11 @@ _fail_: return result; } -s32 wilc_deinit(struct wilc_vif *vif, struct host_if_drv *hif_drv) +s32 wilc_deinit(struct wilc_vif *vif) { s32 result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; int ret; if (!hif_drv) { @@ -4089,14 +4095,15 @@ void wilc_scan_complete_received(u8 *pu8Buffer, u32 u32Length) return; } -s32 wilc_remain_on_channel(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u32 u32SessionID, u32 u32duration, u16 chan, +s32 wilc_remain_on_channel(struct wilc_vif *vif, u32 u32SessionID, + u32 u32duration, u16 chan, wilc_remain_on_chan_expired RemainOnChanExpired, wilc_remain_on_chan_ready RemainOnChanReady, void *pvUserArg) { s32 result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; if (!hif_drv) { PRINT_ER("driver is null\n"); @@ -4122,11 +4129,11 @@ s32 wilc_remain_on_channel(struct wilc_vif *vif, struct host_if_drv *hif_drv, return result; } -s32 wilc_listen_state_expired(struct wilc_vif *vif, - struct host_if_drv *hif_drv, u32 u32SessionID) +s32 wilc_listen_state_expired(struct wilc_vif *vif, u32 u32SessionID) { s32 result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; if (!hif_drv) { PRINT_ER("driver is null\n"); @@ -4148,11 +4155,11 @@ s32 wilc_listen_state_expired(struct wilc_vif *vif, return result; } -s32 wilc_frame_register(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u16 u16FrameType, bool bReg) +s32 wilc_frame_register(struct wilc_vif *vif, u16 u16FrameType, bool bReg) { s32 result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; if (!hif_drv) { PRINT_ER("driver is null\n"); @@ -4189,14 +4196,13 @@ s32 wilc_frame_register(struct wilc_vif *vif, struct host_if_drv *hif_drv, return result; } -s32 wilc_add_beacon(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u32 u32Interval, - u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head, - u32 u32TailLen, u8 *pu8Tail) +s32 wilc_add_beacon(struct wilc_vif *vif, u32 u32Interval, u32 u32DTIMPeriod, + u32 u32HeadLen, u8 *pu8Head, u32 u32TailLen, u8 *pu8Tail) { s32 result = 0; struct host_if_msg msg; struct beacon_attr *pstrSetBeaconParam = &msg.body.beacon_info; + struct host_if_drv *hif_drv = vif->hif_drv; if (!hif_drv) { PRINT_ER("driver is null\n"); @@ -4245,10 +4251,11 @@ ERRORHANDLER: return result; } -int wilc_del_beacon(struct wilc_vif *vif, struct host_if_drv *hif_drv) +int wilc_del_beacon(struct wilc_vif *vif) { int result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; if (!hif_drv) { PRINT_ER("driver is null\n"); @@ -4267,12 +4274,12 @@ int wilc_del_beacon(struct wilc_vif *vif, struct host_if_drv *hif_drv) return result; } -int wilc_add_station(struct wilc_vif *vif, struct host_if_drv *hif_drv, - struct add_sta_param *sta_param) +int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param) { int result = 0; struct host_if_msg msg; struct add_sta_param *add_sta_info = &msg.body.add_sta_info; + struct host_if_drv *hif_drv = vif->hif_drv; if (!hif_drv) { PRINT_ER("driver is null\n"); @@ -4302,12 +4309,12 @@ int wilc_add_station(struct wilc_vif *vif, struct host_if_drv *hif_drv, return result; } -int wilc_del_station(struct wilc_vif *vif, struct host_if_drv *hif_drv, - const u8 *mac_addr) +int wilc_del_station(struct wilc_vif *vif, const u8 *mac_addr) { int result = 0; struct host_if_msg msg; struct del_sta *del_sta_info = &msg.body.del_sta_info; + struct host_if_drv *hif_drv = vif->hif_drv; if (!hif_drv) { PRINT_ER("driver is null\n"); @@ -4333,12 +4340,12 @@ int wilc_del_station(struct wilc_vif *vif, struct host_if_drv *hif_drv, return result; } -s32 wilc_del_allstation(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u8 pu8MacAddr[][ETH_ALEN]) +s32 wilc_del_allstation(struct wilc_vif *vif, u8 pu8MacAddr[][ETH_ALEN]) { s32 result = 0; struct host_if_msg msg; struct del_all_sta *pstrDelAllStationMsg = &msg.body.del_all_sta_info; + struct host_if_drv *hif_drv = vif->hif_drv; u8 au8Zero_Buff[ETH_ALEN] = {0}; u32 i; u8 u8AssocNumb = 0; @@ -4385,12 +4392,13 @@ s32 wilc_del_allstation(struct wilc_vif *vif, struct host_if_drv *hif_drv, return result; } -s32 wilc_edit_station(struct wilc_vif *vif, struct host_if_drv *hif_drv, - struct add_sta_param *pstrStaParams) +s32 wilc_edit_station(struct wilc_vif *vif, + struct add_sta_param *pstrStaParams) { s32 result = 0; struct host_if_msg msg; struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info; + struct host_if_drv *hif_drv = vif->hif_drv; if (!hif_drv) { PRINT_ER("driver is null\n"); @@ -4424,12 +4432,12 @@ s32 wilc_edit_station(struct wilc_vif *vif, struct host_if_drv *hif_drv, return result; } -s32 wilc_set_power_mgmt(struct wilc_vif *vif, struct host_if_drv *hif_drv, - bool bIsEnabled, u32 u32Timeout) +s32 wilc_set_power_mgmt(struct wilc_vif *vif, bool bIsEnabled, u32 u32Timeout) { s32 result = 0; struct host_if_msg msg; struct power_mgmt_param *pstrPowerMgmtParam = &msg.body.pwr_mgmt_info; + struct host_if_drv *hif_drv = vif->hif_drv; PRINT_INFO(HOSTINF_DBG, "\n\n>> Setting PS to %d <<\n\n", bIsEnabled); @@ -4455,14 +4463,13 @@ s32 wilc_set_power_mgmt(struct wilc_vif *vif, struct host_if_drv *hif_drv, return result; } -s32 wilc_setup_multicast_filter(struct wilc_vif *vif, - struct host_if_drv *hif_drv, - bool bIsEnabled, +s32 wilc_setup_multicast_filter(struct wilc_vif *vif, bool bIsEnabled, u32 u32count) { s32 result = 0; struct host_if_msg msg; struct set_multicast *pstrMulticastFilterParam = &msg.body.multicast_info; + struct host_if_drv *hif_drv = vif->hif_drv; if (!hif_drv) { PRINT_ER("driver is null\n"); @@ -4651,14 +4658,12 @@ void wilc_free_join_params(void *pJoinParams) PRINT_ER("Unable to FREE null pointer\n"); } -s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif, - struct host_if_drv *hif_drv, - char *pBSSID, - char TID) +s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *pBSSID, char TID) { s32 result = 0; struct host_if_msg msg; struct ba_session_info *pBASessionInfo = &msg.body.session_info; + struct host_if_drv *hif_drv = vif->hif_drv; if (!hif_drv) { PRINT_ER("driver is null\n"); @@ -4683,11 +4688,11 @@ s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif, return result; } -s32 wilc_setup_ipaddress(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u8 *u16ipadd, u8 idx) +s32 wilc_setup_ipaddress(struct wilc_vif *vif, u8 *u16ipadd, u8 idx) { s32 result = 0; struct host_if_msg msg; + struct host_if_drv *hif_drv = vif->hif_drv; return 0; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index ccbbe73c7ee5..9716bc859dca 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -307,102 +307,73 @@ struct add_sta_param { struct wilc_vif; s32 wilc_remove_key(struct host_if_drv *hWFIDrv, const u8 *pu8StaAddress); -int wilc_remove_wep_key(struct wilc_vif *vif, - struct host_if_drv *hif_drv, u8 index); -int wilc_set_wep_default_keyid(struct wilc_vif *vif, - struct host_if_drv *hif_drv, u8 index); -int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, struct host_if_drv *hif_drv, - const u8 *key, u8 len, u8 index); -int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, struct host_if_drv *hif_drv, - const u8 *key, u8 len, u8 index, u8 mode, - enum AUTHTYPE auth_type); -s32 wilc_add_ptk(struct wilc_vif *vif, struct host_if_drv *hif_drv, - const u8 *pu8Ptk, u8 u8PtkKeylen, const u8 *mac_addr, - const u8 *pu8RxMic, const u8 *pu8TxMic, +int wilc_remove_wep_key(struct wilc_vif *vif, u8 index); +int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index); +int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len, + u8 index); +int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len, + u8 index, u8 mode, enum AUTHTYPE auth_type); +s32 wilc_add_ptk(struct wilc_vif *vif, const u8 *pu8Ptk, u8 u8PtkKeylen, + const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx); -s32 wilc_get_inactive_time(struct wilc_vif *vif, struct host_if_drv *hif_drv, - const u8 *mac, u32 *pu32InactiveTime); -s32 wilc_add_rx_gtk(struct wilc_vif *vif, struct host_if_drv *hif_drv, - const u8 *pu8RxGtk, u8 u8GtkKeylen, u8 u8KeyIdx, - u32 u32KeyRSClen, const u8 *KeyRSC, - const u8 *pu8RxMic, const u8 *pu8TxMic, - u8 mode, u8 u8Ciphermode); +s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac, + u32 *pu32InactiveTime); +s32 wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *pu8RxGtk, u8 u8GtkKeylen, + u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC, + const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, + u8 u8Ciphermode); s32 wilc_add_tx_gtk(struct host_if_drv *hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk, u8 u8KeyIdx); -s32 wilc_set_pmkid_info(struct wilc_vif *vif, struct host_if_drv *hif_drv, +s32 wilc_set_pmkid_info(struct wilc_vif *vif, struct host_if_pmkid_attr *pu8PmkidInfoArray); -s32 wilc_get_mac_address(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u8 *pu8MacAddress); -s32 wilc_set_mac_address(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u8 *pu8MacAddress); +s32 wilc_get_mac_address(struct wilc_vif *vif, u8 *pu8MacAddress); +s32 wilc_set_mac_address(struct wilc_vif *vif, u8 *pu8MacAddress); int wilc_wait_msg_queue_idle(void); s32 wilc_set_start_scan_req(struct host_if_drv *hWFIDrv, u8 scanSource); -s32 wilc_set_join_req(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u8 *pu8bssid, const u8 *pu8ssid, size_t ssidLen, - const u8 *pu8IEs, size_t IEsLen, +s32 wilc_set_join_req(struct wilc_vif *vif, u8 *pu8bssid, const u8 *pu8ssid, + size_t ssidLen, const u8 *pu8IEs, size_t IEsLen, wilc_connect_result pfConnectResult, void *pvUserArg, u8 u8security, enum AUTHTYPE tenuAuth_type, u8 u8channel, void *pJoinParams); -s32 wilc_flush_join_req(struct wilc_vif *vif, struct host_if_drv *hif_drv); -s32 wilc_disconnect(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u16 u16ReasonCode); -int wilc_set_mac_chnl_num(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u8 channel); -s32 wilc_get_rssi(struct wilc_vif *vif, struct host_if_drv *hif_drv, - s8 *ps8Rssi); -s32 wilc_scan(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u8 u8ScanSource, u8 u8ScanType, u8 *pu8ChnlFreqList, - u8 u8ChnlListLen, const u8 *pu8IEs, - size_t IEsLen, wilc_scan_result ScanResult, - void *pvUserArg, struct hidden_network *pstrHiddenNetwork); -s32 wilc_hif_set_cfg(struct wilc_vif *vif, struct host_if_drv *hif_drv, - struct cfg_param_val *pstrCfgParamVal); +s32 wilc_flush_join_req(struct wilc_vif *vif); +s32 wilc_disconnect(struct wilc_vif *vif, u16 u16ReasonCode); +int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel); +s32 wilc_get_rssi(struct wilc_vif *vif, s8 *ps8Rssi); +s32 wilc_scan(struct wilc_vif *vif, u8 u8ScanSource, u8 u8ScanType, + u8 *pu8ChnlFreqList, u8 u8ChnlListLen, const u8 *pu8IEs, + size_t IEsLen, wilc_scan_result ScanResult, void *pvUserArg, + struct hidden_network *pstrHiddenNetwork); +s32 wilc_hif_set_cfg(struct wilc_vif *vif, + struct cfg_param_val *pstrCfgParamVal); s32 wilc_init(struct net_device *dev, struct host_if_drv **phWFIDrv); -s32 wilc_deinit(struct wilc_vif *vif, struct host_if_drv *hif_drv); -s32 wilc_add_beacon(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u32 u32Interval, - u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head, - u32 u32TailLen, u8 *pu8Tail); -int wilc_del_beacon(struct wilc_vif *vif, struct host_if_drv *hif_drv); -int wilc_add_station(struct wilc_vif *vif, struct host_if_drv *hif_drv, - struct add_sta_param *sta_param); -s32 wilc_del_allstation(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u8 pu8MacAddr[][ETH_ALEN]); -int wilc_del_station(struct wilc_vif *vif, struct host_if_drv *hif_drv, - const u8 *mac_addr); -s32 wilc_edit_station(struct wilc_vif *vif, struct host_if_drv *hif_drv, - struct add_sta_param *pstrStaParams); -s32 wilc_set_power_mgmt(struct wilc_vif *vif, struct host_if_drv *hif_drv, - bool bIsEnabled, u32 u32Timeout); -s32 wilc_setup_multicast_filter(struct wilc_vif *vif, - struct host_if_drv *hif_drv, - bool bIsEnabled, +s32 wilc_deinit(struct wilc_vif *vif); +s32 wilc_add_beacon(struct wilc_vif *vif, u32 u32Interval, u32 u32DTIMPeriod, + u32 u32HeadLen, u8 *pu8Head, u32 u32TailLen, u8 *pu8Tail); +int wilc_del_beacon(struct wilc_vif *vif); +int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param); +s32 wilc_del_allstation(struct wilc_vif *vif, u8 pu8MacAddr[][ETH_ALEN]); +int wilc_del_station(struct wilc_vif *vif, const u8 *mac_addr); +s32 wilc_edit_station(struct wilc_vif *vif, + struct add_sta_param *pstrStaParams); +s32 wilc_set_power_mgmt(struct wilc_vif *vif, bool bIsEnabled, u32 u32Timeout); +s32 wilc_setup_multicast_filter(struct wilc_vif *vif, bool bIsEnabled, u32 u32count); -s32 wilc_setup_ipaddress(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u8 *u16ipadd, u8 idx); -s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif, - struct host_if_drv *hif_drv, - char *pBSSID, - char TID); -s32 wilc_remain_on_channel(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u32 u32SessionID, u32 u32duration, u16 chan, +s32 wilc_setup_ipaddress(struct wilc_vif *vif, u8 *u16ipadd, u8 idx); +s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *pBSSID, char TID); +s32 wilc_remain_on_channel(struct wilc_vif *vif, u32 u32SessionID, + u32 u32duration, u16 chan, wilc_remain_on_chan_expired RemainOnChanExpired, wilc_remain_on_chan_ready RemainOnChanReady, void *pvUserArg); -s32 wilc_listen_state_expired(struct wilc_vif *vif, - struct host_if_drv *hif_drv, u32 u32SessionID); -s32 wilc_frame_register(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u16 u16FrameType, bool bReg); +s32 wilc_listen_state_expired(struct wilc_vif *vif, u32 u32SessionID); +s32 wilc_frame_register(struct wilc_vif *vif, u16 u16FrameType, bool bReg); int wilc_set_wfi_drv_handler(struct wilc_vif *vif, struct host_if_drv *hif_drv); -int wilc_set_operation_mode(struct wilc_vif *vif, struct host_if_drv *hif_drv, - u32 mode); +int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode); void wilc_free_join_params(void *pJoinParams); -s32 wilc_get_statistics(struct wilc_vif *vif, struct host_if_drv *hif_drv, - struct rf_info *pstrStatistics); -void wilc_resolve_disconnect_aberration(struct wilc_vif *vif, - struct host_if_drv *hif_drv); +s32 wilc_get_statistics(struct wilc_vif *vif, struct rf_info *pstrStatistics); +void wilc_resolve_disconnect_aberration(struct wilc_vif *vif); extern bool wilc_optaining_ip; extern u8 wilc_connected_ssid[6]; diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 60749962ed5a..a50e3ffcbb8d 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -112,7 +112,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event } if (wilc_enable_ps) - wilc_set_power_mgmt(vif, hif_drv, 1, 0); + wilc_set_power_mgmt(vif, 1, 0); PRINT_D(GENERIC_DBG, "[%s] Up IP\n", dev_iface->ifa_label); @@ -120,7 +120,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n", ip_addr_buf[0], ip_addr_buf[1], ip_addr_buf[2], ip_addr_buf[3]); - wilc_setup_ipaddress(vif, hif_drv, ip_addr_buf, vif->u8IfIdx); + wilc_setup_ipaddress(vif, ip_addr_buf, vif->u8IfIdx); break; @@ -134,9 +134,9 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event } if (memcmp(dev_iface->ifa_label, wlan_dev_name, 5) == 0) - wilc_set_power_mgmt(vif, hif_drv, 0, 0); + wilc_set_power_mgmt(vif, 0, 0); - wilc_resolve_disconnect_aberration(vif, hif_drv); + wilc_resolve_disconnect_aberration(vif); PRINT_D(GENERIC_DBG, "[%s] Down IP\n", dev_iface->ifa_label); @@ -145,7 +145,7 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event ip_addr_buf[0], ip_addr_buf[1], ip_addr_buf[2], ip_addr_buf[3]); - wilc_setup_ipaddress(vif, hif_drv, ip_addr_buf, vif->u8IfIdx); + wilc_setup_ipaddress(vif, ip_addr_buf, vif->u8IfIdx); break; @@ -1030,7 +1030,7 @@ int wilc_mac_open(struct net_device *ndev) wilc_set_machw_change_vir_if(ndev, false); - wilc_get_mac_address(vif, priv->hWILCWFIDrv, mac_add); + wilc_get_mac_address(vif, mac_add); PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add); for (i = 0; i < wl->vif_num; i++) { @@ -1097,13 +1097,13 @@ static void wilc_set_multicast_list(struct net_device *dev) if ((dev->flags & IFF_ALLMULTI) || (dev->mc.count) > WILC_MULTICAST_TABLE_SIZE) { PRINT_D(INIT_DBG, "Disable multicast filter, retrive all multicast packets\n"); - wilc_setup_multicast_filter(vif, hif_drv, false, 0); + wilc_setup_multicast_filter(vif, false, 0); return; } if ((dev->mc.count) == 0) { PRINT_D(INIT_DBG, "Enable multicast filter, retrive directed packets only.\n"); - wilc_setup_multicast_filter(vif, hif_drv, true, 0); + wilc_setup_multicast_filter(vif, true, 0); return; } @@ -1119,7 +1119,7 @@ static void wilc_set_multicast_list(struct net_device *dev) i++; } - wilc_setup_multicast_filter(vif, hif_drv, true, (dev->mc.count)); + wilc_setup_multicast_filter(vif, true, (dev->mc.count)); return; } @@ -1291,7 +1291,7 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) if (strncasecmp(buff, "RSSI", length) == 0) { priv = wiphy_priv(vif->ndev->ieee80211_ptr->wiphy); - ret = wilc_get_rssi(vif, priv->hWILCWFIDrv, &rssi); + ret = wilc_get_rssi(vif, &rssi); if (ret) PRINT_ER("Failed to send get rssi param's message queue "); PRINT_INFO(GENERIC_DBG, "RSSI :%d\n", rssi); diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 309a0cc6446e..da4c4adefeed 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -604,7 +604,7 @@ static int set_channel(struct wiphy *wiphy, PRINT_D(CFG80211_DBG, "Setting channel %d with frequency %d\n", channelnum, chandef->chan->center_freq); curr_channel = channelnum; - result = wilc_set_mac_chnl_num(vif, priv->hWILCWFIDrv, channelnum); + result = wilc_set_mac_chnl_num(vif, channelnum); if (result != 0) PRINT_ER("Error in setting channel %d\n", channelnum); @@ -660,16 +660,20 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) } } PRINT_D(CFG80211_DBG, "Trigger Scan Request\n"); - s32Error = wilc_scan(vif, priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN, - au8ScanChanList, request->n_channels, - (const u8 *)request->ie, request->ie_len, - CfgScanResult, (void *)priv, &strHiddenNetwork); + s32Error = wilc_scan(vif, USER_SCAN, ACTIVE_SCAN, + au8ScanChanList, + request->n_channels, + (const u8 *)request->ie, + request->ie_len, CfgScanResult, + (void *)priv, &strHiddenNetwork); } else { PRINT_D(CFG80211_DBG, "Trigger Scan Request\n"); - s32Error = wilc_scan(vif, priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN, - au8ScanChanList, request->n_channels, - (const u8 *)request->ie, request->ie_len, - CfgScanResult, (void *)priv, NULL); + s32Error = wilc_scan(vif, USER_SCAN, ACTIVE_SCAN, + au8ScanChanList, + request->n_channels, + (const u8 *)request->ie, + request->ie_len, CfgScanResult, + (void *)priv, NULL); } } else { PRINT_ER("Requested num of scanned channels is greater than the max, supported" @@ -792,8 +796,9 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, g_key_wep_params.key_idx = sme->key_idx; g_wep_keys_saved = true; - wilc_set_wep_default_keyid(vif, priv->hWILCWFIDrv, sme->key_idx); - wilc_add_wep_key_bss_sta(vif, priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx); + wilc_set_wep_default_keyid(vif, sme->key_idx); + wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len, + sme->key_idx); } else if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_WEP104) { u8security = ENCRYPT_ENABLED | WEP | WEP_EXTENDED; pcgroup_encrypt_val = "WEP104"; @@ -809,8 +814,9 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, g_key_wep_params.key_idx = sme->key_idx; g_wep_keys_saved = true; - wilc_set_wep_default_keyid(vif, priv->hWILCWFIDrv, sme->key_idx); - wilc_add_wep_key_bss_sta(vif, priv->hWILCWFIDrv, sme->key, sme->key_len, sme->key_idx); + wilc_set_wep_default_keyid(vif, sme->key_idx); + wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len, + sme->key_idx); } else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) { if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_TKIP) { u8security = ENCRYPT_ENABLED | WPA2 | TKIP; @@ -895,11 +901,12 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, wilc_wlan_set_bssid(dev, pstrNetworkInfo->au8bssid); - s32Error = wilc_set_join_req(vif, priv->hWILCWFIDrv, pstrNetworkInfo->au8bssid, sme->ssid, - sme->ssid_len, sme->ie, sme->ie_len, - CfgConnectResult, (void *)priv, u8security, - tenuAuth_type, pstrNetworkInfo->u8channel, - pstrNetworkInfo->pJoinParams); + s32Error = wilc_set_join_req(vif, pstrNetworkInfo->au8bssid, sme->ssid, + sme->ssid_len, sme->ie, sme->ie_len, + CfgConnectResult, (void *)priv, + u8security, tenuAuth_type, + pstrNetworkInfo->u8channel, + pstrNetworkInfo->pJoinParams); if (s32Error != 0) { PRINT_ER("wilc_set_join_req(): Error(%d)\n", s32Error); s32Error = -ENOENT; @@ -935,7 +942,7 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_co wilc_ie = false; pstrWFIDrv->p2p_timeout = 0; - s32Error = wilc_disconnect(vif, priv->hWILCWFIDrv, reason_code); + s32Error = wilc_disconnect(vif, reason_code); if (s32Error != 0) { PRINT_ER("Error in disconnecting: Error(%d)\n", s32Error); s32Error = -EINVAL; @@ -995,7 +1002,9 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, else u8mode = ENCRYPT_ENABLED | WEP | WEP_EXTENDED; - wilc_add_wep_key_bss_ap(vif, priv->hWILCWFIDrv, params->key, params->key_len, key_index, u8mode, tenuAuth_type); + wilc_add_wep_key_bss_ap(vif, params->key, + params->key_len, key_index, + u8mode, tenuAuth_type); break; } if (memcmp(params->key, priv->WILC_WFI_wep_key[key_index], params->key_len)) { @@ -1009,7 +1018,8 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, for (i = 0; i < params->key_len; i++) PRINT_INFO(CFG80211_DBG, "WEP key value[%d] = %d\n", i, params->key[i]); } - wilc_add_wep_key_bss_sta(vif, priv->hWILCWFIDrv, params->key, params->key_len, key_index); + wilc_add_wep_key_bss_sta(vif, params->key, + params->key_len, key_index); } break; @@ -1066,8 +1076,10 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, } - wilc_add_rx_gtk(vif, priv->hWILCWFIDrv, params->key, KeyLen, - key_index, params->seq_len, params->seq, pu8RxMic, pu8TxMic, AP_MODE, u8gmode); + wilc_add_rx_gtk(vif, params->key, KeyLen, + key_index, params->seq_len, + params->seq, pu8RxMic, + pu8TxMic, AP_MODE, u8gmode); } else { PRINT_INFO(CFG80211_DBG, "STA Address: %x%x%x%x%x\n", mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4]); @@ -1110,8 +1122,9 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, priv->wilc_ptk[key_index]->key_len = params->key_len; priv->wilc_ptk[key_index]->seq_len = params->seq_len; - wilc_add_ptk(vif, priv->hWILCWFIDrv, params->key, KeyLen, mac_addr, - pu8RxMic, pu8TxMic, AP_MODE, u8pmode, key_index); + wilc_add_ptk(vif, params->key, KeyLen, + mac_addr, pu8RxMic, pu8TxMic, + AP_MODE, u8pmode, key_index); } break; } @@ -1150,8 +1163,11 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, g_gtk_keys_saved = true; } - wilc_add_rx_gtk(vif, priv->hWILCWFIDrv, params->key, KeyLen, - key_index, params->seq_len, params->seq, pu8RxMic, pu8TxMic, STATION_MODE, u8mode); + wilc_add_rx_gtk(vif, params->key, KeyLen, + key_index, params->seq_len, + params->seq, pu8RxMic, + pu8TxMic, STATION_MODE, + u8mode); } else { if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) { pu8RxMic = params->key + 24; @@ -1184,8 +1200,9 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, g_ptk_keys_saved = true; } - wilc_add_ptk(vif, priv->hWILCWFIDrv, params->key, KeyLen, mac_addr, - pu8RxMic, pu8TxMic, STATION_MODE, u8mode, key_index); + wilc_add_ptk(vif, params->key, KeyLen, + mac_addr, pu8RxMic, pu8TxMic, + STATION_MODE, u8mode, key_index); PRINT_D(CFG80211_DBG, "Adding pairwise key\n"); if (INFO) { for (i = 0; i < params->key_len; i++) @@ -1261,7 +1278,7 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev, priv->WILC_WFI_wep_key_len[key_index] = 0; PRINT_D(CFG80211_DBG, "Removing WEP key with index = %d\n", key_index); - wilc_remove_wep_key(vif, priv->hWILCWFIDrv, key_index); + wilc_remove_wep_key(vif, key_index); } else { PRINT_D(CFG80211_DBG, "Removing all installed keys\n"); wilc_remove_key(priv->hWILCWFIDrv, mac_addr); @@ -1320,7 +1337,7 @@ static int set_default_key(struct wiphy *wiphy, struct net_device *netdev, u8 ke PRINT_D(CFG80211_DBG, "Setting default key with idx = %d\n", key_index); if (key_index != priv->WILC_WFI_wep_default) { - wilc_set_wep_default_keyid(vif, priv->hWILCWFIDrv, key_index); + wilc_set_wep_default_keyid(vif, key_index); } return 0; @@ -1356,7 +1373,7 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, sinfo->filled |= BIT(NL80211_STA_INFO_INACTIVE_TIME); - wilc_get_inactive_time(vif, priv->hWILCWFIDrv, mac, &(inactive_time)); + wilc_get_inactive_time(vif, mac, &inactive_time); sinfo->inactive_time = 1000 * inactive_time; PRINT_D(CFG80211_DBG, "Inactive time %d\n", sinfo->inactive_time); } @@ -1364,7 +1381,7 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, if (vif->iftype == STATION_MODE) { struct rf_info strStatistics; - wilc_get_statistics(vif, priv->hWILCWFIDrv, &strStatistics); + wilc_get_statistics(vif, &strStatistics); sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL) | BIT(NL80211_STA_INFO_RX_PACKETS) | @@ -1435,7 +1452,7 @@ static int set_wiphy_params(struct wiphy *wiphy, u32 changed) } PRINT_D(CFG80211_DBG, "Setting CFG params in the host interface\n"); - s32Error = wilc_hif_set_cfg(vif, priv->hWILCWFIDrv, &pstrCfgParamVal); + s32Error = wilc_hif_set_cfg(vif, &pstrCfgParamVal); if (s32Error) PRINT_ER("Error in setting WIPHY PARAMS\n"); @@ -1479,7 +1496,7 @@ static int set_pmksa(struct wiphy *wiphy, struct net_device *netdev, if (!s32Error) { PRINT_D(CFG80211_DBG, "Setting pmkid in the host interface\n"); - s32Error = wilc_set_pmkid_info(vif, priv->hWILCWFIDrv, &priv->pmkid_list); + s32Error = wilc_set_pmkid_info(vif, &priv->pmkid_list); } return s32Error; } @@ -1789,13 +1806,11 @@ static int remain_on_channel(struct wiphy *wiphy, priv->strRemainOnChanParams.u32ListenDuration = duration; priv->strRemainOnChanParams.u32ListenSessionID++; - s32Error = wilc_remain_on_channel(vif, priv->hWILCWFIDrv - , priv->strRemainOnChanParams.u32ListenSessionID - , duration - , chan->hw_value - , WILC_WFI_RemainOnChannelExpired - , WILC_WFI_RemainOnChannelReady - , (void *)priv); + s32Error = wilc_remain_on_channel(vif, + priv->strRemainOnChanParams.u32ListenSessionID, + duration, chan->hw_value, + WILC_WFI_RemainOnChannelExpired, + WILC_WFI_RemainOnChannelReady, (void *)priv); return s32Error; } @@ -1813,7 +1828,7 @@ static int cancel_remain_on_channel(struct wiphy *wiphy, PRINT_D(CFG80211_DBG, "Cancel remain on channel\n"); - s32Error = wilc_listen_state_expired(vif, priv->hWILCWFIDrv, priv->strRemainOnChanParams.u32ListenSessionID); + s32Error = wilc_listen_state_expired(vif, priv->strRemainOnChanParams.u32ListenSessionID); return s32Error; } @@ -1861,7 +1876,7 @@ static int mgmt_tx(struct wiphy *wiphy, if (ieee80211_is_probe_resp(mgmt->frame_control)) { PRINT_D(GENERIC_DBG, "TX: Probe Response\n"); PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value); - wilc_set_mac_chnl_num(vif, priv->hWILCWFIDrv, chan->hw_value); + wilc_set_mac_chnl_num(vif, chan->hw_value); curr_channel = chan->hw_value; } else if (ieee80211_is_action(mgmt->frame_control)) { PRINT_D(GENERIC_DBG, "ACTION FRAME:%x\n", (u16)mgmt->frame_control); @@ -1871,7 +1886,8 @@ static int mgmt_tx(struct wiphy *wiphy, if (buf[ACTION_SUBTYPE_ID] != PUBLIC_ACT_VENDORSPEC || buf[P2P_PUB_ACTION_SUBTYPE] != GO_NEG_CONF) { PRINT_D(GENERIC_DBG, "Setting channel: %d\n", chan->hw_value); - wilc_set_mac_chnl_num(vif, priv->hWILCWFIDrv, chan->hw_value); + wilc_set_mac_chnl_num(vif, + chan->hw_value); curr_channel = chan->hw_value; } switch (buf[ACTION_SUBTYPE_ID]) { @@ -2017,7 +2033,7 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev, PRINT_D(GENERIC_DBG, "Return since mac is closed\n"); return; } - wilc_frame_register(vif, priv->hWILCWFIDrv, frame_type, reg); + wilc_frame_register(vif, frame_type, reg); } static int set_cqm_rssi_config(struct wiphy *wiphy, struct net_device *dev, @@ -2043,7 +2059,7 @@ static int dump_station(struct wiphy *wiphy, struct net_device *dev, sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); - wilc_get_rssi(vif, priv->hWILCWFIDrv, &(sinfo->signal)); + wilc_get_rssi(vif, &sinfo->signal); return 0; } @@ -2067,7 +2083,7 @@ static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, } if (wilc_enable_ps) - wilc_set_power_mgmt(vif, priv->hWILCWFIDrv, enabled, timeout); + wilc_set_power_mgmt(vif, enabled, timeout); return 0; @@ -2115,8 +2131,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, vif->iftype = STATION_MODE; if (wl->initialized) { - wilc_del_all_rx_ba_session(vif, priv->hWILCWFIDrv, - wl->vif[0]->bssid, TID); + wilc_del_all_rx_ba_session(vif, wl->vif[0]->bssid, + TID); wilc_wait_msg_queue_idle(); up(&wl->cfg_event); @@ -2127,20 +2143,19 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, vif->iftype = interface_type; wilc_set_wfi_drv_handler(vif, wl->vif[0]->hif_drv); - wilc_set_mac_address(vif, wl->vif[0]->hif_drv, - wl->vif[0]->src_addr); - wilc_set_operation_mode(vif, priv->hWILCWFIDrv, STATION_MODE); + wilc_set_mac_address(wl->vif[0], wl->vif[0]->src_addr); + wilc_set_operation_mode(vif, STATION_MODE); if (g_wep_keys_saved) { - wilc_set_wep_default_keyid(vif, wl->vif[0]->hif_drv, - g_key_wep_params.key_idx); - wilc_add_wep_key_bss_sta(vif, wl->vif[0]->hif_drv, - g_key_wep_params.key, - g_key_wep_params.key_len, - g_key_wep_params.key_idx); + wilc_set_wep_default_keyid(wl->vif[0], + g_key_wep_params.key_idx); + wilc_add_wep_key_bss_sta(wl->vif[0], + g_key_wep_params.key, + g_key_wep_params.key_len, + g_key_wep_params.key_idx); } - wilc_flush_join_req(vif, priv->hWILCWFIDrv); + wilc_flush_join_req(vif); if (g_ptk_keys_saved && g_gtk_keys_saved) { PRINT_D(CFG80211_DBG, "ptk %x %x %x\n", g_key_ptk_params.key[0], @@ -2168,25 +2183,24 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, for (i = 0; i < num_reg_frame; i++) { PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type, vif->g_struct_frame_reg[i].reg); - wilc_frame_register(vif, priv->hWILCWFIDrv, + wilc_frame_register(vif, vif->g_struct_frame_reg[i].frame_type, vif->g_struct_frame_reg[i].reg); } } wilc_enable_ps = true; - wilc_set_power_mgmt(vif, priv->hWILCWFIDrv, 1, 0); + wilc_set_power_mgmt(vif, 1, 0); } break; case NL80211_IFTYPE_P2P_CLIENT: wilc_enable_ps = false; - wilc_set_power_mgmt(vif, priv->hWILCWFIDrv, 0, 0); + wilc_set_power_mgmt(vif, 0, 0); wilc_connecting = 0; PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_P2P_CLIENT\n"); - wilc_del_all_rx_ba_session(vif, priv->hWILCWFIDrv, - wl->vif[0]->bssid, TID); + wilc_del_all_rx_ba_session(vif, wl->vif[0]->bssid, TID); dev->ieee80211_ptr->iftype = type; priv->wdev->iftype = type; @@ -2204,20 +2218,19 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, wilc_initialized = 1; wilc_set_wfi_drv_handler(vif, wl->vif[0]->hif_drv); - wilc_set_mac_address(vif, wl->vif[0]->hif_drv, - wl->vif[0]->src_addr); - wilc_set_operation_mode(vif, priv->hWILCWFIDrv, STATION_MODE); + wilc_set_mac_address(wl->vif[0], wl->vif[0]->src_addr); + wilc_set_operation_mode(vif, STATION_MODE); if (g_wep_keys_saved) { - wilc_set_wep_default_keyid(vif, wl->vif[0]->hif_drv, - g_key_wep_params.key_idx); - wilc_add_wep_key_bss_sta(vif, wl->vif[0]->hif_drv, - g_key_wep_params.key, - g_key_wep_params.key_len, - g_key_wep_params.key_idx); + wilc_set_wep_default_keyid(wl->vif[0], + g_key_wep_params.key_idx); + wilc_add_wep_key_bss_sta(wl->vif[0], + g_key_wep_params.key, + g_key_wep_params.key_len, + g_key_wep_params.key_idx); } - wilc_flush_join_req(vif, priv->hWILCWFIDrv); + wilc_flush_join_req(vif); if (g_ptk_keys_saved && g_gtk_keys_saved) { PRINT_D(CFG80211_DBG, "ptk %x %x %x\n", g_key_ptk_params.key[0], @@ -2248,7 +2261,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, for (i = 0; i < num_reg_frame; i++) { PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type, vif->g_struct_frame_reg[i].reg); - wilc_frame_register(vif, priv->hWILCWFIDrv, + wilc_frame_register(vif, vif->g_struct_frame_reg[i].frame_type, vif->g_struct_frame_reg[i].reg); } @@ -2275,7 +2288,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, for (i = 0; i < num_reg_frame; i++) { PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type, vif->g_struct_frame_reg[i].reg); - wilc_frame_register(vif, priv->hWILCWFIDrv, + wilc_frame_register(vif, vif->g_struct_frame_reg[i].frame_type, vif->g_struct_frame_reg[i].reg); } @@ -2288,9 +2301,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, wilc_optaining_ip = true; mod_timer(&wilc_during_ip_timer, jiffies + msecs_to_jiffies(during_ip_time)); - wilc_set_power_mgmt(vif, priv->hWILCWFIDrv, 0, 0); - wilc_del_all_rx_ba_session(vif, priv->hWILCWFIDrv, - wl->vif[0]->bssid, TID); + wilc_set_power_mgmt(vif, 0, 0); + wilc_del_all_rx_ba_session(vif, wl->vif[0]->bssid, TID); wilc_enable_ps = false; PRINT_D(HOSTAPD_DBG, "Interface type = NL80211_IFTYPE_GO\n"); dev->ieee80211_ptr->iftype = type; @@ -2309,20 +2321,19 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, wilc_initialized = 1; wilc_set_wfi_drv_handler(vif, wl->vif[0]->hif_drv); - wilc_set_mac_address(vif, wl->vif[0]->hif_drv, - wl->vif[0]->src_addr); - wilc_set_operation_mode(vif, priv->hWILCWFIDrv, AP_MODE); + wilc_set_mac_address(wl->vif[0], wl->vif[0]->src_addr); + wilc_set_operation_mode(vif, AP_MODE); if (g_wep_keys_saved) { - wilc_set_wep_default_keyid(vif, wl->vif[0]->hif_drv, + wilc_set_wep_default_keyid(wl->vif[0], g_key_wep_params.key_idx); - wilc_add_wep_key_bss_sta(vif, wl->vif[0]->hif_drv, - g_key_wep_params.key, - g_key_wep_params.key_len, - g_key_wep_params.key_idx); + wilc_add_wep_key_bss_sta(wl->vif[0], + g_key_wep_params.key, + g_key_wep_params.key_len, + g_key_wep_params.key_idx); } - wilc_flush_join_req(vif, priv->hWILCWFIDrv); + wilc_flush_join_req(vif); if (g_ptk_keys_saved && g_gtk_keys_saved) { PRINT_D(CFG80211_DBG, "ptk %x %x %x cipher %x\n", g_key_ptk_params.key[0], @@ -2352,7 +2363,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, for (i = 0; i < num_reg_frame; i++) { PRINT_D(INIT_DBG, "Frame registering Type: %x - Reg: %d\n", vif->g_struct_frame_reg[i].frame_type, vif->g_struct_frame_reg[i].reg); - wilc_frame_register(vif, priv->hWILCWFIDrv, + wilc_frame_register(vif, vif->g_struct_frame_reg[i].frame_type, vif->g_struct_frame_reg[i].reg); } @@ -2391,11 +2402,10 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev, wilc_wlan_set_bssid(dev, wl->vif[0]->src_addr); - s32Error = wilc_add_beacon(vif, priv->hWILCWFIDrv, - settings->beacon_interval, - settings->dtim_period, - beacon->head_len, (u8 *)beacon->head, - beacon->tail_len, (u8 *)beacon->tail); + s32Error = wilc_add_beacon(vif, settings->beacon_interval, + settings->dtim_period, beacon->head_len, + (u8 *)beacon->head, beacon->tail_len, + (u8 *)beacon->tail); return s32Error; } @@ -2412,11 +2422,9 @@ static int change_beacon(struct wiphy *wiphy, struct net_device *dev, PRINT_D(HOSTAPD_DBG, "Setting beacon\n"); - s32Error = wilc_add_beacon(vif, priv->hWILCWFIDrv, - 0, - 0, - beacon->head_len, (u8 *)beacon->head, - beacon->tail_len, (u8 *)beacon->tail); + s32Error = wilc_add_beacon(vif, 0, 0, beacon->head_len, + (u8 *)beacon->head, beacon->tail_len, + (u8 *)beacon->tail); return s32Error; } @@ -2438,7 +2446,7 @@ static int stop_ap(struct wiphy *wiphy, struct net_device *dev) wilc_wlan_set_bssid(dev, NullBssid); - s32Error = wilc_del_beacon(vif, priv->hWILCWFIDrv); + s32Error = wilc_del_beacon(vif); if (s32Error) PRINT_ER("Host delete beacon fail\n"); @@ -2509,8 +2517,7 @@ static int add_station(struct wiphy *wiphy, struct net_device *dev, PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n", strStaParams.flags_set); - s32Error = wilc_add_station(vif, priv->hWILCWFIDrv, - &strStaParams); + s32Error = wilc_add_station(vif, &strStaParams); if (s32Error) PRINT_ER("Host add station fail\n"); } @@ -2538,12 +2545,13 @@ static int del_station(struct wiphy *wiphy, struct net_device *dev, if (!mac) { PRINT_D(HOSTAPD_DBG, "All associated stations\n"); - s32Error = wilc_del_allstation(vif, priv->hWILCWFIDrv, priv->assoc_stainfo.au8Sta_AssociatedBss); + s32Error = wilc_del_allstation(vif, + priv->assoc_stainfo.au8Sta_AssociatedBss); } else { PRINT_D(HOSTAPD_DBG, "With mac address: %x%x%x%x%x%x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); } - s32Error = wilc_del_station(vif, priv->hWILCWFIDrv, mac); + s32Error = wilc_del_station(vif, mac); if (s32Error) PRINT_ER("Host delete station fail\n"); @@ -2616,8 +2624,7 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, PRINT_D(HOSTAPD_DBG, "Flag Set = %d\n", strStaParams.flags_set); - s32Error = wilc_edit_station(vif, priv->hWILCWFIDrv, - &strStaParams); + s32Error = wilc_edit_station(vif, &strStaParams); if (s32Error) PRINT_ER("Host edit station fail\n"); } @@ -2862,7 +2869,7 @@ int wilc_deinit_host_int(struct net_device *net) op_ifcs--; - s32Error = wilc_deinit(vif, priv->hWILCWFIDrv); + s32Error = wilc_deinit(vif); clear_shadow_scan(); if (op_ifcs == 0) { From 71130e812af74afbf22b4308c517c8b6f3adacf2 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:41 +0900 Subject: [PATCH 672/843] staging: wilc1000: take vif instead of drv in hostIFthread In the first patch, we sent vif to hostIFthread. we can use vif instead of drv in the all functions which handle the commands from cfg operations. Change first argument host_if_drv with wilc_vif and use hif_drv of wilc_vif. Pass vif to the functions as well. In case of timer callback functions, set vif to the data and use vif instead of hif_drv. Lastly, initialize u32RcvdAssocRespInfoLen since changing hif_drv with vif causes one uninitialied build warning. Now we have vif that currently being used so we can use interface index of wilc_vif to send to wilc device. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 238 ++++++++++++---------- 1 file changed, 135 insertions(+), 103 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 421ce0de80f4..007b9a0f95fc 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -316,11 +316,12 @@ static struct host_if_drv *get_handler_from_id(int id) return wfidrv_list[id]; } -static s32 handle_set_channel(struct host_if_drv *hif_drv, +static s32 handle_set_channel(struct wilc_vif *vif, struct channel_attr *hif_set_ch) { s32 result = 0; struct wid wid; + struct host_if_drv *hif_drv = vif->hif_drv; wid.id = (u16)WID_CURRENT_CHANNEL; wid.type = WID_CHAR; @@ -340,11 +341,12 @@ static s32 handle_set_channel(struct host_if_drv *hif_drv, return result; } -static s32 handle_set_wfi_drv_handler(struct host_if_drv *hif_drv, +static s32 handle_set_wfi_drv_handler(struct wilc_vif *vif, struct drv_handler *hif_drv_handler) { s32 result = 0; struct wid wid; + struct host_if_drv *hif_drv = vif->hif_drv; wid.id = (u16)WID_SET_DRV_HANDLER; wid.type = WID_INT; @@ -365,11 +367,12 @@ static s32 handle_set_wfi_drv_handler(struct host_if_drv *hif_drv, return result; } -static s32 handle_set_operation_mode(struct host_if_drv *hif_drv, +static s32 handle_set_operation_mode(struct wilc_vif *vif, struct op_mode *hif_op_mode) { s32 result = 0; struct wid wid; + struct host_if_drv *hif_drv = vif->hif_drv; wid.id = (u16)WID_SET_OPERATION_MODE; wid.type = WID_INT; @@ -394,13 +397,12 @@ static s32 host_int_get_ipaddress(struct wilc_vif *vif, struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx); -static s32 handle_set_ip_address(struct wilc_vif *vif, - struct host_if_drv *hif_drv, u8 *ip_addr, - u8 idx) +static s32 handle_set_ip_address(struct wilc_vif *vif, u8 *ip_addr, u8 idx) { s32 result = 0; struct wid wid; char firmware_ip_addr[4] = {0}; + struct host_if_drv *hif_drv = vif->hif_drv; if (ip_addr[0] < 192) ip_addr[0] = 0; @@ -430,11 +432,11 @@ static s32 handle_set_ip_address(struct wilc_vif *vif, return result; } -static s32 handle_get_ip_address(struct wilc_vif *vif, - struct host_if_drv *hif_drv, u8 idx) +static s32 handle_get_ip_address(struct wilc_vif *vif, u8 idx) { s32 result = 0; struct wid wid; + struct host_if_drv *hif_drv = vif->hif_drv; wid.id = (u16)WID_IP_ADDRESS; wid.type = WID_STR; @@ -465,11 +467,12 @@ static s32 handle_get_ip_address(struct wilc_vif *vif, return result; } -static s32 handle_set_mac_address(struct host_if_drv *hif_drv, +static s32 handle_set_mac_address(struct wilc_vif *vif, struct set_mac_addr *set_mac_addr) { s32 result = 0; struct wid wid; + struct host_if_drv *hif_drv = vif->hif_drv; u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL); if (!mac_buf) { @@ -495,11 +498,12 @@ static s32 handle_set_mac_address(struct host_if_drv *hif_drv, return result; } -static s32 handle_get_mac_address(struct host_if_drv *hif_drv, +static s32 handle_get_mac_address(struct wilc_vif *vif, struct get_mac_addr *get_mac_addr) { s32 result = 0; struct wid wid; + struct host_if_drv *hif_drv = vif->hif_drv; wid.id = (u16)WID_MAC_ADDR; wid.type = WID_STR; @@ -518,11 +522,12 @@ static s32 handle_get_mac_address(struct host_if_drv *hif_drv, return result; } -static s32 handle_cfg_param(struct host_if_drv *hif_drv, +static s32 handle_cfg_param(struct wilc_vif *vif, struct cfg_param_attr *cfg_param_attr) { s32 result = 0; struct wid wid_list[32]; + struct host_if_drv *hif_drv = vif->hif_drv; u8 wid_cnt = 0; down(&hif_drv->sem_cfg_values); @@ -818,10 +823,10 @@ static void Handle_wait_msg_q_empty(void) up(&hif_sema_wait_response); } -static s32 Handle_ScanDone(struct host_if_drv *hif_drv, +static s32 Handle_ScanDone(struct wilc_vif *vif, enum scan_event enuEvent); -static s32 Handle_Scan(struct host_if_drv *hif_drv, +static s32 Handle_Scan(struct wilc_vif *vif, struct scan_attr *pstrHostIFscanAttr) { s32 result = 0; @@ -831,6 +836,7 @@ static s32 Handle_Scan(struct host_if_drv *hif_drv, u8 *pu8Buffer; u8 valuesize = 0; u8 *pu8HdnNtwrksWidVal = NULL; + struct host_if_drv *hif_drv = vif->hif_drv; PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state\n", hif_drv->hif_state); @@ -936,7 +942,7 @@ static s32 Handle_Scan(struct host_if_drv *hif_drv, ERRORHANDLER: if (result) { del_timer(&hif_drv->scan_timer); - Handle_ScanDone(hif_drv, SCAN_EVENT_ABORTED); + Handle_ScanDone(vif, SCAN_EVENT_ABORTED); } kfree(pstrHostIFscanAttr->ch_freq_list); @@ -952,12 +958,13 @@ ERRORHANDLER: return result; } -static s32 Handle_ScanDone(struct host_if_drv *hif_drv, +static s32 Handle_ScanDone(struct wilc_vif *vif, enum scan_event enuEvent) { s32 result = 0; u8 u8abort_running_scan; struct wid wid; + struct host_if_drv *hif_drv = vif->hif_drv; PRINT_D(HOSTINF_DBG, "in Handle_ScanDone()\n"); @@ -993,7 +1000,7 @@ static s32 Handle_ScanDone(struct host_if_drv *hif_drv, } u8 wilc_connected_ssid[6] = {0}; -static s32 Handle_Connect(struct host_if_drv *hif_drv, +static s32 Handle_Connect(struct wilc_vif *vif, struct connect_attr *pstrHostIFconnectAttr) { s32 result = 0; @@ -1001,6 +1008,7 @@ static s32 Handle_Connect(struct host_if_drv *hif_drv, u32 u32WidsCount = 0, dummyval = 0; u8 *pu8CurrByte = NULL; struct join_bss_param *ptstrJoinBssParam; + struct host_if_drv *hif_drv = vif->hif_drv; PRINT_D(GENERIC_DBG, "Handling connect request\n"); @@ -1286,12 +1294,13 @@ ERRORHANDLER: return result; } -static s32 Handle_FlushConnect(struct host_if_drv *hif_drv) +static s32 Handle_FlushConnect(struct wilc_vif *vif) { s32 result = 0; struct wid strWIDList[5]; u32 u32WidsCount = 0; u8 *pu8CurrByte = NULL; + struct host_if_drv *hif_drv = vif->hif_drv; strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE; strWIDList[u32WidsCount].type = WID_BIN_DATA; @@ -1333,12 +1342,13 @@ static s32 Handle_FlushConnect(struct host_if_drv *hif_drv) return result; } -static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv) +static s32 Handle_ConnectTimeout(struct wilc_vif *vif) { s32 result = 0; tstrConnectInfo strConnectInfo; struct wid wid; u16 u16DummyReasonCode = 0; + struct host_if_drv *hif_drv = vif->hif_drv; if (!hif_drv) { PRINT_ER("Driver handler is NULL\n"); @@ -1413,7 +1423,7 @@ static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv) return result; } -static s32 Handle_RcvdNtwrkInfo(struct host_if_drv *hif_drv, +static s32 Handle_RcvdNtwrkInfo(struct wilc_vif *vif, struct rcvd_net_info *pstrRcvdNetworkInfo) { u32 i; @@ -1421,6 +1431,7 @@ static s32 Handle_RcvdNtwrkInfo(struct host_if_drv *hif_drv, s32 result = 0; tstrNetworkInfo *pstrNetworkInfo = NULL; void *pJoinParams = NULL; + struct host_if_drv *hif_drv = vif->hif_drv; bNewNtwrkFound = true; PRINT_INFO(HOSTINF_DBG, "Handling received network info\n"); @@ -1494,13 +1505,12 @@ done: return result; } -static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, +static s32 host_int_get_assoc_res_info(struct wilc_vif *vif, u8 *pu8AssocRespInfo, u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen); static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif, - struct host_if_drv *hif_drv, struct rcvd_async_info *pstrRcvdGnrlAsyncInfo) { s32 result = 0; @@ -1515,6 +1525,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif, tstrConnectInfo strConnectInfo; tstrDisconnectNotifInfo strDisconnectNotifInfo; s32 s32Err = 0; + struct host_if_drv *hif_drv = vif->hif_drv; if (!hif_drv) { PRINT_ER("Driver handler is NULL\n"); @@ -1548,7 +1559,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif, u8MacStatusAdditionalInfo = pstrRcvdGnrlAsyncInfo->buffer[9]; PRINT_INFO(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Info = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) { - u32 u32RcvdAssocRespInfoLen; + u32 u32RcvdAssocRespInfoLen = 0; tstrConnectRespInfo *pstrConnectRespInfo = NULL; PRINT_D(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Code = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); @@ -1558,7 +1569,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif, if (u8MacStatus == MAC_CONNECTED) { memset(rcv_assoc_resp, 0, MAX_ASSOC_RESP_FRAME_SIZE); - host_int_get_assoc_res_info(hif_drv, + host_int_get_assoc_res_info(vif, rcv_assoc_resp, MAX_ASSOC_RESP_FRAME_SIZE, &u32RcvdAssocRespInfoLen); @@ -1666,7 +1677,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif, if (hif_drv->usr_scan_req.scan_result) { PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running OBSS Scan >>\n\n"); del_timer(&hif_drv->scan_timer); - Handle_ScanDone((void *)hif_drv, SCAN_EVENT_ABORTED); + Handle_ScanDone(vif, SCAN_EVENT_ABORTED); } strDisconnectNotifInfo.u16reason = 0; @@ -1717,7 +1728,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif, del_timer(&hif_drv->scan_timer); if (hif_drv->usr_scan_req.scan_result) - Handle_ScanDone(hif_drv, SCAN_EVENT_ABORTED); + Handle_ScanDone(vif, SCAN_EVENT_ABORTED); } } @@ -1727,7 +1738,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif, return result; } -static int Handle_Key(struct host_if_drv *hif_drv, +static int Handle_Key(struct wilc_vif *vif, struct key_attr *pstrHostIFkeyAttr) { s32 result = 0; @@ -1737,6 +1748,7 @@ static int Handle_Key(struct host_if_drv *hif_drv, u8 *pu8keybuf; s8 s8idxarray[1]; s8 ret = 0; + struct host_if_drv *hif_drv = vif->hif_drv; switch (pstrHostIFkeyAttr->type) { case WEP: @@ -2000,10 +2012,10 @@ _WPAPtk_end_case_: return result; } -static void Handle_Disconnect(struct wilc_vif *vif, - struct host_if_drv *hif_drv) +static void Handle_Disconnect(struct wilc_vif *vif) { struct wid wid; + struct host_if_drv *hif_drv = vif->hif_drv; s32 result = 0; u16 u16DummyReasonCode = 0; @@ -2098,10 +2110,11 @@ void wilc_resolve_disconnect_aberration(struct wilc_vif *vif) } } -static s32 Handle_GetChnl(struct host_if_drv *hif_drv) +static s32 Handle_GetChnl(struct wilc_vif *vif) { s32 result = 0; struct wid wid; + struct host_if_drv *hif_drv = vif->hif_drv; wid.id = (u16)WID_CURRENT_CHANNEL; wid.type = WID_CHAR; @@ -2123,7 +2136,7 @@ static s32 Handle_GetChnl(struct host_if_drv *hif_drv) return result; } -static void Handle_GetRssi(struct host_if_drv *hif_drv) +static void Handle_GetRssi(struct wilc_vif *vif) { s32 result = 0; struct wid wid; @@ -2135,20 +2148,21 @@ static void Handle_GetRssi(struct host_if_drv *hif_drv) PRINT_D(HOSTINF_DBG, "Getting RSSI value\n"); - result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + result = wilc_send_config_pkt(vif->hif_drv->wilc, GET_CFG, &wid, 1, + get_id_from_handler(vif->hif_drv)); if (result) { PRINT_ER("Failed to get RSSI value\n"); result = -EFAULT; } - up(&hif_drv->sem_get_rssi); + up(&vif->hif_drv->sem_get_rssi); } -static void Handle_GetLinkspeed(struct host_if_drv *hif_drv) +static void Handle_GetLinkspeed(struct wilc_vif *vif) { s32 result = 0; struct wid wid; + struct host_if_drv *hif_drv = vif->hif_drv; link_speed = 0; @@ -2169,10 +2183,12 @@ static void Handle_GetLinkspeed(struct host_if_drv *hif_drv) up(&hif_drv->sem_get_link_speed); } -static s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics) +static s32 Handle_GetStatistics(struct wilc_vif *vif, + struct rf_info *pstrStatistics) { struct wid strWIDList[5]; u32 u32WidsCount = 0, result = 0; + struct host_if_drv *hif_drv = vif->hif_drv; strWIDList[u32WidsCount].id = WID_LINKSPEED; strWIDList[u32WidsCount].type = WID_CHAR; @@ -2215,12 +2231,13 @@ static s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pst return 0; } -static s32 Handle_Get_InActiveTime(struct host_if_drv *hif_drv, +static s32 Handle_Get_InActiveTime(struct wilc_vif *vif, struct sta_inactive_t *strHostIfStaInactiveT) { s32 result = 0; u8 *stamac; struct wid wid; + struct host_if_drv *hif_drv = vif->hif_drv; wid.id = (u16)WID_SET_STA_MAC_INACTIVE_TIME; wid.type = WID_STR; @@ -2260,12 +2277,13 @@ static s32 Handle_Get_InActiveTime(struct host_if_drv *hif_drv, return result; } -static void Handle_AddBeacon(struct host_if_drv *hif_drv, +static void Handle_AddBeacon(struct wilc_vif *vif, struct beacon_attr *pstrSetBeaconParam) { s32 result = 0; struct wid wid; u8 *pu8CurrByte; + struct host_if_drv *hif_drv = vif->hif_drv; PRINT_D(HOSTINF_DBG, "Adding BEACON\n"); @@ -2315,11 +2333,12 @@ ERRORHANDLER: kfree(pstrSetBeaconParam->tail); } -static void Handle_DelBeacon(struct host_if_drv *hif_drv) +static void Handle_DelBeacon(struct wilc_vif *vif) { s32 result = 0; struct wid wid; u8 *pu8CurrByte; + struct host_if_drv *hif_drv = vif->hif_drv; wid.id = (u16)WID_DEL_BEACON; wid.type = WID_CHAR; @@ -2387,12 +2406,13 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, return pu8CurrByte - pu8Buffer; } -static void Handle_AddStation(struct host_if_drv *hif_drv, +static void Handle_AddStation(struct wilc_vif *vif, struct add_sta_param *pstrStationParam) { s32 result = 0; struct wid wid; u8 *pu8CurrByte; + struct host_if_drv *hif_drv = vif->hif_drv; PRINT_D(HOSTINF_DBG, "Handling add station\n"); wid.id = (u16)WID_ADD_STA; @@ -2416,7 +2436,7 @@ ERRORHANDLER: kfree(wid.val); } -static void Handle_DelAllSta(struct host_if_drv *hif_drv, +static void Handle_DelAllSta(struct wilc_vif *vif, struct del_all_sta *pstrDelAllStaParam) { s32 result = 0; @@ -2424,6 +2444,7 @@ static void Handle_DelAllSta(struct host_if_drv *hif_drv, u8 *pu8CurrByte; u8 i; u8 au8Zero_Buff[6] = {0}; + struct host_if_drv *hif_drv = vif->hif_drv; wid.id = (u16)WID_DEL_ALL_STA; wid.type = WID_STR; @@ -2459,12 +2480,13 @@ ERRORHANDLER: up(&hif_sema_wait_response); } -static void Handle_DelStation(struct host_if_drv *hif_drv, +static void Handle_DelStation(struct wilc_vif *vif, struct del_sta *pstrDelStaParam) { s32 result = 0; struct wid wid; u8 *pu8CurrByte; + struct host_if_drv *hif_drv = vif->hif_drv; wid.id = (u16)WID_REMOVE_STA; wid.type = WID_BIN; @@ -2489,12 +2511,13 @@ ERRORHANDLER: kfree(wid.val); } -static void Handle_EditStation(struct host_if_drv *hif_drv, +static void Handle_EditStation(struct wilc_vif *vif, struct add_sta_param *pstrStationParam) { s32 result = 0; struct wid wid; u8 *pu8CurrByte; + struct host_if_drv *hif_drv = vif->hif_drv; wid.id = (u16)WID_EDIT_STA; wid.type = WID_BIN; @@ -2518,12 +2541,13 @@ ERRORHANDLER: kfree(wid.val); } -static int Handle_RemainOnChan(struct host_if_drv *hif_drv, +static int Handle_RemainOnChan(struct wilc_vif *vif, struct remain_ch *pstrHostIfRemainOnChan) { s32 result = 0; u8 u8remain_on_chan_flag; struct wid wid; + struct host_if_drv *hif_drv = vif->hif_drv; if (!hif_drv->remain_on_ch_pending) { hif_drv->remain_on_ch.arg = pstrHostIfRemainOnChan->arg; @@ -2577,7 +2601,7 @@ static int Handle_RemainOnChan(struct host_if_drv *hif_drv, ERRORHANDLER: { P2P_LISTEN_STATE = 1; - hif_drv->remain_on_ch_timer.data = (unsigned long)hif_drv; + hif_drv->remain_on_ch_timer.data = (unsigned long)vif; mod_timer(&hif_drv->remain_on_ch_timer, jiffies + msecs_to_jiffies(pstrHostIfRemainOnChan->u32duration)); @@ -2592,12 +2616,13 @@ ERRORHANDLER: return result; } -static int Handle_RegisterFrame(struct host_if_drv *hif_drv, +static int Handle_RegisterFrame(struct wilc_vif *vif, struct reg_frame *pstrHostIfRegisterFrame) { s32 result = 0; struct wid wid; u8 *pu8CurrByte; + struct host_if_drv *hif_drv = vif->hif_drv; PRINT_D(HOSTINF_DBG, "Handling frame register : %d FrameType: %d\n", pstrHostIfRegisterFrame->reg, @@ -2627,12 +2652,13 @@ static int Handle_RegisterFrame(struct host_if_drv *hif_drv, return result; } -static u32 Handle_ListenStateExpired(struct host_if_drv *hif_drv, +static u32 Handle_ListenStateExpired(struct wilc_vif *vif, struct remain_ch *pstrHostIfRemainOnChan) { u8 u8remain_on_chan_flag; struct wid wid; s32 result = 0; + struct host_if_drv *hif_drv = vif->hif_drv; PRINT_D(HOSTINF_DBG, "CANCEL REMAIN ON CHAN\n"); @@ -2676,26 +2702,27 @@ static void ListenTimerCB(unsigned long arg) { s32 result = 0; struct host_if_msg msg; - struct host_if_drv *hif_drv = (struct host_if_drv *)arg; + struct wilc_vif *vif = (struct wilc_vif *)arg; - del_timer(&hif_drv->remain_on_ch_timer); + del_timer(&vif->hif_drv->remain_on_ch_timer); memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; - msg.drv = hif_drv; - msg.body.remain_on_ch.id = hif_drv->remain_on_ch.id; + msg.vif = vif; + msg.body.remain_on_ch.id = vif->hif_drv->remain_on_ch.id; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) PRINT_ER("wilc_mq_send fail\n"); } -static void Handle_PowerManagement(struct host_if_drv *hif_drv, +static void Handle_PowerManagement(struct wilc_vif *vif, struct power_mgmt_param *strPowerMgmtParam) { s32 result = 0; struct wid wid; s8 s8PowerMode; + struct host_if_drv *hif_drv = vif->hif_drv; wid.id = (u16)WID_POWER_MANAGEMENT; @@ -2715,12 +2742,13 @@ static void Handle_PowerManagement(struct host_if_drv *hif_drv, PRINT_ER("Failed to send power management config packet\n"); } -static void Handle_SetMulticastFilter(struct host_if_drv *hif_drv, +static void Handle_SetMulticastFilter(struct wilc_vif *vif, struct set_multicast *strHostIfSetMulti) { s32 result = 0; struct wid wid; u8 *pu8CurrByte; + struct host_if_drv *hif_drv = vif->hif_drv; PRINT_D(HOSTINF_DBG, "Setup Multicast Filter\n"); @@ -2755,12 +2783,13 @@ ERRORHANDLER: kfree(wid.val); } -static s32 Handle_DelAllRxBASessions(struct host_if_drv *hif_drv, +static s32 Handle_DelAllRxBASessions(struct wilc_vif *vif, struct ba_session_info *strHostIfBASessionInfo) { s32 result = 0; struct wid wid; char *ptr = NULL; + struct host_if_drv *hif_drv = vif->hif_drv; PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\n", strHostIfBASessionInfo->bssid[0], @@ -2834,40 +2863,40 @@ static int hostIFthread(void *pvArg) break; case HOST_IF_MSG_SCAN: - Handle_Scan(msg.drv, &msg.body.scan_info); + Handle_Scan(msg.vif, &msg.body.scan_info); break; case HOST_IF_MSG_CONNECT: - Handle_Connect(msg.drv, &msg.body.con_info); + Handle_Connect(msg.vif, &msg.body.con_info); break; case HOST_IF_MSG_FLUSH_CONNECT: - Handle_FlushConnect(msg.drv); + Handle_FlushConnect(msg.vif); break; case HOST_IF_MSG_RCVD_NTWRK_INFO: - Handle_RcvdNtwrkInfo(msg.drv, &msg.body.net_info); + Handle_RcvdNtwrkInfo(msg.vif, &msg.body.net_info); break; case HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO: - Handle_RcvdGnrlAsyncInfo(vif, msg.drv, + Handle_RcvdGnrlAsyncInfo(vif, &msg.body.async_info); break; case HOST_IF_MSG_KEY: - Handle_Key(msg.drv, &msg.body.key_info); + Handle_Key(msg.vif, &msg.body.key_info); break; case HOST_IF_MSG_CFG_PARAMS: - handle_cfg_param(msg.drv, &msg.body.cfg_info); + handle_cfg_param(msg.vif, &msg.body.cfg_info); break; case HOST_IF_MSG_SET_CHANNEL: - handle_set_channel(msg.drv, &msg.body.channel_info); + handle_set_channel(msg.vif, &msg.body.channel_info); break; case HOST_IF_MSG_DISCONNECT: - Handle_Disconnect(vif, msg.drv); + Handle_Disconnect(msg.vif); break; case HOST_IF_MSG_RCVD_SCAN_COMPLETE: @@ -2877,124 +2906,126 @@ static int hostIFthread(void *pvArg) if (!wilc_wlan_get_num_conn_ifcs(wilc)) wilc_chip_sleep_manually(wilc); - Handle_ScanDone(msg.drv, SCAN_EVENT_DONE); + Handle_ScanDone(msg.vif, SCAN_EVENT_DONE); if (hif_drv->remain_on_ch_pending) - Handle_RemainOnChan(msg.drv, &msg.body.remain_on_ch); + Handle_RemainOnChan(msg.vif, + &msg.body.remain_on_ch); break; case HOST_IF_MSG_GET_RSSI: - Handle_GetRssi(msg.drv); + Handle_GetRssi(msg.vif); break; case HOST_IF_MSG_GET_LINKSPEED: - Handle_GetLinkspeed(msg.drv); + Handle_GetLinkspeed(msg.vif); break; case HOST_IF_MSG_GET_STATISTICS: - Handle_GetStatistics(msg.drv, (struct rf_info *)msg.body.data); + Handle_GetStatistics(msg.vif, + (struct rf_info *)msg.body.data); break; case HOST_IF_MSG_GET_CHNL: - Handle_GetChnl(msg.drv); + Handle_GetChnl(msg.vif); break; case HOST_IF_MSG_ADD_BEACON: - Handle_AddBeacon(msg.drv, &msg.body.beacon_info); + Handle_AddBeacon(msg.vif, &msg.body.beacon_info); break; case HOST_IF_MSG_DEL_BEACON: - Handle_DelBeacon(msg.drv); + Handle_DelBeacon(msg.vif); break; case HOST_IF_MSG_ADD_STATION: - Handle_AddStation(msg.drv, &msg.body.add_sta_info); + Handle_AddStation(msg.vif, &msg.body.add_sta_info); break; case HOST_IF_MSG_DEL_STATION: - Handle_DelStation(msg.drv, &msg.body.del_sta_info); + Handle_DelStation(msg.vif, &msg.body.del_sta_info); break; case HOST_IF_MSG_EDIT_STATION: - Handle_EditStation(msg.drv, &msg.body.edit_sta_info); + Handle_EditStation(msg.vif, &msg.body.edit_sta_info); break; case HOST_IF_MSG_GET_INACTIVETIME: - Handle_Get_InActiveTime(msg.drv, &msg.body.mac_info); + Handle_Get_InActiveTime(msg.vif, &msg.body.mac_info); break; case HOST_IF_MSG_SCAN_TIMER_FIRED: PRINT_D(HOSTINF_DBG, "Scan Timeout\n"); - Handle_ScanDone(msg.drv, SCAN_EVENT_ABORTED); + Handle_ScanDone(msg.vif, SCAN_EVENT_ABORTED); break; case HOST_IF_MSG_CONNECT_TIMER_FIRED: PRINT_D(HOSTINF_DBG, "Connect Timeout\n"); - Handle_ConnectTimeout(msg.drv); + Handle_ConnectTimeout(msg.vif); break; case HOST_IF_MSG_POWER_MGMT: - Handle_PowerManagement(msg.drv, &msg.body.pwr_mgmt_info); + Handle_PowerManagement(msg.vif, + &msg.body.pwr_mgmt_info); break; case HOST_IF_MSG_SET_WFIDRV_HANDLER: - handle_set_wfi_drv_handler(msg.drv, &msg.body.drv); + handle_set_wfi_drv_handler(msg.vif, &msg.body.drv); break; case HOST_IF_MSG_SET_OPERATION_MODE: - handle_set_operation_mode(msg.drv, &msg.body.mode); + handle_set_operation_mode(msg.vif, &msg.body.mode); break; case HOST_IF_MSG_SET_IPADDRESS: PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); - handle_set_ip_address(vif, msg.drv, + handle_set_ip_address(vif, msg.body.ip_info.ip_addr, msg.body.ip_info.idx); break; case HOST_IF_MSG_GET_IPADDRESS: PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); - handle_get_ip_address(vif, msg.drv, - msg.body.ip_info.idx); + handle_get_ip_address(vif, msg.body.ip_info.idx); break; case HOST_IF_MSG_SET_MAC_ADDRESS: - handle_set_mac_address(msg.drv, + handle_set_mac_address(msg.vif, &msg.body.set_mac_info); break; case HOST_IF_MSG_GET_MAC_ADDRESS: - handle_get_mac_address(msg.drv, + handle_get_mac_address(msg.vif, &msg.body.get_mac_info); break; case HOST_IF_MSG_REMAIN_ON_CHAN: PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REMAIN_ON_CHAN\n"); - Handle_RemainOnChan(msg.drv, &msg.body.remain_on_ch); + Handle_RemainOnChan(msg.vif, &msg.body.remain_on_ch); break; case HOST_IF_MSG_REGISTER_FRAME: PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REGISTER_FRAME\n"); - Handle_RegisterFrame(msg.drv, &msg.body.reg_frame); + Handle_RegisterFrame(msg.vif, &msg.body.reg_frame); break; case HOST_IF_MSG_LISTEN_TIMER_FIRED: - Handle_ListenStateExpired(msg.drv, &msg.body.remain_on_ch); + Handle_ListenStateExpired(msg.vif, &msg.body.remain_on_ch); break; case HOST_IF_MSG_SET_MULTICAST_FILTER: PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_MULTICAST_FILTER\n"); - Handle_SetMulticastFilter(msg.drv, &msg.body.multicast_info); + Handle_SetMulticastFilter(msg.vif, &msg.body.multicast_info); break; case HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS: - Handle_DelAllRxBASessions(msg.drv, &msg.body.session_info); + Handle_DelAllRxBASessions(msg.vif, &msg.body.session_info); break; case HOST_IF_MSG_DEL_ALL_STA: - Handle_DelAllSta(msg.drv, &msg.body.del_all_sta_info); + Handle_DelAllSta(msg.vif, &msg.body.del_all_sta_info); break; default: @@ -3010,11 +3041,11 @@ static int hostIFthread(void *pvArg) static void TimerCB_Scan(unsigned long arg) { - void *pvArg = (void *)arg; + struct wilc_vif *vif = (struct wilc_vif *)arg; struct host_if_msg msg; memset(&msg, 0, sizeof(struct host_if_msg)); - msg.drv = pvArg; + msg.vif = vif; msg.id = HOST_IF_MSG_SCAN_TIMER_FIRED; wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -3022,11 +3053,11 @@ static void TimerCB_Scan(unsigned long arg) static void TimerCB_Connect(unsigned long arg) { - void *pvArg = (void *)arg; + struct wilc_vif *vif = (struct wilc_vif *)arg; struct host_if_msg msg; memset(&msg, 0, sizeof(struct host_if_msg)); - msg.drv = pvArg; + msg.vif = vif; msg.id = HOST_IF_MSG_CONNECT_TIMER_FIRED; wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -3454,7 +3485,7 @@ s32 wilc_set_join_req(struct wilc_vif *vif, u8 *pu8bssid, const u8 *pu8ssid, return -EFAULT; } - hif_drv->connect_timer.data = (unsigned long)hif_drv; + hif_drv->connect_timer.data = (unsigned long)vif; mod_timer(&hif_drv->connect_timer, jiffies + msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT)); @@ -3514,13 +3545,14 @@ s32 wilc_disconnect(struct wilc_vif *vif, u16 u16ReasonCode) return result; } -static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, +static s32 host_int_get_assoc_res_info(struct wilc_vif *vif, u8 *pu8AssocRespInfo, u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen) { s32 result = 0; struct wid wid; + struct host_if_drv *hif_drv = vif->hif_drv; if (!hif_drv) { PRINT_ER("Driver is null\n"); @@ -3758,7 +3790,7 @@ s32 wilc_scan(struct wilc_vif *vif, u8 u8ScanSource, u8 u8ScanType, } PRINT_D(HOSTINF_DBG, ">> Starting the SCAN timer\n"); - hif_drv->scan_timer.data = (unsigned long)hif_drv; + hif_drv->scan_timer.data = (unsigned long)vif; mod_timer(&hif_drv->scan_timer, jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT)); @@ -3790,21 +3822,21 @@ s32 wilc_hif_set_cfg(struct wilc_vif *vif, static void GetPeriodicRSSI(unsigned long arg) { - struct host_if_drv *hif_drv = (struct host_if_drv *)arg; + struct wilc_vif *vif = (struct wilc_vif *)arg; - if (!hif_drv) { + if (!vif->hif_drv) { PRINT_ER("Driver handler is NULL\n"); return; } - if (hif_drv->hif_state == HOST_IF_CONNECTED) { + if (vif->hif_drv->hif_state == HOST_IF_CONNECTED) { s32 result = 0; struct host_if_msg msg; memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_GET_RSSI; - msg.drv = hif_drv; + msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) { @@ -3812,7 +3844,7 @@ static void GetPeriodicRSSI(unsigned long arg) return; } } - periodic_rssi.data = (unsigned long)hif_drv; + periodic_rssi.data = (unsigned long)vif; mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000)); } @@ -3881,7 +3913,7 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) goto _fail_mq_; } setup_timer(&periodic_rssi, GetPeriodicRSSI, - (unsigned long)hif_drv); + (unsigned long)vif); mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000)); } From cd04d221dd6c9ceb5732d2c22c9e3bb7f8830a6a Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:42 +0900 Subject: [PATCH 673/843] staging: wilc1000: pass struct wilc Pass struct wilc to the following functions. The functions need wilc to get proper vif using id from wilc device. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/coreconfigurator.h | 11 ++++++----- drivers/staging/wilc1000/host_interface.c | 9 ++++++--- drivers/staging/wilc1000/wilc_wlan.c | 2 +- drivers/staging/wilc1000/wilc_wlan_cfg.c | 9 +++++---- drivers/staging/wilc1000/wilc_wlan_cfg.h | 4 +++- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h index 3f2a7d3c3a17..fc43d04ca1da 100644 --- a/drivers/staging/wilc1000/coreconfigurator.h +++ b/drivers/staging/wilc1000/coreconfigurator.h @@ -135,9 +135,10 @@ s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo); s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen, tstrConnectRespInfo **ppstrConnectRespInfo); s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo); - -void wilc_network_info_received(u8 *pu8Buffer, u32 u32Length); -void wilc_gnrl_async_info_received(u8 *pu8Buffer, u32 u32Length); -void wilc_scan_complete_received(u8 *pu8Buffer, u32 u32Length); - +void wilc_scan_complete_received(struct wilc *wilc, u8 *pu8Buffer, + u32 u32Length); +void wilc_network_info_received(struct wilc *wilc, u8 *pu8Buffer, + u32 u32Length); +void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *pu8Buffer, + u32 u32Length); #endif diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 007b9a0f95fc..123887cf8ec9 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4028,7 +4028,8 @@ s32 wilc_deinit(struct wilc_vif *vif) return result; } -void wilc_network_info_received(u8 *pu8Buffer, u32 u32Length) +void wilc_network_info_received(struct wilc *wilc, u8 *pu8Buffer, + u32 u32Length) { s32 result = 0; struct host_if_msg msg; @@ -4057,7 +4058,8 @@ void wilc_network_info_received(u8 *pu8Buffer, u32 u32Length) PRINT_ER("Error in sending network info message queue message parameters: Error(%d)\n", result); } -void wilc_gnrl_async_info_received(u8 *pu8Buffer, u32 u32Length) +void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *pu8Buffer, + u32 u32Length) { s32 result = 0; struct host_if_msg msg; @@ -4098,7 +4100,8 @@ void wilc_gnrl_async_info_received(u8 *pu8Buffer, u32 u32Length) up(&hif_sema_deinit); } -void wilc_scan_complete_received(u8 *pu8Buffer, u32 u32Length) +void wilc_scan_complete_received(struct wilc *wilc, u8 *pu8Buffer, + u32 u32Length) { s32 result = 0; struct host_if_msg msg; diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 768a42c22dd4..00f346454e00 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -988,7 +988,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) } else { struct wilc_cfg_rsp rsp; - wilc_wlan_cfg_indicate_rx(&buffer[pkt_offset + offset], pkt_len, &rsp); + wilc_wlan_cfg_indicate_rx(wilc, &buffer[pkt_offset + offset], pkt_len, &rsp); if (rsp.type == WILC_CFG_RSP) { PRINT_D(RX_DBG, "wilc->cfg_seq_no = %d - rsp.seq_no = %d\n", wilc->cfg_seq_no, rsp.seq_no); if (wilc->cfg_seq_no == rsp.seq_no) diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c index f62c0e696a01..b72c77bb35f1 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.c +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c @@ -495,7 +495,8 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size) return ret; } -int wilc_wlan_cfg_indicate_rx(u8 *frame, int size, struct wilc_cfg_rsp *rsp) +int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size, + struct wilc_cfg_rsp *rsp) { int ret = 1; u8 msg_type; @@ -522,17 +523,17 @@ int wilc_wlan_cfg_indicate_rx(u8 *frame, int size, struct wilc_cfg_rsp *rsp) rsp->seq_no = msg_id; /*call host interface info parse as well*/ PRINT_INFO(RX_DBG, "Info message received\n"); - wilc_gnrl_async_info_received(frame - 4, size + 4); + wilc_gnrl_async_info_received(wilc, frame - 4, size + 4); break; case 'N': - wilc_network_info_received(frame - 4, size + 4); + wilc_network_info_received(wilc, frame - 4, size + 4); rsp->type = 0; break; case 'S': PRINT_INFO(RX_DBG, "Scan Notification Received\n"); - wilc_scan_complete_received(frame - 4, size + 4); + wilc_scan_complete_received(wilc, frame - 4, size + 4); break; default: diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.h b/drivers/staging/wilc1000/wilc_wlan_cfg.h index 443b2d5b6db8..5f74eb83562f 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.h +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.h @@ -30,10 +30,12 @@ typedef struct { u8 *str; } wilc_cfg_str_t; +struct wilc; int wilc_wlan_cfg_set_wid(u8 *frame, u32 offset, u16 id, u8 *buf, int size); int wilc_wlan_cfg_get_wid(u8 *frame, u32 offset, u16 id); int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size); -int wilc_wlan_cfg_indicate_rx(u8 *frame, int size, struct wilc_cfg_rsp *rsp); +int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size, + struct wilc_cfg_rsp *rsp); int wilc_wlan_cfg_init(wilc_debug_func func); #endif From eb9939b76007ab6dfa14f6664e6cf4deda9c56cd Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:43 +0900 Subject: [PATCH 674/843] staging: wilc1000: use vif index to communicate with wilc device We now have vif index in all functions related with host interface thread. wilc_get_vif_idx and wilc_get_vif_from_idx are added to get id and vif respectively. Relace get_id_from_handler with wilc_get_vif_idx and get_handler_from_id with wilc_get_vif_from_idx. Remove unused function get_handler_from_id as well. We get vif where wilc_get_vif_from_idx is called, so pass vif to msg.vif. There are two get_id_from_handler left. They will be removed in later patch. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 127 ++++++++++++++-------- 1 file changed, 81 insertions(+), 46 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 123887cf8ec9..0a9060c9c837 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -309,11 +309,28 @@ static int get_id_from_handler(struct host_if_drv *handler) return 0; } -static struct host_if_drv *get_handler_from_id(int id) +/* The u8IfIdx starts from 0 to NUM_CONCURRENT_IFC -1, but 0 index used as + * special purpose in wilc device, so we add 1 to the index to starts from 1. + * As a result, the returned index will be 1 to NUM_CONCURRENT_IFC. + */ +static int wilc_get_vif_idx(struct wilc_vif *vif) { - if (id <= 0 || id >= ARRAY_SIZE(wfidrv_list)) + return vif->u8IfIdx + 1; +} + +/* We need to minus 1 from idx which is from wilc device to get real index + * of wilc->vif[], because we add 1 when pass to wilc device in the function + * wilc_get_vif_idx. + * As a result, the index should be between 0 and NUM_CONCURRENT_IFC -1. + */ +static struct wilc_vif *wilc_get_vif_from_idx(struct wilc *wilc, int idx) +{ + int index = idx - 1; + + if (index < 0 || index >= NUM_CONCURRENT_IFC) return NULL; - return wfidrv_list[id]; + + return wilc->vif[index]; } static s32 handle_set_channel(struct wilc_vif *vif, @@ -331,7 +348,7 @@ static s32 handle_set_channel(struct wilc_vif *vif, PRINT_D(HOSTINF_DBG, "Setting channel\n"); result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result) { PRINT_ER("Failed to set channel\n"); @@ -380,7 +397,7 @@ static s32 handle_set_operation_mode(struct wilc_vif *vif, wid.size = sizeof(u32); result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if ((hif_op_mode->mode) == IDLE_MODE) up(&hif_sema_driver); @@ -418,7 +435,7 @@ static s32 handle_set_ip_address(struct wilc_vif *vif, u8 *ip_addr, u8 idx) wid.size = IP_ALEN; result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); host_int_get_ipaddress(vif, hif_drv, firmware_ip_addr, idx); @@ -444,7 +461,7 @@ static s32 handle_get_ip_address(struct wilc_vif *vif, u8 idx) wid.size = IP_ALEN; result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); PRINT_INFO(HOSTINF_DBG, "%pI4\n", wid.val); @@ -488,7 +505,7 @@ static s32 handle_set_mac_address(struct wilc_vif *vif, PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", wid.val); result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result) { PRINT_ER("Failed to set mac address\n"); result = -EFAULT; @@ -511,7 +528,7 @@ static s32 handle_get_mac_address(struct wilc_vif *vif, wid.size = ETH_ALEN; result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result) { PRINT_ER("Failed to get mac address\n"); @@ -807,7 +824,7 @@ static s32 handle_cfg_param(struct wilc_vif *vif, } result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, wid_list, - wid_cnt, get_id_from_handler(hif_drv)); + wid_cnt, wilc_get_vif_idx(vif)); if (result) PRINT_ER("Error in setting CFG params\n"); @@ -932,7 +949,7 @@ static s32 Handle_Scan(struct wilc_vif *vif, result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, strWIDList, u32WidsCount, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result) PRINT_ER("Failed to send scan paramters config packet\n"); @@ -977,7 +994,7 @@ static s32 Handle_ScanDone(struct wilc_vif *vif, wid.size = sizeof(char); result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result) { PRINT_ER("Failed to set abort running scan\n"); @@ -1234,7 +1251,7 @@ static s32 Handle_Connect(struct wilc_vif *vif, result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, strWIDList, u32WidsCount, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result) { PRINT_ER("failed to send config packet\n"); result = -EFAULT; @@ -1395,7 +1412,7 @@ static s32 Handle_ConnectTimeout(struct wilc_vif *vif) PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result) PRINT_ER("Failed to send dissconect config packet\n"); @@ -1790,7 +1807,7 @@ static int Handle_Key(struct wilc_vif *vif, result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, strWIDList, 4, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); kfree(pu8keybuf); } else if (pstrHostIFkeyAttr->action & ADDKEY) { PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); @@ -1812,7 +1829,7 @@ static int Handle_Key(struct wilc_vif *vif, result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); kfree(pu8keybuf); } else if (pstrHostIFkeyAttr->action & REMOVEKEY) { PRINT_D(HOSTINF_DBG, "Removing key\n"); @@ -1825,7 +1842,7 @@ static int Handle_Key(struct wilc_vif *vif, result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); } else { wid.id = (u16)WID_KEY_ID; wid.type = WID_CHAR; @@ -1836,7 +1853,7 @@ static int Handle_Key(struct wilc_vif *vif, result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); } up(&hif_drv->sem_test_key_block); break; @@ -1870,7 +1887,7 @@ static int Handle_Key(struct wilc_vif *vif, result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, strWIDList, 2, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); kfree(pu8keybuf); up(&hif_drv->sem_test_key_block); @@ -1902,7 +1919,7 @@ static int Handle_Key(struct wilc_vif *vif, result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); kfree(pu8keybuf); up(&hif_drv->sem_test_key_block); @@ -1942,7 +1959,7 @@ _WPARxGtk_end_case_: result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, strWIDList, 2, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); kfree(pu8keybuf); up(&hif_drv->sem_test_key_block); } else if (pstrHostIFkeyAttr->action & ADDKEY) { @@ -1965,7 +1982,7 @@ _WPARxGtk_end_case_: result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); kfree(pu8keybuf); up(&hif_drv->sem_test_key_block); } @@ -2000,7 +2017,7 @@ _WPAPtk_end_case_: wid.size = (pstrHostIFkeyAttr->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1; result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); kfree(pu8keybuf); break; @@ -2033,7 +2050,7 @@ static void Handle_Disconnect(struct wilc_vif *vif) eth_zero_addr(wilc_connected_ssid); result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result) { PRINT_ER("Failed to send dissconect config packet\n"); @@ -2124,7 +2141,7 @@ static s32 Handle_GetChnl(struct wilc_vif *vif) PRINT_D(HOSTINF_DBG, "Getting channel value\n"); result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result) { PRINT_ER("Failed to get channel number\n"); @@ -2149,7 +2166,7 @@ static void Handle_GetRssi(struct wilc_vif *vif) PRINT_D(HOSTINF_DBG, "Getting RSSI value\n"); result = wilc_send_config_pkt(vif->hif_drv->wilc, GET_CFG, &wid, 1, - get_id_from_handler(vif->hif_drv)); + wilc_get_vif_idx(vif)); if (result) { PRINT_ER("Failed to get RSSI value\n"); result = -EFAULT; @@ -2174,7 +2191,7 @@ static void Handle_GetLinkspeed(struct wilc_vif *vif) PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n"); result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result) { PRINT_ER("Failed to get LINKSPEED value\n"); result = -EFAULT; @@ -2222,7 +2239,7 @@ static s32 Handle_GetStatistics(struct wilc_vif *vif, result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, strWIDList, u32WidsCount, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result) PRINT_ER("Failed to send scan paramters config packet\n"); @@ -2250,7 +2267,7 @@ static s32 Handle_Get_InActiveTime(struct wilc_vif *vif, PRINT_D(CFG80211_DBG, "SETING STA inactive time\n"); result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result) { PRINT_ER("Failed to SET incative time\n"); @@ -2263,7 +2280,7 @@ static s32 Handle_Get_InActiveTime(struct wilc_vif *vif, wid.size = sizeof(u32); result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result) { PRINT_ER("Failed to get incative time\n"); @@ -2323,7 +2340,7 @@ static void Handle_AddBeacon(struct wilc_vif *vif, pu8CurrByte += pstrSetBeaconParam->tail_len; result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result) PRINT_ER("Failed to send add beacon config packet\n"); @@ -2353,7 +2370,7 @@ static void Handle_DelBeacon(struct wilc_vif *vif) PRINT_D(HOSTINF_DBG, "Deleting BEACON\n"); result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result) PRINT_ER("Failed to send delete beacon config packet\n"); } @@ -2427,7 +2444,7 @@ static void Handle_AddStation(struct wilc_vif *vif, pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result != 0) PRINT_ER("Failed to send add station config packet\n"); @@ -2470,7 +2487,7 @@ static void Handle_DelAllSta(struct wilc_vif *vif, } result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result) PRINT_ER("Failed to send add station config packet\n"); @@ -2503,7 +2520,7 @@ static void Handle_DelStation(struct wilc_vif *vif, memcpy(pu8CurrByte, pstrDelStaParam->mac_addr, ETH_ALEN); result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result) PRINT_ER("Failed to send add station config packet\n"); @@ -2532,7 +2549,7 @@ static void Handle_EditStation(struct wilc_vif *vif, pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result) PRINT_ER("Failed to send edit station config packet\n"); @@ -2594,7 +2611,7 @@ static int Handle_RemainOnChan(struct wilc_vif *vif, wid.val[1] = (s8)pstrHostIfRemainOnChan->ch; result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result != 0) PRINT_ER("Failed to set remain on channel\n"); @@ -2643,7 +2660,7 @@ static int Handle_RegisterFrame(struct wilc_vif *vif, wid.size = sizeof(u16) + 2; result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result) { PRINT_ER("Failed to frame register config packet\n"); result = -EINVAL; @@ -2678,7 +2695,7 @@ static u32 Handle_ListenStateExpired(struct wilc_vif *vif, wid.val[1] = FALSE_FRMWR_CHANNEL; result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result != 0) { PRINT_ER("Failed to set remain on channel\n"); goto _done_; @@ -2737,7 +2754,7 @@ static void Handle_PowerManagement(struct wilc_vif *vif, PRINT_D(HOSTINF_DBG, "Handling Power Management\n"); result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result) PRINT_ER("Failed to send power management config packet\n"); } @@ -2775,7 +2792,7 @@ static void Handle_SetMulticastFilter(struct wilc_vif *vif, ((strHostIfSetMulti->cnt) * ETH_ALEN)); result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result) PRINT_ER("Failed to send setup multicast config packet\n"); @@ -2812,7 +2829,7 @@ static s32 Handle_DelAllRxBASessions(struct wilc_vif *vif, *ptr++ = 32; result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result) PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n"); @@ -3565,7 +3582,7 @@ static s32 host_int_get_assoc_res_info(struct wilc_vif *vif, wid.size = u32MaxAssocRespInfoLen; result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1, - get_id_from_handler(hif_drv)); + wilc_get_vif_idx(vif)); if (result) { *pu32RcvdAssocRespInfoLen = 0; PRINT_ER("Failed to send association response config packet\n"); @@ -4035,9 +4052,13 @@ void wilc_network_info_received(struct wilc *wilc, u8 *pu8Buffer, struct host_if_msg msg; int id; struct host_if_drv *hif_drv = NULL; + struct wilc_vif *vif; id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); - hif_drv = get_handler_from_id(id); + vif = wilc_get_vif_from_idx(wilc, id); + if (!vif) + return; + hif_drv = vif->hif_drv; if (!hif_drv || hif_drv == terminated_handle) { PRINT_ER("NetworkInfo received but driver not init[%p]\n", hif_drv); @@ -4048,6 +4069,7 @@ void wilc_network_info_received(struct wilc *wilc, u8 *pu8Buffer, msg.id = HOST_IF_MSG_RCVD_NTWRK_INFO; msg.drv = hif_drv; + msg.vif = vif; msg.body.net_info.len = u32Length; msg.body.net_info.buffer = kmalloc(u32Length, GFP_KERNEL); @@ -4065,11 +4087,18 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *pu8Buffer, struct host_if_msg msg; int id; struct host_if_drv *hif_drv = NULL; + struct wilc_vif *vif; down(&hif_sema_deinit); id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); - hif_drv = get_handler_from_id(id); + vif = wilc_get_vif_from_idx(wilc, id); + if (!vif) { + up(&hif_sema_deinit); + return; + } + + hif_drv = vif->hif_drv; PRINT_D(HOSTINF_DBG, "General asynchronous info packet received\n"); if (!hif_drv || hif_drv == terminated_handle) { @@ -4088,6 +4117,7 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *pu8Buffer, msg.id = HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO; msg.drv = hif_drv; + msg.vif = vif; msg.body.async_info.len = u32Length; msg.body.async_info.buffer = kmalloc(u32Length, GFP_KERNEL); @@ -4107,9 +4137,13 @@ void wilc_scan_complete_received(struct wilc *wilc, u8 *pu8Buffer, struct host_if_msg msg; int id; struct host_if_drv *hif_drv = NULL; + struct wilc_vif *vif; id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); - hif_drv = get_handler_from_id(id); + vif = wilc_get_vif_from_idx(wilc, id); + if (!vif) + return; + hif_drv = vif->hif_drv; PRINT_D(GENERIC_DBG, "Scan notification received %p\n", hif_drv); @@ -4121,6 +4155,7 @@ void wilc_scan_complete_received(struct wilc *wilc, u8 *pu8Buffer, msg.id = HOST_IF_MSG_RCVD_SCAN_COMPLETE; msg.drv = hif_drv; + msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); if (result) From 31f0f697dddd739a0581ca373d53b648ba50c00b Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:44 +0900 Subject: [PATCH 675/843] staging: wilc1000: wilc_set_wfi_drv_handler: pass vif index Pass index of vif instead of hif_drv. wilc_get_vif_idx is used to get correct index of vif. In the handler function handle_set_wfi_drv_handler, use vif instead of hif_drv, and use hif_drv_handler->handler instead of hif_drv when deinitialize wilc device. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 14 ++++++-------- drivers/staging/wilc1000/host_interface.h | 3 ++- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 12 +++++++----- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 0a9060c9c837..be88237f2352 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -313,7 +313,7 @@ static int get_id_from_handler(struct host_if_drv *handler) * special purpose in wilc device, so we add 1 to the index to starts from 1. * As a result, the returned index will be 1 to NUM_CONCURRENT_IFC. */ -static int wilc_get_vif_idx(struct wilc_vif *vif) +int wilc_get_vif_idx(struct wilc_vif *vif) { return vif->u8IfIdx + 1; } @@ -363,17 +363,16 @@ static s32 handle_set_wfi_drv_handler(struct wilc_vif *vif, { s32 result = 0; struct wid wid; - struct host_if_drv *hif_drv = vif->hif_drv; wid.id = (u16)WID_SET_DRV_HANDLER; wid.type = WID_INT; wid.val = (s8 *)&hif_drv_handler->handler; wid.size = sizeof(u32); - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, hif_drv_handler->handler); - if (!hif_drv) + if (!hif_drv_handler->handler) up(&hif_sema_driver); if (result) { @@ -3638,15 +3637,14 @@ int wilc_wait_msg_queue_idle(void) return result; } -int wilc_set_wfi_drv_handler(struct wilc_vif *vif, struct host_if_drv *hif_drv) +int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index) { int result = 0; struct host_if_msg msg; memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_SET_WFIDRV_HANDLER; - msg.body.drv.handler = get_id_from_handler(hif_drv); - msg.drv = hif_drv; + msg.body.drv.handler = index; msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -4001,7 +3999,7 @@ s32 wilc_deinit(struct wilc_vif *vif) del_timer_sync(&hif_drv->remain_on_ch_timer); - wilc_set_wfi_drv_handler(vif, NULL); + wilc_set_wfi_drv_handler(vif, 0); down(&hif_sema_driver); if (hif_drv->usr_scan_req.scan_result) { diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 9716bc859dca..8922f291a68e 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -367,13 +367,14 @@ s32 wilc_remain_on_channel(struct wilc_vif *vif, u32 u32SessionID, void *pvUserArg); s32 wilc_listen_state_expired(struct wilc_vif *vif, u32 u32SessionID); s32 wilc_frame_register(struct wilc_vif *vif, u16 u16FrameType, bool bReg); -int wilc_set_wfi_drv_handler(struct wilc_vif *vif, struct host_if_drv *hif_drv); +int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index); int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode); void wilc_free_join_params(void *pJoinParams); s32 wilc_get_statistics(struct wilc_vif *vif, struct rf_info *pstrStatistics); void wilc_resolve_disconnect_aberration(struct wilc_vif *vif); +int wilc_get_vif_idx(struct wilc_vif *vif); extern bool wilc_optaining_ip; extern u8 wilc_connected_ssid[6]; diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index da4c4adefeed..53fb2d4bb0bd 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -628,7 +628,7 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) priv->u32RcvdChCount = 0; - wilc_set_wfi_drv_handler(vif, priv->hWILCWFIDrv); + wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif)); reset_shadow_found(); priv->bCfgScanning = true; @@ -709,7 +709,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, vif = netdev_priv(priv->dev); pstrWFIDrv = (struct host_if_drv *)(priv->hWILCWFIDrv); - wilc_set_wfi_drv_handler(vif, priv->hWILCWFIDrv); + wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif)); PRINT_D(CFG80211_DBG, "Connecting to SSID [%s] on netdev [%p] host if [%p]\n", sme->ssid, dev, priv->hWILCWFIDrv); if (!(strncmp(sme->ssid, "DIRECT-", 7))) { @@ -2142,7 +2142,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, wilc_initialized = 1; vif->iftype = interface_type; - wilc_set_wfi_drv_handler(vif, wl->vif[0]->hif_drv); + wilc_set_wfi_drv_handler(vif, + wilc_get_vif_idx(wl->vif[0])); wilc_set_mac_address(wl->vif[0], wl->vif[0]->src_addr); wilc_set_operation_mode(vif, STATION_MODE); @@ -2217,7 +2218,8 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, wilc1000_wlan_init(dev, vif); wilc_initialized = 1; - wilc_set_wfi_drv_handler(vif, wl->vif[0]->hif_drv); + wilc_set_wfi_drv_handler(vif, + wilc_get_vif_idx(wl->vif[0])); wilc_set_mac_address(wl->vif[0], wl->vif[0]->src_addr); wilc_set_operation_mode(vif, STATION_MODE); @@ -2320,7 +2322,7 @@ static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev, wilc1000_wlan_init(dev, vif); wilc_initialized = 1; - wilc_set_wfi_drv_handler(vif, wl->vif[0]->hif_drv); + wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(wl->vif[0])); wilc_set_mac_address(wl->vif[0], wl->vif[0]->src_addr); wilc_set_operation_mode(vif, AP_MODE); From 7036c6244d0d26fd603cff81f07faa30c5f97022 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:45 +0900 Subject: [PATCH 676/843] staging: wilc1000: change join_req_drv type and it's name To use wilc_get_vif_idx instead of the last get_id_from_handler, join_req_drv needs to be changed it's type with wilc_vif and name as well. As a result, get_id_from_handler is not used anymore, so remove it. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 33 +++++++---------------- 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index be88237f2352..e9a206c496eb 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -259,7 +259,7 @@ static u8 mode_11i; static u8 auth_type; static u32 join_req_size; static u32 info_element_size; -static struct host_if_drv *join_req_drv; +static struct wilc_vif *join_req_vif; #define REAL_JOIN_REQ 0 #define FLUSHED_JOIN_REQ 1 #define FLUSHED_BYTE_POS 79 @@ -294,21 +294,6 @@ static int remove_handler_in_list(struct host_if_drv *handler) return -EINVAL; } -static int get_id_from_handler(struct host_if_drv *handler) -{ - int i; - - if (!handler) - return 0; - - for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { - if (wfidrv_list[i] == handler) - return i; - } - - return 0; -} - /* The u8IfIdx starts from 0 to NUM_CONCURRENT_IFC -1, but 0 index used as * special purpose in wilc device, so we add 1 to the index to starts from 1. * As a result, the returned index will be 1 to NUM_CONCURRENT_IFC. @@ -1235,7 +1220,7 @@ static s32 Handle_Connect(struct wilc_vif *vif, if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) { memcpy(join_req, pu8CurrByte, join_req_size); - join_req_drv = hif_drv; + join_req_vif = vif; } PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n"); @@ -1349,7 +1334,7 @@ static s32 Handle_FlushConnect(struct wilc_vif *vif) result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, strWIDList, u32WidsCount, - get_id_from_handler(join_req_drv)); + wilc_get_vif_idx(join_req_vif)); if (result) { PRINT_ER("failed to send config packet\n"); result = -EINVAL; @@ -1426,12 +1411,12 @@ static s32 Handle_ConnectTimeout(struct wilc_vif *vif) eth_zero_addr(wilc_connected_ssid); - if (join_req && join_req_drv == hif_drv) { + if (join_req && join_req_vif == vif) { kfree(join_req); join_req = NULL; } - if (info_element && join_req_drv == hif_drv) { + if (info_element && join_req_vif == vif) { kfree(info_element); info_element = NULL; } @@ -1724,12 +1709,12 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif, kfree(hif_drv->usr_conn_req.ies); hif_drv->usr_conn_req.ies = NULL; - if (join_req && join_req_drv == hif_drv) { + if (join_req && join_req_vif == vif) { kfree(join_req); join_req = NULL; } - if (info_element && join_req_drv == hif_drv) { + if (info_element && join_req_vif == vif) { kfree(info_element); info_element = NULL; } @@ -2101,12 +2086,12 @@ static void Handle_Disconnect(struct wilc_vif *vif) kfree(hif_drv->usr_conn_req.ies); hif_drv->usr_conn_req.ies = NULL; - if (join_req && join_req_drv == hif_drv) { + if (join_req && join_req_vif == vif) { kfree(join_req); join_req = NULL; } - if (info_element && join_req_drv == hif_drv) { + if (info_element && join_req_vif == vif) { kfree(info_element); info_element = NULL; } From e79dcf7eaac60aad96df102f01340a161a7e9f39 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:46 +0900 Subject: [PATCH 677/843] staging: wilc1000: remove used functions This patch remove unused functions add_handler_in_list and remove_handler_in_list, and it's related global variable wfidrv_list and codes. label fail_timer_2 and it's codes are removed since label is not used anymore. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 44 ----------------------- 1 file changed, 44 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index e9a206c496eb..46e009edb5cf 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -226,7 +226,6 @@ struct join_bss_param { u8 start_time[4]; }; -static struct host_if_drv *wfidrv_list[NUM_CONCURRENT_IFC + 1]; struct host_if_drv *terminated_handle; bool wilc_optaining_ip; static u8 P2P_LISTEN_STATE; @@ -266,34 +265,6 @@ static struct wilc_vif *join_req_vif; static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo); -static int add_handler_in_list(struct host_if_drv *handler) -{ - int i; - - for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { - if (!wfidrv_list[i]) { - wfidrv_list[i] = handler; - return 0; - } - } - - return -ENOBUFS; -} - -static int remove_handler_in_list(struct host_if_drv *handler) -{ - int i; - - for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { - if (wfidrv_list[i] == handler) { - wfidrv_list[i] = NULL; - return 0; - } - } - - return -EINVAL; -} - /* The u8IfIdx starts from 0 to NUM_CONCURRENT_IFC -1, but 0 index used as * special purpose in wilc device, so we add 1 to the index to starts from 1. * As a result, the returned index will be 1 to NUM_CONCURRENT_IFC. @@ -3852,7 +3823,6 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) { s32 result = 0; struct host_if_drv *hif_drv; - int err; struct wilc_vif *vif; struct wilc *wilc; @@ -3872,11 +3842,6 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) } hif_drv->wilc = wilc; *hif_drv_handler = hif_drv; - err = add_handler_in_list(hif_drv); - if (err) { - result = -EFAULT; - goto _fail_timer_2; - } wilc_optaining_ip = false; @@ -3946,10 +3911,6 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) return result; -_fail_timer_2: - del_timer_sync(&hif_drv->connect_timer); - del_timer_sync(&hif_drv->scan_timer); - kthread_stop(hif_thread_handler); _fail_mq_: wilc_mq_destroy(&hif_msg_q); _fail_: @@ -3961,7 +3922,6 @@ s32 wilc_deinit(struct wilc_vif *vif) s32 result = 0; struct host_if_msg msg; struct host_if_drv *hif_drv = vif->hif_drv; - int ret; if (!hif_drv) { PRINT_ER("hif_drv = NULL\n"); @@ -4016,10 +3976,6 @@ s32 wilc_deinit(struct wilc_vif *vif) wilc_mq_destroy(&hif_msg_q); } - ret = remove_handler_in_list(hif_drv); - if (ret) - result = -ENOENT; - kfree(hif_drv); clients_count--; From b13584a899bf07f3ef693f8ebd1774d57f88906e Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:47 +0900 Subject: [PATCH 678/843] staging: wilc1000: remove drv of struct host_if_msg This patch remove drv of struct host_if msg and it's related codes. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 50 ++--------------------- 1 file changed, 3 insertions(+), 47 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 46e009edb5cf..45e4bb786096 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -193,7 +193,6 @@ union message_body { struct host_if_msg { u16 id; union message_body body; - struct host_if_drv *drv; struct wilc_vif *vif; }; @@ -2799,7 +2798,6 @@ static int hostIFthread(void *pvArg) { u32 u32Ret; struct host_if_msg msg; - struct host_if_drv *hif_drv; struct wilc *wilc = (struct wilc*)pvArg; struct wilc_vif *vif; @@ -2807,7 +2805,6 @@ static int hostIFthread(void *pvArg) while (1) { wilc_mq_recv(&hif_msg_q, &msg, sizeof(struct host_if_msg), &u32Ret); - hif_drv = (struct host_if_drv *)msg.drv; vif = msg.vif; if (msg.id == HOST_IF_MSG_EXIT) { PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n"); @@ -2822,7 +2819,7 @@ static int hostIFthread(void *pvArg) } if (msg.id == HOST_IF_MSG_CONNECT && - hif_drv->usr_scan_req.scan_result) { + vif->hif_drv->usr_scan_req.scan_result) { PRINT_D(HOSTINF_DBG, "Requeue connect request till scan done received\n"); wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); usleep_range(2 * 1000, 2 * 1000); @@ -2872,7 +2869,7 @@ static int hostIFthread(void *pvArg) break; case HOST_IF_MSG_RCVD_SCAN_COMPLETE: - del_timer(&hif_drv->scan_timer); + del_timer(&vif->hif_drv->scan_timer); PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); if (!wilc_wlan_get_num_conn_ifcs(wilc)) @@ -2880,7 +2877,7 @@ static int hostIFthread(void *pvArg) Handle_ScanDone(msg.vif, SCAN_EVENT_DONE); - if (hif_drv->remain_on_ch_pending) + if (vif->hif_drv->remain_on_ch_pending) Handle_RemainOnChan(msg.vif, &msg.body.remain_on_ch); @@ -3064,7 +3061,6 @@ int wilc_remove_wep_key(struct wilc_vif *vif, u8 index) msg.id = HOST_IF_MSG_KEY; msg.body.key_info.type = WEP; msg.body.key_info.action = REMOVEKEY; - msg.drv = hif_drv; msg.vif = vif; msg.body.key_info.attr.wep.index = index; @@ -3093,7 +3089,6 @@ int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index) msg.id = HOST_IF_MSG_KEY; msg.body.key_info.type = WEP; msg.body.key_info.action = DEFAULTKEY; - msg.drv = hif_drv; msg.vif = vif; msg.body.key_info.attr.wep.index = index; @@ -3122,7 +3117,6 @@ int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len, msg.id = HOST_IF_MSG_KEY; msg.body.key_info.type = WEP; msg.body.key_info.action = ADDKEY; - msg.drv = hif_drv; msg.vif = vif; msg.body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL); if (!msg.body.key_info.attr.wep.key) @@ -3161,7 +3155,6 @@ int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len, msg.id = HOST_IF_MSG_KEY; msg.body.key_info.type = WEP; msg.body.key_info.action = ADDKEY_AP; - msg.drv = hif_drv; msg.vif = vif; msg.body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL); if (!msg.body.key_info.attr.wep.key) @@ -3235,7 +3228,6 @@ int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len, msg.body.key_info.attr.wpa.key_len = key_len; msg.body.key_info.attr.wpa.mac_addr = mac_addr; msg.body.key_info.attr.wpa.mode = cipher_mode; - msg.drv = hif_drv; msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -3280,7 +3272,6 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len, msg.id = HOST_IF_MSG_KEY; msg.body.key_info.type = WPA_RX_GTK; - msg.drv = hif_drv; msg.vif = vif; if (mode == AP_MODE) { @@ -3335,7 +3326,6 @@ s32 wilc_set_pmkid_info(struct wilc_vif *vif, msg.id = HOST_IF_MSG_KEY; msg.body.key_info.type = PMKSA; msg.body.key_info.action = ADDKEY; - msg.drv = hif_drv; msg.vif = vif; for (i = 0; i < pu8PmkidInfoArray->numpmkid; i++) { @@ -3356,13 +3346,11 @@ s32 wilc_get_mac_address(struct wilc_vif *vif, u8 *pu8MacAddress) { s32 result = 0; struct host_if_msg msg; - struct host_if_drv *hif_drv = vif->hif_drv; memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_GET_MAC_ADDRESS; msg.body.get_mac_info.mac_addr = pu8MacAddress; - msg.drv = hif_drv; msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -3379,14 +3367,12 @@ s32 wilc_set_mac_address(struct wilc_vif *vif, u8 *pu8MacAddress) { s32 result = 0; struct host_if_msg msg; - struct host_if_drv *hif_drv = vif->hif_drv; PRINT_D(GENERIC_DBG, "mac addr = %x:%x:%x\n", pu8MacAddress[0], pu8MacAddress[1], pu8MacAddress[2]); memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_SET_MAC_ADDRESS; memcpy(msg.body.set_mac_info.mac_addr, pu8MacAddress, ETH_ALEN); - msg.drv = hif_drv; msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -3426,7 +3412,6 @@ s32 wilc_set_join_req(struct wilc_vif *vif, u8 *pu8bssid, const u8 *pu8ssid, msg.body.con_info.result = pfConnectResult; msg.body.con_info.arg = pvUserArg; msg.body.con_info.params = pJoinParams; - msg.drv = hif_drv ; msg.vif = vif; if (pu8bssid) { @@ -3479,7 +3464,6 @@ s32 wilc_flush_join_req(struct wilc_vif *vif) } msg.id = HOST_IF_MSG_FLUSH_CONNECT; - msg.drv = hif_drv; msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -3505,7 +3489,6 @@ s32 wilc_disconnect(struct wilc_vif *vif, u16 u16ReasonCode) memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_DISCONNECT; - msg.drv = hif_drv; msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -3563,7 +3546,6 @@ int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel) memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_SET_CHANNEL; msg.body.channel_info.set_ch = channel; - msg.drv = hif_drv; msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -3616,12 +3598,10 @@ int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode) { int result = 0; struct host_if_msg msg; - struct host_if_drv *hif_drv = vif->hif_drv; memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_SET_OPERATION_MODE; msg.body.mode.mode = mode; - msg.drv = hif_drv; msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -3649,7 +3629,6 @@ s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac, memcpy(msg.body.mac_info.mac, mac, ETH_ALEN); msg.id = HOST_IF_MSG_GET_INACTIVETIME; - msg.drv = hif_drv; msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -3671,7 +3650,6 @@ s32 wilc_get_rssi(struct wilc_vif *vif, s8 *ps8Rssi) memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_GET_RSSI; - msg.drv = hif_drv; msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -3696,12 +3674,10 @@ s32 wilc_get_statistics(struct wilc_vif *vif, struct rf_info *pstrStatistics) { s32 result = 0; struct host_if_msg msg; - struct host_if_drv *hif_drv = vif->hif_drv; memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_GET_STATISTICS; msg.body.data = (char *)pstrStatistics; - msg.drv = hif_drv; msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -3739,7 +3715,6 @@ s32 wilc_scan(struct wilc_vif *vif, u8 u8ScanSource, u8 u8ScanType, } else PRINT_D(HOSTINF_DBG, "pstrHiddenNetwork IS EQUAL TO NULL\n"); - msg.drv = hif_drv; msg.vif = vif; msg.body.scan_info.src = u8ScanSource; msg.body.scan_info.type = u8ScanType; @@ -3783,7 +3758,6 @@ s32 wilc_hif_set_cfg(struct wilc_vif *vif, memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_CFG_PARAMS; msg.body.cfg_info.cfg_attr_info = *pstrCfgParamVal; - msg.drv = hif_drv; msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -3964,7 +3938,6 @@ s32 wilc_deinit(struct wilc_vif *vif) PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); msg.id = HOST_IF_MSG_EXIT; - msg.drv = hif_drv; msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -4007,7 +3980,6 @@ void wilc_network_info_received(struct wilc *wilc, u8 *pu8Buffer, memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_RCVD_NTWRK_INFO; - msg.drv = hif_drv; msg.vif = vif; msg.body.net_info.len = u32Length; @@ -4055,7 +4027,6 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *pu8Buffer, memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO; - msg.drv = hif_drv; msg.vif = vif; msg.body.async_info.len = u32Length; @@ -4093,7 +4064,6 @@ void wilc_scan_complete_received(struct wilc *wilc, u8 *pu8Buffer, memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_RCVD_SCAN_COMPLETE; - msg.drv = hif_drv; msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -4128,7 +4098,6 @@ s32 wilc_remain_on_channel(struct wilc_vif *vif, u32 u32SessionID, msg.body.remain_on_ch.arg = pvUserArg; msg.body.remain_on_ch.u32duration = u32duration; msg.body.remain_on_ch.id = u32SessionID; - msg.drv = hif_drv; msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -4153,7 +4122,6 @@ s32 wilc_listen_state_expired(struct wilc_vif *vif, u32 u32SessionID) memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; - msg.drv = hif_drv; msg.vif = vif; msg.body.remain_on_ch.id = u32SessionID; @@ -4195,7 +4163,6 @@ s32 wilc_frame_register(struct wilc_vif *vif, u16 u16FrameType, bool bReg) } msg.body.reg_frame.frame_type = u16FrameType; msg.body.reg_frame.reg = bReg; - msg.drv = hif_drv; msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -4223,7 +4190,6 @@ s32 wilc_add_beacon(struct wilc_vif *vif, u32 u32Interval, u32 u32DTIMPeriod, PRINT_D(HOSTINF_DBG, "Setting adding beacon message queue params\n"); msg.id = HOST_IF_MSG_ADD_BEACON; - msg.drv = hif_drv; msg.vif = vif; pstrSetBeaconParam->interval = u32Interval; pstrSetBeaconParam->dtim_period = u32DTIMPeriod; @@ -4272,7 +4238,6 @@ int wilc_del_beacon(struct wilc_vif *vif) } msg.id = HOST_IF_MSG_DEL_BEACON; - msg.drv = hif_drv; msg.vif = vif; PRINT_D(HOSTINF_DBG, "Setting deleting beacon message queue params\n"); @@ -4300,7 +4265,6 @@ int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param) PRINT_D(HOSTINF_DBG, "Setting adding station message queue params\n"); msg.id = HOST_IF_MSG_ADD_STATION; - msg.drv = hif_drv; msg.vif = vif; memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param)); @@ -4335,7 +4299,6 @@ int wilc_del_station(struct wilc_vif *vif, const u8 *mac_addr) PRINT_D(HOSTINF_DBG, "Setting deleting station message queue params\n"); msg.id = HOST_IF_MSG_DEL_STATION; - msg.drv = hif_drv; msg.vif = vif; if (!mac_addr) @@ -4369,7 +4332,6 @@ s32 wilc_del_allstation(struct wilc_vif *vif, u8 pu8MacAddr[][ETH_ALEN]) PRINT_D(HOSTINF_DBG, "Setting deauthenticating station message queue params\n"); msg.id = HOST_IF_MSG_DEL_ALL_STA; - msg.drv = hif_drv; msg.vif = vif; for (i = 0; i < MAX_NUM_STA; i++) { @@ -4419,7 +4381,6 @@ s32 wilc_edit_station(struct wilc_vif *vif, memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_EDIT_STATION; - msg.drv = hif_drv; msg.vif = vif; memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param)); @@ -4460,7 +4421,6 @@ s32 wilc_set_power_mgmt(struct wilc_vif *vif, bool bIsEnabled, u32 u32Timeout) memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_POWER_MGMT; - msg.drv = hif_drv; msg.vif = vif; pstrPowerMgmtParam->enabled = bIsEnabled; @@ -4490,7 +4450,6 @@ s32 wilc_setup_multicast_filter(struct wilc_vif *vif, bool bIsEnabled, memset(&msg, 0, sizeof(struct host_if_msg)); msg.id = HOST_IF_MSG_SET_MULTICAST_FILTER; - msg.drv = hif_drv; msg.vif = vif; pstrMulticastFilterParam->enabled = bIsEnabled; @@ -4685,7 +4644,6 @@ s32 wilc_del_all_rx_ba_session(struct wilc_vif *vif, char *pBSSID, char TID) memcpy(pBASessionInfo->bssid, pBSSID, ETH_ALEN); pBASessionInfo->tid = TID; - msg.drv = hif_drv; msg.vif = vif; result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); @@ -4715,7 +4673,6 @@ s32 wilc_setup_ipaddress(struct wilc_vif *vif, u8 *u16ipadd, u8 idx) msg.id = HOST_IF_MSG_SET_IPADDRESS; msg.body.ip_info.ip_addr = u16ipadd; - msg.drv = hif_drv; msg.vif = vif; msg.body.ip_info.idx = idx; @@ -4743,7 +4700,6 @@ static s32 host_int_get_ipaddress(struct wilc_vif *vif, msg.id = HOST_IF_MSG_GET_IPADDRESS; msg.body.ip_info.ip_addr = u16ipadd; - msg.drv = hif_drv; msg.vif = vif; msg.body.ip_info.idx = idx; From cd2920a50c3a484d67745f15fc9c99c3fd96ac6f Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:48 +0900 Subject: [PATCH 679/843] staging: wilc1000: remove wilc of struct host_if_drv vif has wilc in it's members so no need to have wilc in host_if_drv. It is redundant so just remove it and use wilc of vif. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 100 +++++++++------------- drivers/staging/wilc1000/host_interface.h | 1 - 2 files changed, 41 insertions(+), 60 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 45e4bb786096..d6b23cdc745c 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -293,7 +293,6 @@ static s32 handle_set_channel(struct wilc_vif *vif, { s32 result = 0; struct wid wid; - struct host_if_drv *hif_drv = vif->hif_drv; wid.id = (u16)WID_CURRENT_CHANNEL; wid.type = WID_CHAR; @@ -302,7 +301,7 @@ static s32 handle_set_channel(struct wilc_vif *vif, PRINT_D(HOSTINF_DBG, "Setting channel\n"); - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result) { @@ -343,14 +342,13 @@ static s32 handle_set_operation_mode(struct wilc_vif *vif, { s32 result = 0; struct wid wid; - struct host_if_drv *hif_drv = vif->hif_drv; wid.id = (u16)WID_SET_OPERATION_MODE; wid.type = WID_INT; wid.val = (s8 *)&hif_op_mode->mode; wid.size = sizeof(u32); - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if ((hif_op_mode->mode) == IDLE_MODE) @@ -388,7 +386,7 @@ static s32 handle_set_ip_address(struct wilc_vif *vif, u8 *ip_addr, u8 idx) wid.val = (u8 *)ip_addr; wid.size = IP_ALEN; - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); host_int_get_ipaddress(vif, hif_drv, firmware_ip_addr, idx); @@ -407,14 +405,13 @@ static s32 handle_get_ip_address(struct wilc_vif *vif, u8 idx) { s32 result = 0; struct wid wid; - struct host_if_drv *hif_drv = vif->hif_drv; wid.id = (u16)WID_IP_ADDRESS; wid.type = WID_STR; wid.val = kmalloc(IP_ALEN, GFP_KERNEL); wid.size = IP_ALEN; - result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, GET_CFG, &wid, 1, wilc_get_vif_idx(vif)); PRINT_INFO(HOSTINF_DBG, "%pI4\n", wid.val); @@ -443,7 +440,6 @@ static s32 handle_set_mac_address(struct wilc_vif *vif, { s32 result = 0; struct wid wid; - struct host_if_drv *hif_drv = vif->hif_drv; u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL); if (!mac_buf) { @@ -458,7 +454,7 @@ static s32 handle_set_mac_address(struct wilc_vif *vif, wid.size = ETH_ALEN; PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", wid.val); - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result) { PRINT_ER("Failed to set mac address\n"); @@ -474,14 +470,13 @@ static s32 handle_get_mac_address(struct wilc_vif *vif, { s32 result = 0; struct wid wid; - struct host_if_drv *hif_drv = vif->hif_drv; wid.id = (u16)WID_MAC_ADDR; wid.type = WID_STR; wid.val = get_mac_addr->mac_addr; wid.size = ETH_ALEN; - result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, GET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result) { @@ -777,7 +772,7 @@ static s32 handle_cfg_param(struct wilc_vif *vif, wid_cnt++; } - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, wid_list, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, wid_list, wid_cnt, wilc_get_vif_idx(vif)); if (result) @@ -901,7 +896,7 @@ static s32 Handle_Scan(struct wilc_vif *vif, else if (hif_drv->hif_state == HOST_IF_IDLE) scan_while_connected = false; - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, strWIDList, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, strWIDList, u32WidsCount, wilc_get_vif_idx(vif)); @@ -947,7 +942,7 @@ static s32 Handle_ScanDone(struct wilc_vif *vif, wid.val = (s8 *)&u8abort_running_scan; wid.size = sizeof(char); - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result) { @@ -1203,7 +1198,7 @@ static s32 Handle_Connect(struct wilc_vif *vif, PRINT_D(GENERIC_DBG, "save bssid = %pM\n", wilc_connected_ssid); } - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, strWIDList, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, strWIDList, u32WidsCount, wilc_get_vif_idx(vif)); if (result) { @@ -1271,7 +1266,6 @@ static s32 Handle_FlushConnect(struct wilc_vif *vif) struct wid strWIDList[5]; u32 u32WidsCount = 0; u8 *pu8CurrByte = NULL; - struct host_if_drv *hif_drv = vif->hif_drv; strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE; strWIDList[u32WidsCount].type = WID_BIN_DATA; @@ -1302,7 +1296,7 @@ static s32 Handle_FlushConnect(struct wilc_vif *vif) u32WidsCount++; - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, strWIDList, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, strWIDList, u32WidsCount, wilc_get_vif_idx(join_req_vif)); if (result) { @@ -1365,7 +1359,7 @@ static s32 Handle_ConnectTimeout(struct wilc_vif *vif) PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result) PRINT_ER("Failed to send dissconect config packet\n"); @@ -1759,7 +1753,7 @@ static int Handle_Key(struct wilc_vif *vif, strWIDList[3].size = pstrHostIFkeyAttr->attr.wep.key_len; strWIDList[3].val = (s8 *)pu8keybuf; - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, strWIDList, 4, wilc_get_vif_idx(vif)); kfree(pu8keybuf); @@ -1781,7 +1775,7 @@ static int Handle_Key(struct wilc_vif *vif, wid.val = (s8 *)pu8keybuf; wid.size = pstrHostIFkeyAttr->attr.wep.key_len + 2; - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); kfree(pu8keybuf); @@ -1794,7 +1788,7 @@ static int Handle_Key(struct wilc_vif *vif, wid.val = s8idxarray; wid.size = 1; - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); } else { @@ -1805,7 +1799,7 @@ static int Handle_Key(struct wilc_vif *vif, PRINT_D(HOSTINF_DBG, "Setting default key index\n"); - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); } @@ -1839,7 +1833,7 @@ static int Handle_Key(struct wilc_vif *vif, strWIDList[1].val = (s8 *)pu8keybuf; strWIDList[1].size = RX_MIC_KEY_MSG_LEN; - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, strWIDList, 2, wilc_get_vif_idx(vif)); @@ -1871,7 +1865,7 @@ static int Handle_Key(struct wilc_vif *vif, wid.val = (s8 *)pu8keybuf; wid.size = RX_MIC_KEY_MSG_LEN; - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); @@ -1911,7 +1905,7 @@ _WPARxGtk_end_case_: strWIDList[1].val = (s8 *)pu8keybuf; strWIDList[1].size = PTK_KEY_MSG_LEN + 1; - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, strWIDList, 2, wilc_get_vif_idx(vif)); kfree(pu8keybuf); @@ -1934,7 +1928,7 @@ _WPARxGtk_end_case_: wid.val = (s8 *)pu8keybuf; wid.size = PTK_KEY_MSG_LEN; - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); kfree(pu8keybuf); @@ -1970,7 +1964,7 @@ _WPAPtk_end_case_: wid.val = (s8 *)pu8keybuf; wid.size = (pstrHostIFkeyAttr->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1; - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); kfree(pu8keybuf); @@ -2003,7 +1997,7 @@ static void Handle_Disconnect(struct wilc_vif *vif) eth_zero_addr(wilc_connected_ssid); - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result) { @@ -2094,7 +2088,7 @@ static s32 Handle_GetChnl(struct wilc_vif *vif) PRINT_D(HOSTINF_DBG, "Getting channel value\n"); - result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, GET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result) { @@ -2119,7 +2113,7 @@ static void Handle_GetRssi(struct wilc_vif *vif) PRINT_D(HOSTINF_DBG, "Getting RSSI value\n"); - result = wilc_send_config_pkt(vif->hif_drv->wilc, GET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, GET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result) { PRINT_ER("Failed to get RSSI value\n"); @@ -2144,7 +2138,7 @@ static void Handle_GetLinkspeed(struct wilc_vif *vif) PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n"); - result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, GET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result) { PRINT_ER("Failed to get LINKSPEED value\n"); @@ -2159,7 +2153,6 @@ static s32 Handle_GetStatistics(struct wilc_vif *vif, { struct wid strWIDList[5]; u32 u32WidsCount = 0, result = 0; - struct host_if_drv *hif_drv = vif->hif_drv; strWIDList[u32WidsCount].id = WID_LINKSPEED; strWIDList[u32WidsCount].type = WID_CHAR; @@ -2191,7 +2184,7 @@ static s32 Handle_GetStatistics(struct wilc_vif *vif, strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->tx_fail_cnt; u32WidsCount++; - result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, strWIDList, + result = wilc_send_config_pkt(vif->wilc, GET_CFG, strWIDList, u32WidsCount, wilc_get_vif_idx(vif)); @@ -2220,7 +2213,7 @@ static s32 Handle_Get_InActiveTime(struct wilc_vif *vif, PRINT_D(CFG80211_DBG, "SETING STA inactive time\n"); - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result) { @@ -2233,7 +2226,7 @@ static s32 Handle_Get_InActiveTime(struct wilc_vif *vif, wid.val = (s8 *)&inactive_time; wid.size = sizeof(u32); - result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, GET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result) { @@ -2254,7 +2247,6 @@ static void Handle_AddBeacon(struct wilc_vif *vif, s32 result = 0; struct wid wid; u8 *pu8CurrByte; - struct host_if_drv *hif_drv = vif->hif_drv; PRINT_D(HOSTINF_DBG, "Adding BEACON\n"); @@ -2293,7 +2285,7 @@ static void Handle_AddBeacon(struct wilc_vif *vif, memcpy(pu8CurrByte, pstrSetBeaconParam->tail, pstrSetBeaconParam->tail_len); pu8CurrByte += pstrSetBeaconParam->tail_len; - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result) PRINT_ER("Failed to send add beacon config packet\n"); @@ -2309,7 +2301,6 @@ static void Handle_DelBeacon(struct wilc_vif *vif) s32 result = 0; struct wid wid; u8 *pu8CurrByte; - struct host_if_drv *hif_drv = vif->hif_drv; wid.id = (u16)WID_DEL_BEACON; wid.type = WID_CHAR; @@ -2323,7 +2314,7 @@ static void Handle_DelBeacon(struct wilc_vif *vif) PRINT_D(HOSTINF_DBG, "Deleting BEACON\n"); - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result) PRINT_ER("Failed to send delete beacon config packet\n"); @@ -2383,7 +2374,6 @@ static void Handle_AddStation(struct wilc_vif *vif, s32 result = 0; struct wid wid; u8 *pu8CurrByte; - struct host_if_drv *hif_drv = vif->hif_drv; PRINT_D(HOSTINF_DBG, "Handling add station\n"); wid.id = (u16)WID_ADD_STA; @@ -2397,7 +2387,7 @@ static void Handle_AddStation(struct wilc_vif *vif, pu8CurrByte = wid.val; pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result != 0) PRINT_ER("Failed to send add station config packet\n"); @@ -2415,7 +2405,6 @@ static void Handle_DelAllSta(struct wilc_vif *vif, u8 *pu8CurrByte; u8 i; u8 au8Zero_Buff[6] = {0}; - struct host_if_drv *hif_drv = vif->hif_drv; wid.id = (u16)WID_DEL_ALL_STA; wid.type = WID_STR; @@ -2440,7 +2429,7 @@ static void Handle_DelAllSta(struct wilc_vif *vif, pu8CurrByte += ETH_ALEN; } - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result) PRINT_ER("Failed to send add station config packet\n"); @@ -2457,7 +2446,6 @@ static void Handle_DelStation(struct wilc_vif *vif, s32 result = 0; struct wid wid; u8 *pu8CurrByte; - struct host_if_drv *hif_drv = vif->hif_drv; wid.id = (u16)WID_REMOVE_STA; wid.type = WID_BIN; @@ -2473,7 +2461,7 @@ static void Handle_DelStation(struct wilc_vif *vif, memcpy(pu8CurrByte, pstrDelStaParam->mac_addr, ETH_ALEN); - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result) PRINT_ER("Failed to send add station config packet\n"); @@ -2488,7 +2476,6 @@ static void Handle_EditStation(struct wilc_vif *vif, s32 result = 0; struct wid wid; u8 *pu8CurrByte; - struct host_if_drv *hif_drv = vif->hif_drv; wid.id = (u16)WID_EDIT_STA; wid.type = WID_BIN; @@ -2502,7 +2489,7 @@ static void Handle_EditStation(struct wilc_vif *vif, pu8CurrByte = wid.val; pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result) PRINT_ER("Failed to send edit station config packet\n"); @@ -2564,7 +2551,7 @@ static int Handle_RemainOnChan(struct wilc_vif *vif, wid.val[0] = u8remain_on_chan_flag; wid.val[1] = (s8)pstrHostIfRemainOnChan->ch; - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result != 0) PRINT_ER("Failed to set remain on channel\n"); @@ -2593,7 +2580,6 @@ static int Handle_RegisterFrame(struct wilc_vif *vif, s32 result = 0; struct wid wid; u8 *pu8CurrByte; - struct host_if_drv *hif_drv = vif->hif_drv; PRINT_D(HOSTINF_DBG, "Handling frame register : %d FrameType: %d\n", pstrHostIfRegisterFrame->reg, @@ -2613,7 +2599,7 @@ static int Handle_RegisterFrame(struct wilc_vif *vif, wid.size = sizeof(u16) + 2; - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result) { PRINT_ER("Failed to frame register config packet\n"); @@ -2648,7 +2634,7 @@ static u32 Handle_ListenStateExpired(struct wilc_vif *vif, wid.val[0] = u8remain_on_chan_flag; wid.val[1] = FALSE_FRMWR_CHANNEL; - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result != 0) { PRINT_ER("Failed to set remain on channel\n"); @@ -2693,7 +2679,6 @@ static void Handle_PowerManagement(struct wilc_vif *vif, s32 result = 0; struct wid wid; s8 s8PowerMode; - struct host_if_drv *hif_drv = vif->hif_drv; wid.id = (u16)WID_POWER_MANAGEMENT; @@ -2707,7 +2692,7 @@ static void Handle_PowerManagement(struct wilc_vif *vif, PRINT_D(HOSTINF_DBG, "Handling Power Management\n"); - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result) PRINT_ER("Failed to send power management config packet\n"); @@ -2719,7 +2704,6 @@ static void Handle_SetMulticastFilter(struct wilc_vif *vif, s32 result = 0; struct wid wid; u8 *pu8CurrByte; - struct host_if_drv *hif_drv = vif->hif_drv; PRINT_D(HOSTINF_DBG, "Setup Multicast Filter\n"); @@ -2745,7 +2729,7 @@ static void Handle_SetMulticastFilter(struct wilc_vif *vif, memcpy(pu8CurrByte, wilc_multicast_mac_addr_list, ((strHostIfSetMulti->cnt) * ETH_ALEN)); - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result) PRINT_ER("Failed to send setup multicast config packet\n"); @@ -2760,7 +2744,6 @@ static s32 Handle_DelAllRxBASessions(struct wilc_vif *vif, s32 result = 0; struct wid wid; char *ptr = NULL; - struct host_if_drv *hif_drv = vif->hif_drv; PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\n", strHostIfBASessionInfo->bssid[0], @@ -2782,7 +2765,7 @@ static s32 Handle_DelAllRxBASessions(struct wilc_vif *vif, *ptr++ = 0; *ptr++ = 32; - result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result) PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n"); @@ -3519,7 +3502,7 @@ static s32 host_int_get_assoc_res_info(struct wilc_vif *vif, wid.val = pu8AssocRespInfo; wid.size = u32MaxAssocRespInfoLen; - result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1, + result = wilc_send_config_pkt(vif->wilc, GET_CFG, &wid, 1, wilc_get_vif_idx(vif)); if (result) { *pu32RcvdAssocRespInfoLen = 0; @@ -3814,7 +3797,6 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) result = -ENOMEM; goto _fail_; } - hif_drv->wilc = wilc; *hif_drv_handler = hif_drv; wilc_optaining_ip = false; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 8922f291a68e..8faac27002e9 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -261,7 +261,6 @@ enum p2p_listen_state { struct wilc; struct host_if_drv { - struct wilc *wilc; struct user_scan_req usr_scan_req; struct user_conn_req usr_conn_req; struct remain_ch remain_on_ch; From 03efae328ddcda7826a3bedb2ac15eb9598eabb4 Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:49 +0900 Subject: [PATCH 680/843] staging: wilc1000: set hif_drv before it is used We are using hif_drv of vif, so it needs to be set before it is used. Set hif_drv to vif->hifdrv soon after it is allocated. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/host_interface.c | 6 ++++++ drivers/staging/wilc1000/linux_wlan.c | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index d6b23cdc745c..8c7752034032 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -3782,6 +3782,7 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) struct host_if_drv *hif_drv; struct wilc_vif *vif; struct wilc *wilc; + int i; vif = netdev_priv(dev); wilc = vif->wilc; @@ -3798,6 +3799,11 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) goto _fail_; } *hif_drv_handler = hif_drv; + for (i = 0; i < wilc->vif_num; i++) + if (dev == wilc->vif[i]->ndev) { + wilc->vif[i]->hif_drv = hif_drv; + break; + } wilc_optaining_ip = false; diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index a50e3ffcbb8d..54fe9d74b780 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1036,7 +1036,6 @@ int wilc_mac_open(struct net_device *ndev) for (i = 0; i < wl->vif_num; i++) { if (ndev == wl->vif[i]->ndev) { memcpy(wl->vif[i]->src_addr, mac_add, ETH_ALEN); - wl->vif[i]->hif_drv = priv->hWILCWFIDrv; break; } } From 608b0515b75292a3f890356f976849050c519d6a Mon Sep 17 00:00:00 2001 From: Glen Lee Date: Mon, 21 Dec 2015 14:18:50 +0900 Subject: [PATCH 681/843] staging: wilc1000: bug fix on memory free Set tx_buffer to NULL not to free again the memory that is already freed, which could cause system crash when device is failed. Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 00f346454e00..83af51bb83e8 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1374,6 +1374,7 @@ void wilc_wlan_cleanup(struct net_device *dev) kfree(wilc->rx_buffer); wilc->rx_buffer = NULL; kfree(wilc->tx_buffer); + wilc->tx_buffer = NULL; acquire_bus(wilc, ACQUIRE_AND_WAKEUP); From d9c0e6c10dfed44bb35d6db4293b18af51e752ac Mon Sep 17 00:00:00 2001 From: Chen Feng Date: Mon, 12 Oct 2015 15:00:15 +0800 Subject: [PATCH 682/843] docs: dts: Add documentation for hi6220 SoC ION node Documentation for hi6220 SoC ION node Signed-off-by: Chen Feng Signed-off-by: Yu Dongbin Signed-off-by: Greg Kroah-Hartman --- .../bindings/staging/ion/hi6220-ion.txt | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Documentation/devicetree/bindings/staging/ion/hi6220-ion.txt diff --git a/Documentation/devicetree/bindings/staging/ion/hi6220-ion.txt b/Documentation/devicetree/bindings/staging/ion/hi6220-ion.txt new file mode 100644 index 000000000000..c59e27c632c1 --- /dev/null +++ b/Documentation/devicetree/bindings/staging/ion/hi6220-ion.txt @@ -0,0 +1,31 @@ +Hi6220 SoC ION +=================================================================== +Required properties: +- compatible : "hisilicon,hi6220-ion" +- list of the ION heaps + - heap name : maybe heap_sys_user@0 + - heap id : id should be unique in the system. + - heap base : base ddr address of the heap,0 means that + it is dynamic. + - heap size : memory size and 0 means it is dynamic. + - heap type : the heap type of the heap, please also + see the define in ion.h(drivers/staging/android/uapi/ion.h) +------------------------------------------------------------------- +Example: + hi6220-ion { + compatible = "hisilicon,hi6220-ion"; + heap_sys_user@0 { + heap-name = "sys_user"; + heap-id = <0x0>; + heap-base = <0x0>; + heap-size = <0x0>; + heap-type = "ion_system"; + }; + heap_sys_contig@0 { + heap-name = "sys_contig"; + heap-id = <0x1>; + heap-base = <0x0>; + heap-size = <0x0>; + heap-type = "ion_system_contig"; + }; + }; From 2b40182a19bc238465688fb989fb33b99e953121 Mon Sep 17 00:00:00 2001 From: Chen Feng Date: Mon, 12 Oct 2015 15:00:16 +0800 Subject: [PATCH 683/843] staging: android: ion: Add ion driver for Hi6220 SoC platform Add ion support for hi6220 SoC platform. Signed-off-by: Chen Feng Signed-off-by: Yu Dongbin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ion/Kconfig | 7 + drivers/staging/android/ion/Makefile | 1 + drivers/staging/android/ion/hisilicon/Kconfig | 5 + .../staging/android/ion/hisilicon/Makefile | 1 + .../android/ion/hisilicon/hi6220_ion.c | 223 ++++++++++++++++++ 5 files changed, 237 insertions(+) create mode 100644 drivers/staging/android/ion/hisilicon/Kconfig create mode 100644 drivers/staging/android/ion/hisilicon/Makefile create mode 100644 drivers/staging/android/ion/hisilicon/hi6220_ion.c diff --git a/drivers/staging/android/ion/Kconfig b/drivers/staging/android/ion/Kconfig index 345234624492..19c1572f1525 100644 --- a/drivers/staging/android/ion/Kconfig +++ b/drivers/staging/android/ion/Kconfig @@ -33,3 +33,10 @@ config ION_TEGRA help Choose this option if you wish to use ion on an nVidia Tegra. +config ION_HISI + tristate "Ion for Hisilicon" + depends on ARCH_HISI && ION + help + Choose this option if you wish to use ion on Hisilicon Platform. + +source "drivers/staging/android/ion/hisilicon/Kconfig" diff --git a/drivers/staging/android/ion/Makefile b/drivers/staging/android/ion/Makefile index b56fd2bf2b4f..18cc2aa593c2 100644 --- a/drivers/staging/android/ion/Makefile +++ b/drivers/staging/android/ion/Makefile @@ -7,4 +7,5 @@ endif obj-$(CONFIG_ION_DUMMY) += ion_dummy_driver.o obj-$(CONFIG_ION_TEGRA) += tegra/ +obj-$(CONFIG_ION_HISI) += hisilicon/ diff --git a/drivers/staging/android/ion/hisilicon/Kconfig b/drivers/staging/android/ion/hisilicon/Kconfig new file mode 100644 index 000000000000..2b4bd0798290 --- /dev/null +++ b/drivers/staging/android/ion/hisilicon/Kconfig @@ -0,0 +1,5 @@ +config HI6220_ION + bool "Hi6220 ION Driver" + depends on ARCH_HISI && ION + help + Build the Hisilicon Hi6220 ion driver. diff --git a/drivers/staging/android/ion/hisilicon/Makefile b/drivers/staging/android/ion/hisilicon/Makefile new file mode 100644 index 000000000000..2a89414280ac --- /dev/null +++ b/drivers/staging/android/ion/hisilicon/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_HI6220_ION) += hi6220_ion.o diff --git a/drivers/staging/android/ion/hisilicon/hi6220_ion.c b/drivers/staging/android/ion/hisilicon/hi6220_ion.c new file mode 100644 index 000000000000..e3c07b2ba00e --- /dev/null +++ b/drivers/staging/android/ion/hisilicon/hi6220_ion.c @@ -0,0 +1,223 @@ +/* + * Hisilicon Hi6220 ION Driver + * + * Copyright (c) 2015 Hisilicon Limited. + * + * Author: Chen Feng + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#define pr_fmt(fmt) "Ion: " fmt + +#include +#include +#include +#include +#include +#include "../ion_priv.h" +#include "../ion.h" + +struct hi6220_ion_type_table { + const char *name; + enum ion_heap_type type; +}; + +static struct hi6220_ion_type_table ion_type_table[] = { + {"ion_system", ION_HEAP_TYPE_SYSTEM}, + {"ion_system_contig", ION_HEAP_TYPE_SYSTEM_CONTIG}, + {"ion_carveout", ION_HEAP_TYPE_CARVEOUT}, + {"ion_chunk", ION_HEAP_TYPE_CHUNK}, + {"ion_dma", ION_HEAP_TYPE_DMA}, + {"ion_custom", ION_HEAP_TYPE_CUSTOM}, +}; + +static struct ion_device *idev; +static int num_heaps; +static struct ion_heap **heaps; +static struct ion_platform_heap **heaps_data; + +static int get_type_by_name(const char *name, enum ion_heap_type *type) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(ion_type_table); i++) { + if (strncmp(name, ion_type_table[i].name, strlen(name))) + continue; + + *type = ion_type_table[i].type; + return 0; + } + + return -EINVAL; +} + +static int hi6220_set_platform_data(struct platform_device *pdev) +{ + unsigned int base; + unsigned int size; + unsigned int id; + const char *heap_name; + const char *type_name; + enum ion_heap_type type; + int ret; + struct device_node *np; + struct ion_platform_heap *p_data; + const struct device_node *dt_node = pdev->dev.of_node; + int index = 0; + + for_each_child_of_node(dt_node, np) + num_heaps++; + + heaps_data = devm_kzalloc(&pdev->dev, + sizeof(struct ion_platform_heap *) * + num_heaps, + GFP_KERNEL); + if (!heaps_data) + return -ENOMEM; + + for_each_child_of_node(dt_node, np) { + ret = of_property_read_string(np, "heap-name", &heap_name); + if (ret < 0) { + pr_err("check the name of node %s\n", np->name); + continue; + } + + ret = of_property_read_u32(np, "heap-id", &id); + if (ret < 0) { + pr_err("check the id %s\n", np->name); + continue; + } + + ret = of_property_read_u32(np, "heap-base", &base); + if (ret < 0) { + pr_err("check the base of node %s\n", np->name); + continue; + } + + ret = of_property_read_u32(np, "heap-size", &size); + if (ret < 0) { + pr_err("check the size of node %s\n", np->name); + continue; + } + + ret = of_property_read_string(np, "heap-type", &type_name); + if (ret < 0) { + pr_err("check the type of node %s\n", np->name); + continue; + } + + ret = get_type_by_name(type_name, &type); + if (ret < 0) { + pr_err("type name error %s!\n", type_name); + continue; + } + pr_info("heap index %d : name %s base 0x%x size 0x%x id %d type %d\n", + index, heap_name, base, size, id, type); + + p_data = devm_kzalloc(&pdev->dev, + sizeof(struct ion_platform_heap), + GFP_KERNEL); + if (!p_data) + return -ENOMEM; + + p_data->name = heap_name; + p_data->base = base; + p_data->size = size; + p_data->id = id; + p_data->type = type; + + heaps_data[index] = p_data; + index++; + } + return 0; +} + +static int hi6220_ion_probe(struct platform_device *pdev) +{ + int i; + int err; + static struct ion_platform_heap *p_heap; + + idev = ion_device_create(NULL); + err = hi6220_set_platform_data(pdev); + if (err) { + pr_err("ion set platform data error!\n"); + goto err_free_idev; + } + heaps = devm_kzalloc(&pdev->dev, + sizeof(struct ion_heap *) * num_heaps, + GFP_KERNEL); + if (!heaps) { + err = -ENOMEM; + goto err_free_idev; + } + + /* + * create the heaps as specified in the dts file + */ + for (i = 0; i < num_heaps; i++) { + p_heap = heaps_data[i]; + heaps[i] = ion_heap_create(p_heap); + if (IS_ERR_OR_NULL(heaps[i])) { + err = PTR_ERR(heaps[i]); + goto err_free_heaps; + } + + ion_device_add_heap(idev, heaps[i]); + + pr_info("%s: adding heap %s of type %d with %lx@%lx\n", + __func__, p_heap->name, p_heap->type, + p_heap->base, (unsigned long)p_heap->size); + } + return err; + +err_free_heaps: + for (i = 0; i < num_heaps; ++i) { + ion_heap_destroy(heaps[i]); + heaps[i] = NULL; + } +err_free_idev: + ion_device_destroy(idev); + + return err; +} + +static int hi6220_ion_remove(struct platform_device *pdev) +{ + int i; + + for (i = 0; i < num_heaps; i++) { + ion_heap_destroy(heaps[i]); + heaps[i] = NULL; + } + ion_device_destroy(idev); + + return 0; +} + +static const struct of_device_id hi6220_ion_match_table[] = { + {.compatible = "hisilicon,hi6220-ion"}, + {}, +}; + +static struct platform_driver hi6220_ion_driver = { + .probe = hi6220_ion_probe, + .remove = hi6220_ion_remove, + .driver = { + .name = "ion-hi6220", + .of_match_table = hi6220_ion_match_table, + }, +}; + +static int __init hi6220_ion_init(void) +{ + int ret; + + ret = platform_driver_register(&hi6220_ion_driver); + return ret; +} + +subsys_initcall(hi6220_ion_init); From 59dfafd03fc67d38307d2ba30bbfdd1224b8a75d Mon Sep 17 00:00:00 2001 From: Chen Feng Date: Mon, 12 Oct 2015 15:00:17 +0800 Subject: [PATCH 684/843] arm64: dts: Add dts files to enable ION on Hi6220 SoC. Add ION node to enable ION on hi6220 SoC platform Signed-off-by: Chen Feng Signed-off-by: Yu Dongbin Signed-off-by: Greg Kroah-Hartman --- .../arm64/boot/dts/hisilicon/hi6220-hikey.dts | 1 + arch/arm64/boot/dts/hisilicon/hi6220-ion.dtsi | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 arch/arm64/boot/dts/hisilicon/hi6220-ion.dtsi diff --git a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts index 8d43a0fce522..496a920eced4 100644 --- a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts +++ b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts @@ -11,6 +11,7 @@ /memreserve/ 0x05e00000 0x00100000; #include "hi6220.dtsi" +#include "hi6220-ion.dtsi" / { model = "HiKey Development Board"; diff --git a/arch/arm64/boot/dts/hisilicon/hi6220-ion.dtsi b/arch/arm64/boot/dts/hisilicon/hi6220-ion.dtsi new file mode 100644 index 000000000000..c79f2cea314c --- /dev/null +++ b/arch/arm64/boot/dts/hisilicon/hi6220-ion.dtsi @@ -0,0 +1,20 @@ +/ { + hi6220-ion { + compatible = "hisilicon,hi6220-ion"; + heap_sys_user@0 { + heap-name = "sys_user"; + heap-id = <0x0>; + heap-base = <0x0>; + heap-size = <0x0>; + heap-type = "ion_system"; + }; + heap_sys_contig@0 { + heap-name = "sys_contig"; + heap-id = <0x1>; + heap-base = <0x0>; + heap-size = <0x0>; + heap-type = "ion_system_contig"; + }; + }; + +}; From a2df4e33d71ff819c9afcdf34392030cee349f47 Mon Sep 17 00:00:00 2001 From: Wenwei Tao Date: Wed, 9 Dec 2015 00:15:52 +0800 Subject: [PATCH 685/843] staging: android: ashmem.c: destroy slabs when init fails when ashmem init fails, destroy the slabs, leave no garbage. Signed-off-by: Wenwei Tao Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/ashmem.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index 3f2a3d611e4b..5bb1283d19cd 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -831,14 +831,14 @@ static struct miscdevice ashmem_misc = { static int __init ashmem_init(void) { - int ret; + int ret = -ENOMEM; ashmem_area_cachep = kmem_cache_create("ashmem_area_cache", sizeof(struct ashmem_area), 0, 0, NULL); if (unlikely(!ashmem_area_cachep)) { pr_err("failed to create slab cache\n"); - return -ENOMEM; + goto out; } ashmem_range_cachep = kmem_cache_create("ashmem_range_cache", @@ -846,13 +846,13 @@ static int __init ashmem_init(void) 0, 0, NULL); if (unlikely(!ashmem_range_cachep)) { pr_err("failed to create slab cache\n"); - return -ENOMEM; + goto out_free1; } ret = misc_register(&ashmem_misc); if (unlikely(ret)) { pr_err("failed to register misc device!\n"); - return ret; + goto out_free2; } register_shrinker(&ashmem_shrinker); @@ -860,5 +860,12 @@ static int __init ashmem_init(void) pr_info("initialized\n"); return 0; + +out_free2: + kmem_cache_destroy(ashmem_range_cachep); +out_free1: + kmem_cache_destroy(ashmem_area_cachep); +out: + return ret; } device_initcall(ashmem_init); From 73465f1c08258637dc8c49c2c8d1a1233d9861c7 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Fri, 11 Dec 2015 13:11:49 +0000 Subject: [PATCH 686/843] staging/android/sync: Support sync points created from dma-fences MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Debug output assumes all sync points are built on top of Android sync points and when we start creating them from dma-fences will NULL ptr deref unless taught about this. v4: Corrected patch ownership. Signed-off-by: Maarten Lankhorst Signed-off-by: Tvrtko Ursulin Cc: Maarten Lankhorst Cc: devel@driverdev.osuosl.org Cc: Riley Andrews Cc: Arve Hjønnevåg Reviewed-by: Jesse Barnes Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/sync_debug.c | 42 +++++++++++++++------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/drivers/staging/android/sync_debug.c b/drivers/staging/android/sync_debug.c index 91ed2c4cff45..f45d13cdd42b 100644 --- a/drivers/staging/android/sync_debug.c +++ b/drivers/staging/android/sync_debug.c @@ -82,36 +82,42 @@ static const char *sync_status_str(int status) return "error"; } -static void sync_print_pt(struct seq_file *s, struct sync_pt *pt, bool fence) +static void sync_print_pt(struct seq_file *s, struct fence *pt, bool fence) { int status = 1; - struct sync_timeline *parent = sync_pt_parent(pt); - if (fence_is_signaled_locked(&pt->base)) - status = pt->base.status; + if (fence_is_signaled_locked(pt)) + status = pt->status; seq_printf(s, " %s%spt %s", - fence ? parent->name : "", + fence && pt->ops->get_timeline_name ? + pt->ops->get_timeline_name(pt) : "", fence ? "_" : "", sync_status_str(status)); if (status <= 0) { struct timespec64 ts64 = - ktime_to_timespec64(pt->base.timestamp); + ktime_to_timespec64(pt->timestamp); seq_printf(s, "@%lld.%09ld", (s64)ts64.tv_sec, ts64.tv_nsec); } - if (parent->ops->timeline_value_str && - parent->ops->pt_value_str) { + if ((!fence || pt->ops->timeline_value_str) && + pt->ops->fence_value_str) { char value[64]; + bool success; - parent->ops->pt_value_str(pt, value, sizeof(value)); - seq_printf(s, ": %s", value); - if (fence) { - parent->ops->timeline_value_str(parent, value, - sizeof(value)); - seq_printf(s, " / %s", value); + pt->ops->fence_value_str(pt, value, sizeof(value)); + success = strlen(value); + + if (success) + seq_printf(s, ": %s", value); + + if (success && fence) { + pt->ops->timeline_value_str(pt, value, sizeof(value)); + + if (strlen(value)) + seq_printf(s, " / %s", value); } } @@ -138,7 +144,7 @@ static void sync_print_obj(struct seq_file *s, struct sync_timeline *obj) list_for_each(pos, &obj->child_list_head) { struct sync_pt *pt = container_of(pos, struct sync_pt, child_list); - sync_print_pt(s, pt, false); + sync_print_pt(s, &pt->base, false); } spin_unlock_irqrestore(&obj->child_list_lock, flags); } @@ -153,11 +159,7 @@ static void sync_print_fence(struct seq_file *s, struct sync_fence *fence) sync_status_str(atomic_read(&fence->status))); for (i = 0; i < fence->num_fences; ++i) { - struct sync_pt *pt = - container_of(fence->cbs[i].sync_pt, - struct sync_pt, base); - - sync_print_pt(s, pt, true); + sync_print_pt(s, fence->cbs[i].sync_pt, true); } spin_lock_irqsave(&fence->wq.lock, flags); From 0f477c6dea709465550aa0922fd0c5b686e6e8eb Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Fri, 11 Dec 2015 13:11:50 +0000 Subject: [PATCH 687/843] staging/android/sync: add sync_fence_create_dma MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows users of dma fences to create a android fence. v2: Added kerneldoc. (Tvrtko Ursulin). v4: Updated comments from review feedback my Maarten. Signed-off-by: Maarten Lankhorst Signed-off-by: Tvrtko Ursulin Cc: Maarten Lankhorst Cc: Daniel Vetter Cc: devel@driverdev.osuosl.org Cc: Riley Andrews Cc: Arve Hjønnevåg Reviewed-by: Jesse Barnes Tested-by: Jesse Barnes Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/sync.c | 13 +++++++++---- drivers/staging/android/sync.h | 10 ++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index e0c1acb2ba69..78c62dfb3978 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -188,7 +188,7 @@ static void fence_check_cb_func(struct fence *f, struct fence_cb *cb) } /* TODO: implement a create which takes more that one sync_pt */ -struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt) +struct sync_fence *sync_fence_create_dma(const char *name, struct fence *pt) { struct sync_fence *fence; @@ -199,16 +199,21 @@ struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt) fence->num_fences = 1; atomic_set(&fence->status, 1); - fence->cbs[0].sync_pt = &pt->base; + fence->cbs[0].sync_pt = pt; fence->cbs[0].fence = fence; - if (fence_add_callback(&pt->base, &fence->cbs[0].cb, - fence_check_cb_func)) + if (fence_add_callback(pt, &fence->cbs[0].cb, fence_check_cb_func)) atomic_dec(&fence->status); sync_fence_debug_add(fence); return fence; } +EXPORT_SYMBOL(sync_fence_create_dma); + +struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt) +{ + return sync_fence_create_dma(name, &pt->base); +} EXPORT_SYMBOL(sync_fence_create); struct sync_fence *sync_fence_fdget(int fd) diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h index 61f8a3aede96..afa0752275a7 100644 --- a/drivers/staging/android/sync.h +++ b/drivers/staging/android/sync.h @@ -254,6 +254,16 @@ void sync_pt_free(struct sync_pt *pt); */ struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt); +/** + * sync_fence_create_dma() - creates a sync fence from dma-fence + * @name: name of fence to create + * @pt: dma-fence to add to the fence + * + * Creates a fence containg @pt. Once this is called, the fence takes + * ownership of @pt. + */ +struct sync_fence *sync_fence_create_dma(const char *name, struct fence *pt); + /* * API for sync_fence consumers */ From 699f685569434510d944e419f4048c4e3ba8d631 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Mon, 14 Dec 2015 17:34:08 -0800 Subject: [PATCH 688/843] android: unconditionally remove callbacks in sync_fence_free() Using fence->status to determine whether or not there are callbacks remaining on the sync_fence is racy since fence->status may have been decremented to 0 on another CPU before fence_check_cb_func() has completed. By unconditionally calling fence_remove_callback() for each fence in the sync_fence, we guarantee that each callback has either completed (since fence_remove_callback() grabs the fence lock) or been removed. Signed-off-by: Andrew Bresticker Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/android/sync.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index 78c62dfb3978..ed43796b5b58 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -524,12 +524,10 @@ static const struct fence_ops android_fence_ops = { static void sync_fence_free(struct kref *kref) { struct sync_fence *fence = container_of(kref, struct sync_fence, kref); - int i, status = atomic_read(&fence->status); + int i; for (i = 0; i < fence->num_fences; ++i) { - if (status) - fence_remove_callback(fence->cbs[i].sync_pt, - &fence->cbs[i].cb); + fence_remove_callback(fence->cbs[i].sync_pt, &fence->cbs[i].cb); fence_put(fence->cbs[i].sync_pt); } From 323fd785e396f4252b014665df8a831d91c2f117 Mon Sep 17 00:00:00 2001 From: Dean Luick Date: Mon, 16 Nov 2015 21:59:24 -0500 Subject: [PATCH 689/843] staging/rdma/hfi1: Fix downgrade race A link downgrade can race with link up. Avoid the race in two ways. First, by having the downgrade application logic take the link state mutex for all of its checking. Second, by waiting for the link to move out of the going up state. Reviewed-by: Dennis Dalessandro Signed-off-by: Dean Luick Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/chip.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index dc6915947c78..017d439b327a 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -3907,18 +3907,32 @@ void handle_verify_cap(struct work_struct *work) */ void apply_link_downgrade_policy(struct hfi1_pportdata *ppd, int refresh_widths) { - int skip = 1; int do_bounce = 0; - u16 lwde = ppd->link_width_downgrade_enabled; + int tries; + u16 lwde; u16 tx, rx; + /* use the hls lock to avoid a race with actual link up */ + tries = 0; +retry: mutex_lock(&ppd->hls_lock); /* only apply if the link is up */ - if (ppd->host_link_state & HLS_UP) - skip = 0; - mutex_unlock(&ppd->hls_lock); - if (skip) - return; + if (!(ppd->host_link_state & HLS_UP)) { + /* still going up..wait and retry */ + if (ppd->host_link_state & HLS_GOING_UP) { + if (++tries < 1000) { + mutex_unlock(&ppd->hls_lock); + usleep_range(100, 120); /* arbitrary */ + goto retry; + } + dd_dev_err(ppd->dd, + "%s: giving up waiting for link state change\n", + __func__); + } + goto done; + } + + lwde = ppd->link_width_downgrade_enabled; if (refresh_widths) { get_link_widths(ppd->dd, &tx, &rx); @@ -3956,6 +3970,9 @@ void apply_link_downgrade_policy(struct hfi1_pportdata *ppd, int refresh_widths) do_bounce = 1; } +done: + mutex_unlock(&ppd->hls_lock); + if (do_bounce) { set_link_down_reason(ppd, OPA_LINKDOWN_REASON_WIDTH_POLICY, 0, OPA_LINKDOWN_REASON_WIDTH_POLICY); From 3d305dbdb272c32455d35b2dadda5ca04548a997 Mon Sep 17 00:00:00 2001 From: Vennila Megavannan Date: Mon, 16 Nov 2015 21:59:25 -0500 Subject: [PATCH 690/843] staging/rdma/hfi1: remove RxCtxRHQS from hfi1stats Removed the RxCtxRHQS counter being dumped into dev_cntrs Reviewed-by: Dennis Dalessandro Signed-off-by: Vennila Megavannan Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/chip.c | 2 -- drivers/staging/rdma/hfi1/chip.h | 1 - drivers/staging/rdma/hfi1/chip_registers.h | 1 - 3 files changed, 4 deletions(-) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index 017d439b327a..0817776d3528 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -1587,8 +1587,6 @@ static struct cntr_entry dev_cntrs[DEV_CNTR_LAST] = { [C_RX_TID_FLGMS] = RXE32_DEV_CNTR_ELEM(RxTidFLGMs, RCV_TID_FLOW_GEN_MISMATCH_CNT, CNTR_NORMAL), -[C_RX_CTX_RHQS] = RXE32_DEV_CNTR_ELEM(RxCtxRHQS, RCV_CONTEXT_RHQ_STALL, - CNTR_NORMAL), [C_RX_CTX_EGRS] = RXE32_DEV_CNTR_ELEM(RxCtxEgrS, RCV_CONTEXT_EGR_STALL, CNTR_NORMAL), [C_RCV_TID_FLSMS] = RXE32_DEV_CNTR_ELEM(RxTidFLSMs, diff --git a/drivers/staging/rdma/hfi1/chip.h b/drivers/staging/rdma/hfi1/chip.h index d74aed8ccc18..54fc2cd3254f 100644 --- a/drivers/staging/rdma/hfi1/chip.h +++ b/drivers/staging/rdma/hfi1/chip.h @@ -722,7 +722,6 @@ enum { C_RX_TID_FULL, C_RX_TID_INVALID, C_RX_TID_FLGMS, - C_RX_CTX_RHQS, C_RX_CTX_EGRS, C_RCV_TID_FLSMS, C_CCE_PCI_CR_ST, diff --git a/drivers/staging/rdma/hfi1/chip_registers.h b/drivers/staging/rdma/hfi1/chip_registers.h index bf45de29d8bd..5056c848af35 100644 --- a/drivers/staging/rdma/hfi1/chip_registers.h +++ b/drivers/staging/rdma/hfi1/chip_registers.h @@ -379,7 +379,6 @@ #define DC_LCB_STS_ROUND_TRIP_LTP_CNT (DC_LCB_CSRS + 0x0000000004B0) #define RCV_BUF_OVFL_CNT 10 #define RCV_CONTEXT_EGR_STALL 22 -#define RCV_CONTEXT_RHQ_STALL 21 #define RCV_DATA_PKT_CNT 0 #define RCV_DWORD_CNT 1 #define RCV_TID_FLOW_GEN_MISMATCH_CNT 20 From db00a055613915f9309a58700517379018e3093f Mon Sep 17 00:00:00 2001 From: Ira Weiny Date: Mon, 16 Nov 2015 21:59:26 -0500 Subject: [PATCH 691/843] staging/rdma/hfi1: Remove rcv bubbles code Rcv bubbles were improperly calculated for HFIs, fix that here. Reviewed-by: Mike Marciniszyn Reviewed-by: Arthur Kepner Signed-off-by: Ira Weiny Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/mad.c | 62 +-------------------------------- 1 file changed, 1 insertion(+), 61 deletions(-) diff --git a/drivers/staging/rdma/hfi1/mad.c b/drivers/staging/rdma/hfi1/mad.c index a1225651005c..4bc003f036c0 100644 --- a/drivers/staging/rdma/hfi1/mad.c +++ b/drivers/staging/rdma/hfi1/mad.c @@ -2271,34 +2271,8 @@ static void a0_portstatus(struct hfi1_pportdata *ppd, { if (!is_bx(ppd->dd)) { unsigned long vl; - int vfi = 0; u64 max_vl_xmit_wait = 0, tmp; u32 vl_all_mask = VL_MASK_ALL; - u64 rcv_data, rcv_bubble; - - rcv_data = be64_to_cpu(rsp->port_rcv_data); - rcv_bubble = be64_to_cpu(rsp->port_rcv_bubble); - /* In the measured time period, calculate the total number - * of flits that were received. Subtract out one false - * rcv_bubble increment for every 32 received flits but - * don't let the number go negative. - */ - if (rcv_bubble >= (rcv_data>>5)) { - rcv_bubble -= (rcv_data>>5); - rsp->port_rcv_bubble = cpu_to_be64(rcv_bubble); - } - for_each_set_bit(vl, (unsigned long *)&(vl_select_mask), - 8 * sizeof(vl_select_mask)) { - rcv_data = be64_to_cpu(rsp->vls[vfi].port_vl_rcv_data); - rcv_bubble = - be64_to_cpu(rsp->vls[vfi].port_vl_rcv_bubble); - if (rcv_bubble >= (rcv_data>>5)) { - rcv_bubble -= (rcv_data>>5); - rsp->vls[vfi].port_vl_rcv_bubble = - cpu_to_be64(rcv_bubble); - } - vfi++; - } for_each_set_bit(vl, (unsigned long *)&(vl_all_mask), 8 * sizeof(vl_all_mask)) { @@ -2363,8 +2337,6 @@ static int pma_get_opa_portstatus(struct opa_pma_mad *pmp, CNTR_INVALID_VL)); rsp->port_rcv_data = cpu_to_be64(read_dev_cntr(dd, C_DC_RCV_FLITS, CNTR_INVALID_VL)); - rsp->port_rcv_bubble = - cpu_to_be64(read_dev_cntr(dd, C_DC_RCV_BBL, CNTR_INVALID_VL)); rsp->port_xmit_pkts = cpu_to_be64(read_dev_cntr(dd, C_DC_XMIT_PKTS, CNTR_INVALID_VL)); rsp->port_rcv_pkts = cpu_to_be64(read_dev_cntr(dd, C_DC_RCV_PKTS, @@ -2434,9 +2406,6 @@ static int pma_get_opa_portstatus(struct opa_pma_mad *pmp, tmp = read_dev_cntr(dd, C_DC_RX_FLIT_VL, idx_from_vl(vl)); rsp->vls[vfi].port_vl_rcv_data = cpu_to_be64(tmp); - rsp->vls[vfi].port_vl_rcv_bubble = - cpu_to_be64(read_dev_cntr(dd, C_DC_RCV_BBL_VL, - idx_from_vl(vl))); rsp->vls[vfi].port_vl_rcv_pkts = cpu_to_be64(read_dev_cntr(dd, C_DC_RX_PKT_VL, @@ -2519,32 +2488,8 @@ static void a0_datacounters(struct hfi1_devdata *dd, struct _port_dctrs *rsp, if (!is_bx(dd)) { unsigned long vl; int vfi = 0; - u64 rcv_data, rcv_bubble, sum_vl_xmit_wait = 0; + u64 sum_vl_xmit_wait = 0; - rcv_data = be64_to_cpu(rsp->port_rcv_data); - rcv_bubble = be64_to_cpu(rsp->port_rcv_bubble); - /* In the measured time period, calculate the total number - * of flits that were received. Subtract out one false - * rcv_bubble increment for every 32 received flits but - * don't let the number go negative. - */ - if (rcv_bubble >= (rcv_data>>5)) { - rcv_bubble -= (rcv_data>>5); - rsp->port_rcv_bubble = cpu_to_be64(rcv_bubble); - } - for_each_set_bit(vl, (unsigned long *)&(vl_select_mask), - 8 * sizeof(vl_select_mask)) { - rcv_data = be64_to_cpu(rsp->vls[vfi].port_vl_rcv_data); - rcv_bubble = - be64_to_cpu(rsp->vls[vfi].port_vl_rcv_bubble); - if (rcv_bubble >= (rcv_data>>5)) { - rcv_bubble -= (rcv_data>>5); - rsp->vls[vfi].port_vl_rcv_bubble = - cpu_to_be64(rcv_bubble); - } - vfi++; - } - vfi = 0; for_each_set_bit(vl, (unsigned long *)&(vl_select_mask), 8 * sizeof(vl_select_mask)) { u64 tmp = sum_vl_xmit_wait + @@ -2635,8 +2580,6 @@ static int pma_get_opa_datacounters(struct opa_pma_mad *pmp, CNTR_INVALID_VL)); rsp->port_rcv_data = cpu_to_be64(read_dev_cntr(dd, C_DC_RCV_FLITS, CNTR_INVALID_VL)); - rsp->port_rcv_bubble = - cpu_to_be64(read_dev_cntr(dd, C_DC_RCV_BBL, CNTR_INVALID_VL)); rsp->port_xmit_pkts = cpu_to_be64(read_dev_cntr(dd, C_DC_XMIT_PKTS, CNTR_INVALID_VL)); rsp->port_rcv_pkts = cpu_to_be64(read_dev_cntr(dd, C_DC_RCV_PKTS, @@ -2675,9 +2618,6 @@ static int pma_get_opa_datacounters(struct opa_pma_mad *pmp, rsp->vls[vfi].port_vl_rcv_data = cpu_to_be64(read_dev_cntr(dd, C_DC_RX_FLIT_VL, idx_from_vl(vl))); - rsp->vls[vfi].port_vl_rcv_bubble = - cpu_to_be64(read_dev_cntr(dd, C_DC_RCV_BBL_VL, - idx_from_vl(vl))); rsp->vls[vfi].port_vl_xmit_pkts = cpu_to_be64(read_port_cntr(ppd, C_TX_PKT_VL, From 9805071e76de29914ecb6ce17136ff83647e7744 Mon Sep 17 00:00:00 2001 From: Jubin John Date: Mon, 16 Nov 2015 21:59:27 -0500 Subject: [PATCH 692/843] staging/rdma/hfi1: Add space between concatenated string elements Space between concantenated string elements is more human readable and fixes the checkpatch issue: CHECK: Concatenated strings should use spaces between elements Reviewed-by: Mike Marciniszyn Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/chip.c | 10 +++++----- drivers/staging/rdma/hfi1/driver.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index 0817776d3528..f89f38d8a2b7 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -8903,8 +8903,8 @@ static int request_intx_irq(struct hfi1_devdata *dd) { int ret; - snprintf(dd->intx_name, sizeof(dd->intx_name), DRIVER_NAME"_%d", - dd->unit); + snprintf(dd->intx_name, sizeof(dd->intx_name), DRIVER_NAME "_%d", + dd->unit); ret = request_irq(dd->pcidev->irq, general_interrupt, IRQF_SHARED, dd->intx_name, dd); if (ret) @@ -9003,7 +9003,7 @@ static int request_msix_irqs(struct hfi1_devdata *dd) handler = general_interrupt; arg = dd; snprintf(me->name, sizeof(me->name), - DRIVER_NAME"_%d", dd->unit); + DRIVER_NAME "_%d", dd->unit); err_info = "general"; } else if (first_sdma <= i && i < last_sdma) { idx = i - first_sdma; @@ -9011,7 +9011,7 @@ static int request_msix_irqs(struct hfi1_devdata *dd) handler = sdma_interrupt; arg = sde; snprintf(me->name, sizeof(me->name), - DRIVER_NAME"_%d sdma%d", dd->unit, idx); + DRIVER_NAME "_%d sdma%d", dd->unit, idx); err_info = "sdma"; remap_sdma_interrupts(dd, idx, i); } else if (first_rx <= i && i < last_rx) { @@ -9031,7 +9031,7 @@ static int request_msix_irqs(struct hfi1_devdata *dd) thread = receive_context_thread; arg = rcd; snprintf(me->name, sizeof(me->name), - DRIVER_NAME"_%d kctxt%d", dd->unit, idx); + DRIVER_NAME "_%d kctxt%d", dd->unit, idx); err_info = "receive context"; remap_intr(dd, IS_RCVAVAIL_START + idx, i); } else { diff --git a/drivers/staging/rdma/hfi1/driver.c b/drivers/staging/rdma/hfi1/driver.c index 4c52e785de68..745817ea42e2 100644 --- a/drivers/staging/rdma/hfi1/driver.c +++ b/drivers/staging/rdma/hfi1/driver.c @@ -158,7 +158,7 @@ const char *get_unit_name(int unit) { static char iname[16]; - snprintf(iname, sizeof(iname), DRIVER_NAME"_%u", unit); + snprintf(iname, sizeof(iname), DRIVER_NAME "_%u", unit); return iname; } From 995deafaff78e898a9d9867ac11c3a81e554f1d1 Mon Sep 17 00:00:00 2001 From: Mike Marciniszyn Date: Mon, 16 Nov 2015 21:59:29 -0500 Subject: [PATCH 693/843] staging/rdma/hfi1: rework is_a0() and is_bx() The current is_bx() will incorrectly match on other steppings. is_a0() is removed in favor of is_ax(). Reviewed-by: Mark Debbage Signed-off-by: Mike Marciniszyn Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/chip.c | 44 ++++++++++++---------------- drivers/staging/rdma/hfi1/chip.h | 1 - drivers/staging/rdma/hfi1/firmware.c | 2 +- drivers/staging/rdma/hfi1/hfi.h | 4 +-- drivers/staging/rdma/hfi1/init.c | 2 +- drivers/staging/rdma/hfi1/pcie.c | 4 +-- 6 files changed, 24 insertions(+), 33 deletions(-) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index f89f38d8a2b7..3235324659ba 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -1871,13 +1871,6 @@ static struct cntr_entry port_cntrs[PORT_CNTR_LAST] = { /* ======================================================================== */ -/* return true if this is chip revision revision a0 */ -int is_a0(struct hfi1_devdata *dd) -{ - return ((dd->revision >> CCE_REVISION_CHIP_REV_MINOR_SHIFT) - & CCE_REVISION_CHIP_REV_MINOR_MASK) == 0; -} - /* return true if this is chip revision revision a */ int is_ax(struct hfi1_devdata *dd) { @@ -1893,7 +1886,7 @@ int is_bx(struct hfi1_devdata *dd) u8 chip_rev_minor = dd->revision >> CCE_REVISION_CHIP_REV_MINOR_SHIFT & CCE_REVISION_CHIP_REV_MINOR_MASK; - return !!(chip_rev_minor & 0x10); + return (chip_rev_minor & 0xF0) == 0x10; } /* @@ -2188,9 +2181,8 @@ static void handle_cce_err(struct hfi1_devdata *dd, u32 unused, u64 reg) dd_dev_info(dd, "CCE Error: %s\n", cce_err_status_string(buf, sizeof(buf), reg)); - if ((reg & CCE_ERR_STATUS_CCE_CLI2_ASYNC_FIFO_PARITY_ERR_SMASK) - && is_a0(dd) - && (dd->icode != ICODE_FUNCTIONAL_SIMULATOR)) { + if ((reg & CCE_ERR_STATUS_CCE_CLI2_ASYNC_FIFO_PARITY_ERR_SMASK) && + is_ax(dd) && (dd->icode != ICODE_FUNCTIONAL_SIMULATOR)) { /* this error requires a manual drop into SPC freeze mode */ /* then a fix up */ start_freeze_handling(dd->pport, FREEZE_SELF); @@ -2250,7 +2242,7 @@ static void handle_rxe_err(struct hfi1_devdata *dd, u32 unused, u64 reg) * Freeze mode recovery is disabled for the errors * in RXE_FREEZE_ABORT_MASK */ - if (is_a0(dd) && (reg & RXE_FREEZE_ABORT_MASK)) + if (is_ax(dd) && (reg & RXE_FREEZE_ABORT_MASK)) flags = FREEZE_ABORT; start_freeze_handling(dd->pport, flags); @@ -2353,7 +2345,7 @@ static void handle_egress_err(struct hfi1_devdata *dd, u32 unused, u64 reg) if (reg & ALL_TXE_EGRESS_FREEZE_ERR) start_freeze_handling(dd->pport, 0); - if (is_a0(dd) && (reg & + if (is_ax(dd) && (reg & SEND_EGRESS_ERR_STATUS_TX_CREDIT_RETURN_VL_ERR_SMASK) && (dd->icode != ICODE_FUNCTIONAL_SIMULATOR)) start_freeze_handling(dd->pport, 0); @@ -3048,7 +3040,7 @@ static void adjust_lcb_for_fpga_serdes(struct hfi1_devdata *dd) /* else this is _p */ version = emulator_rev(dd); - if (!is_a0(dd)) + if (!is_ax(dd)) version = 0x2d; /* all B0 use 0x2d or higher settings */ if (version <= 0x12) { @@ -3334,7 +3326,7 @@ void handle_freeze(struct work_struct *work) write_csr(dd, CCE_CTRL, CCE_CTRL_SPC_UNFREEZE_SMASK); wait_for_freeze_status(dd, 0); - if (is_a0(dd)) { + if (is_ax(dd)) { write_csr(dd, CCE_CTRL, CCE_CTRL_SPC_FREEZE_SMASK); wait_for_freeze_status(dd, 1); write_csr(dd, CCE_CTRL, CCE_CTRL_SPC_UNFREEZE_SMASK); @@ -3862,7 +3854,7 @@ void handle_verify_cap(struct work_struct *work) * REPLAY_BUF_MBE_SMASK * FLIT_INPUT_BUF_MBE_SMASK */ - if (is_a0(dd)) { /* fixed in B0 */ + if (is_ax(dd)) { /* fixed in B0 */ reg = read_csr(dd, DC_LCB_CFG_LINK_KILL_EN); reg |= DC_LCB_CFG_LINK_KILL_EN_REPLAY_BUF_MBE_SMASK | DC_LCB_CFG_LINK_KILL_EN_FLIT_INPUT_BUF_MBE_SMASK; @@ -7329,8 +7321,8 @@ static int set_buffer_control(struct hfi1_devdata *dd, */ use_all_mask = 0; if ((be16_to_cpu(new_bc->overall_shared_limit) < - be16_to_cpu(cur_bc.overall_shared_limit)) - || (is_a0(dd) && any_shared_limit_changing)) { + be16_to_cpu(cur_bc.overall_shared_limit)) || + (is_ax(dd) && any_shared_limit_changing)) { set_global_shared(dd, 0); cur_bc.overall_shared_limit = 0; use_all_mask = 1; @@ -7504,7 +7496,7 @@ int fm_set_table(struct hfi1_pportdata *ppd, int which, void *t) */ static int disable_data_vls(struct hfi1_devdata *dd) { - if (is_a0(dd)) + if (is_ax(dd)) return 1; pio_send_control(dd, PSC_DATA_VL_DISABLE); @@ -7522,7 +7514,7 @@ static int disable_data_vls(struct hfi1_devdata *dd) */ int open_fill_data_vls(struct hfi1_devdata *dd) { - if (is_a0(dd)) + if (is_ax(dd)) return 1; pio_send_control(dd, PSC_DATA_VL_ENABLE); @@ -9972,7 +9964,7 @@ static void init_chip(struct hfi1_devdata *dd) /* restore command and BARs */ restore_pci_variables(dd); - if (is_a0(dd)) { + if (is_ax(dd)) { dd_dev_info(dd, "Resetting CSRs with FLR\n"); hfi1_pcie_flr(dd); restore_pci_variables(dd); @@ -9991,7 +9983,7 @@ static void init_chip(struct hfi1_devdata *dd) write_csr(dd, CCE_DC_CTRL, 0); /* Set the LED off */ - if (is_a0(dd)) + if (is_ax(dd)) setextled(dd, 0); /* * Clear the QSFP reset. @@ -10014,7 +10006,7 @@ static void init_early_variables(struct hfi1_devdata *dd) /* assign link credit variables */ dd->vau = CM_VAU; dd->link_credits = CM_GLOBAL_CREDITS; - if (is_a0(dd)) + if (is_ax(dd)) dd->link_credits--; dd->vcu = cu_to_vcu(hfi1_cu); /* enough room for 8 MAD packets plus header - 17K */ @@ -10122,7 +10114,7 @@ static void init_qos(struct hfi1_devdata *dd, u32 first_ctxt) unsigned qpns_per_vl, ctxt, i, qpn, n = 1, m; u64 *rsmmap; u64 reg; - u8 rxcontext = is_a0(dd) ? 0 : 0xff; /* 0 is default if a0 ver. */ + u8 rxcontext = is_ax(dd) ? 0 : 0xff; /* 0 is default if a0 ver. */ /* validate */ if (dd->n_krcv_queues <= MIN_KERNEL_KCTXTS || @@ -10327,7 +10319,7 @@ int hfi1_set_ctxt_jkey(struct hfi1_devdata *dd, unsigned ctxt, u16 jkey) * Enable send-side J_KEY integrity check, unless this is A0 h/w * (due to A0 erratum). */ - if (!is_a0(dd)) { + if (!is_ax(dd)) { reg = read_kctxt_csr(dd, sctxt, SEND_CTXT_CHECK_ENABLE); reg |= SEND_CTXT_CHECK_ENABLE_CHECK_JOB_KEY_SMASK; write_kctxt_csr(dd, sctxt, SEND_CTXT_CHECK_ENABLE, reg); @@ -10360,7 +10352,7 @@ int hfi1_clear_ctxt_jkey(struct hfi1_devdata *dd, unsigned ctxt) * This check would not have been enabled for A0 h/w, see * set_ctxt_jkey(). */ - if (!is_a0(dd)) { + if (!is_ax(dd)) { reg = read_kctxt_csr(dd, sctxt, SEND_CTXT_CHECK_ENABLE); reg &= ~SEND_CTXT_CHECK_ENABLE_CHECK_JOB_KEY_SMASK; write_kctxt_csr(dd, sctxt, SEND_CTXT_CHECK_ENABLE, reg); diff --git a/drivers/staging/rdma/hfi1/chip.h b/drivers/staging/rdma/hfi1/chip.h index 54fc2cd3254f..177862b9230b 100644 --- a/drivers/staging/rdma/hfi1/chip.h +++ b/drivers/staging/rdma/hfi1/chip.h @@ -664,7 +664,6 @@ void get_linkup_link_widths(struct hfi1_pportdata *ppd); void read_ltp_rtt(struct hfi1_devdata *dd); void clear_linkup_counters(struct hfi1_devdata *dd); u32 hdrqempty(struct hfi1_ctxtdata *rcd); -int is_a0(struct hfi1_devdata *dd); int is_ax(struct hfi1_devdata *dd); int is_bx(struct hfi1_devdata *dd); u32 read_physical_state(struct hfi1_devdata *dd); diff --git a/drivers/staging/rdma/hfi1/firmware.c b/drivers/staging/rdma/hfi1/firmware.c index f3112821cf47..938b97c040e6 100644 --- a/drivers/staging/rdma/hfi1/firmware.c +++ b/drivers/staging/rdma/hfi1/firmware.c @@ -951,7 +951,7 @@ void sbus_request(struct hfi1_devdata *dd, static void turn_off_spicos(struct hfi1_devdata *dd, int flags) { /* only needed on A0 */ - if (!is_a0(dd)) + if (!is_ax(dd)) return; dd_dev_info(dd, "Turning off spicos:%s%s\n", diff --git a/drivers/staging/rdma/hfi1/hfi.h b/drivers/staging/rdma/hfi1/hfi.h index 54ed6b36c1a7..98db0fe4d0f0 100644 --- a/drivers/staging/rdma/hfi1/hfi.h +++ b/drivers/staging/rdma/hfi1/hfi.h @@ -1693,7 +1693,7 @@ static inline u64 hfi1_pkt_default_send_ctxt_mask(struct hfi1_devdata *dd, else base_sc_integrity |= HFI1_PKT_KERNEL_SC_INTEGRITY; - if (is_a0(dd)) + if (is_ax(dd)) /* turn off send-side job key checks - A0 erratum */ return base_sc_integrity & ~SEND_CTXT_CHECK_ENABLE_CHECK_JOB_KEY_SMASK; @@ -1720,7 +1720,7 @@ static inline u64 hfi1_pkt_base_sdma_integrity(struct hfi1_devdata *dd) | SEND_DMA_CHECK_ENABLE_CHECK_VL_SMASK | SEND_DMA_CHECK_ENABLE_CHECK_ENABLE_SMASK; - if (is_a0(dd)) + if (is_ax(dd)) /* turn off send-side job key checks - A0 erratum */ return base_sdma_integrity & ~SEND_DMA_CHECK_ENABLE_CHECK_JOB_KEY_SMASK; diff --git a/drivers/staging/rdma/hfi1/init.c b/drivers/staging/rdma/hfi1/init.c index 1c8286f4c00c..52fa86f47186 100644 --- a/drivers/staging/rdma/hfi1/init.c +++ b/drivers/staging/rdma/hfi1/init.c @@ -678,7 +678,7 @@ int hfi1_init(struct hfi1_devdata *dd, int reinit) dd->process_dma_send = hfi1_verbs_send_dma; dd->pio_inline_send = pio_copy; - if (is_a0(dd)) { + if (is_ax(dd)) { atomic_set(&dd->drop_packet, DROP_PACKET_ON); dd->do_drop = 1; } else { diff --git a/drivers/staging/rdma/hfi1/pcie.c b/drivers/staging/rdma/hfi1/pcie.c index 0b7eafb0fc70..8317b07d722a 100644 --- a/drivers/staging/rdma/hfi1/pcie.c +++ b/drivers/staging/rdma/hfi1/pcie.c @@ -917,7 +917,7 @@ int do_pcie_gen3_transition(struct hfi1_devdata *dd) /* * A0 needs an additional SBR */ - if (is_a0(dd)) + if (is_ax(dd)) nsbr++; /* @@ -1193,7 +1193,7 @@ retry: write_csr(dd, CCE_DC_CTRL, 0); /* Set the LED off */ - if (is_a0(dd)) + if (is_ax(dd)) setextled(dd, 0); /* check for any per-lane errors */ From 5d9157aafb16bed45e3bf167baa16f1fbe1090cd Mon Sep 17 00:00:00 2001 From: Dean Luick Date: Mon, 16 Nov 2015 21:59:34 -0500 Subject: [PATCH 694/843] staging/rdma/hfi1: Read EFI variable for device description Read an EFI variable for the device description. Create the infrastructure for additional variable reads. Reviewed-by: Easwar Hariharan Signed-off-by: Dean Luick Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/Makefile | 2 +- drivers/staging/rdma/hfi1/chip.c | 38 +++++-- drivers/staging/rdma/hfi1/efivar.c | 169 +++++++++++++++++++++++++++++ drivers/staging/rdma/hfi1/efivar.h | 60 ++++++++++ 4 files changed, 260 insertions(+), 9 deletions(-) create mode 100644 drivers/staging/rdma/hfi1/efivar.c create mode 100644 drivers/staging/rdma/hfi1/efivar.h diff --git a/drivers/staging/rdma/hfi1/Makefile b/drivers/staging/rdma/hfi1/Makefile index 2e5daa6cdcc2..68c5a315e557 100644 --- a/drivers/staging/rdma/hfi1/Makefile +++ b/drivers/staging/rdma/hfi1/Makefile @@ -7,7 +7,7 @@ # obj-$(CONFIG_INFINIBAND_HFI1) += hfi1.o -hfi1-y := chip.o cq.o device.o diag.o dma.o driver.o eprom.o file_ops.o firmware.o \ +hfi1-y := chip.o cq.o device.o diag.o dma.o driver.o efivar.o eprom.o file_ops.o firmware.o \ init.o intr.o keys.o mad.o mmap.o mr.o pcie.o pio.o pio_copy.o \ qp.o qsfp.o rc.o ruc.o sdma.o srq.o sysfs.o trace.o twsi.o \ uc.o ud.o user_pages.o user_sdma.o verbs_mcast.o verbs.o diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index 3235324659ba..bcbd831d2b73 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -63,6 +63,7 @@ #include "pio.h" #include "sdma.h" #include "eprom.h" +#include "efivar.h" #define NUM_IB_PORTS 1 @@ -10461,6 +10462,32 @@ static void asic_should_init(struct hfi1_devdata *dd) spin_unlock_irqrestore(&hfi1_devs_lock, flags); } +/* + * Set dd->boardname. Use a generic name if a name is not returned from + * EFI variable space. + * + * Return 0 on success, -ENOMEM if space could not be allocated. + */ +static int obtain_boardname(struct hfi1_devdata *dd) +{ + /* generic board description */ + const char generic[] = + "Intel Omni-Path Host Fabric Interface Adapter 100 Series"; + unsigned long size; + int ret; + + ret = read_hfi1_efi_var(dd, "description", &size, + (void **)&dd->boardname); + if (ret) { + dd_dev_err(dd, "Board description not found\n"); + /* use generic description */ + dd->boardname = kstrdup(generic, GFP_KERNEL); + if (!dd->boardname) + return -ENOMEM; + } + return 0; +} + /** * Allocate and initialize the device structure for the hfi. * @dev: the pci_dev for hfi1_ib device @@ -10658,18 +10685,13 @@ struct hfi1_devdata *hfi1_init_dd(struct pci_dev *pdev, parse_platform_config(dd); - /* add board names as they are defined */ - dd->boardname = kmalloc(64, GFP_KERNEL); - if (!dd->boardname) + ret = obtain_boardname(dd); + if (ret) goto bail_cleanup; - snprintf(dd->boardname, 64, "Board ID 0x%llx", - dd->revision >> CCE_REVISION_BOARD_ID_LOWER_NIBBLE_SHIFT - & CCE_REVISION_BOARD_ID_LOWER_NIBBLE_MASK); snprintf(dd->boardversion, BOARD_VERS_MAX, - "ChipABI %u.%u, %s, ChipRev %u.%u, SW Compat %llu\n", + "ChipABI %u.%u, ChipRev %u.%u, SW Compat %llu\n", HFI1_CHIP_VERS_MAJ, HFI1_CHIP_VERS_MIN, - dd->boardname, (u32)dd->majrev, (u32)dd->minrev, (dd->revision >> CCE_REVISION_SW_SHIFT) diff --git a/drivers/staging/rdma/hfi1/efivar.c b/drivers/staging/rdma/hfi1/efivar.c new file mode 100644 index 000000000000..7dc5bae220e0 --- /dev/null +++ b/drivers/staging/rdma/hfi1/efivar.c @@ -0,0 +1,169 @@ +/* + * + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * GPL LICENSE SUMMARY + * + * Copyright(c) 2015 Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * BSD LICENSE + * + * Copyright(c) 2015 Intel Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * - Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "efivar.h" + +/* GUID for HFI1 variables in EFI */ +#define HFI1_EFIVAR_GUID EFI_GUID(0xc50a953e, 0xa8b2, 0x42a6, \ + 0xbf, 0x89, 0xd3, 0x33, 0xa6, 0xe9, 0xe6, 0xd4) +/* largest EFI data size we expect */ +#define EFI_DATA_SIZE 4096 + +/* + * Read the named EFI variable. Return the size of the actual data in *size + * and a kmalloc'ed buffer in *return_data. The caller must free the + * data. It is guaranteed that *return_data will be NULL and *size = 0 + * if this routine fails. + * + * Return 0 on success, -errno on failure. + */ +static int read_efi_var(const char *name, unsigned long *size, + void **return_data) +{ + efi_status_t status; + efi_char16_t *uni_name; + efi_guid_t guid; + unsigned long temp_size; + void *temp_buffer; + void *data; + int i; + int ret; + + /* set failure return values */ + *size = 0; + *return_data = NULL; + + if (!efi_enabled(EFI_RUNTIME_SERVICES)) + return -EOPNOTSUPP; + + uni_name = kzalloc(sizeof(efi_char16_t) * (strlen(name) + 1), + GFP_KERNEL); + temp_buffer = kzalloc(EFI_DATA_SIZE, GFP_KERNEL); + + if (!uni_name || !temp_buffer) { + ret = -ENOMEM; + goto fail; + } + + /* input: the size of the buffer */ + temp_size = EFI_DATA_SIZE; + + /* convert ASCII to unicode - it is a 1:1 mapping */ + for (i = 0; name[i]; i++) + uni_name[i] = name[i]; + + /* need a variable for our GUID */ + guid = HFI1_EFIVAR_GUID; + + /* call into EFI runtime services */ + status = efi.get_variable( + uni_name, + &guid, + NULL, + &temp_size, + temp_buffer); + + /* + * It would be nice to call efi_status_to_err() here, but that + * is in the EFIVAR_FS code and may not be compiled in. + * However, even that is insufficient since it does not cover + * EFI_BUFFER_TOO_SMALL which could be an important return. + * For now, just split out succces or not found. + */ + ret = status == EFI_SUCCESS ? 0 : + status == EFI_NOT_FOUND ? -ENOENT : + -EINVAL; + if (ret) + goto fail; + + /* + * We have successfully read the EFI variable into our + * temporary buffer. Now allocate a correctly sized + * buffer. + */ + data = kmalloc(temp_size, GFP_KERNEL); + if (!data) { + ret = -ENOMEM; + goto fail; + } + + memcpy(data, temp_buffer, temp_size); + *size = temp_size; + *return_data = data; + +fail: + kfree(uni_name); + kfree(temp_buffer); + + return ret; +} + +/* + * Read an HFI1 EFI variable of the form: + * - + * Return an kalloc'ed array and size of the data. + * + * Returns 0 on success, -errno on failure. + */ +int read_hfi1_efi_var(struct hfi1_devdata *dd, const char *kind, + unsigned long *size, void **return_data) +{ + char name[64]; + + /* create a common prefix */ + snprintf(name, sizeof(name), "%04x:%02x:%02x.%x-%s", + pci_domain_nr(dd->pcidev->bus), + dd->pcidev->bus->number, + PCI_SLOT(dd->pcidev->devfn), + PCI_FUNC(dd->pcidev->devfn), + kind); + + return read_efi_var(name, size, return_data); +} diff --git a/drivers/staging/rdma/hfi1/efivar.h b/drivers/staging/rdma/hfi1/efivar.h new file mode 100644 index 000000000000..070706225c51 --- /dev/null +++ b/drivers/staging/rdma/hfi1/efivar.h @@ -0,0 +1,60 @@ +/* + * + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * GPL LICENSE SUMMARY + * + * Copyright(c) 2015 Intel Corporation. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * BSD LICENSE + * + * Copyright(c) 2015 Intel Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * - Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _HFI1_EFIVAR_H +#define _HFI1_EFIVAR_H + +#include + +#include "hfi.h" + +int read_hfi1_efi_var(struct hfi1_devdata *dd, const char *kind, + unsigned long *size, void **return_data); + +#endif /* _HFI1_EFIVAR_H */ From cd371e0959a3f2d5df69d50000750f7eefc94659 Mon Sep 17 00:00:00 2001 From: Dean Luick Date: Mon, 16 Nov 2015 21:59:35 -0500 Subject: [PATCH 695/843] staging/rdma/hfi1: Adjust EPROM partitions, add EPROM commands Add a new EPROM partition, adjusting partition placement. Add EPROM range commands as a supserset of the partition commands. Remove old partition commands. Enhance EPROM erase, creating a range function and using the largest erase (sub) commands when possible. Reviewed-by: Dennis Dalessandro Signed-off-by: Dean Luick Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/eprom.c | 119 +++++++++++++++------------ drivers/staging/rdma/hfi1/file_ops.c | 18 ++-- include/uapi/rdma/hfi/hfi1_user.h | 10 +-- 3 files changed, 77 insertions(+), 70 deletions(-) diff --git a/drivers/staging/rdma/hfi1/eprom.c b/drivers/staging/rdma/hfi1/eprom.c index b61d3ae93ed1..fb620c97f592 100644 --- a/drivers/staging/rdma/hfi1/eprom.c +++ b/drivers/staging/rdma/hfi1/eprom.c @@ -53,17 +53,26 @@ #include "eprom.h" /* - * The EPROM is logically divided into two partitions: + * The EPROM is logically divided into three partitions: * partition 0: the first 128K, visible from PCI ROM BAR - * partition 1: the rest + * partition 1: 4K config file (sector size) + * partition 2: the rest */ #define P0_SIZE (128 * 1024) +#define P1_SIZE (4 * 1024) #define P1_START P0_SIZE +#define P2_START (P0_SIZE + P1_SIZE) + +/* erase sizes supported by the controller */ +#define SIZE_4KB (4 * 1024) +#define MASK_4KB (SIZE_4KB - 1) -/* largest erase size supported by the controller */ #define SIZE_32KB (32 * 1024) #define MASK_32KB (SIZE_32KB - 1) +#define SIZE_64KB (64 * 1024) +#define MASK_64KB (SIZE_64KB - 1) + /* controller page size, in bytes */ #define EP_PAGE_SIZE 256 #define EEP_PAGE_MASK (EP_PAGE_SIZE - 1) @@ -75,10 +84,12 @@ #define CMD_READ_DATA(addr) ((0x03 << CMD_SHIFT) | addr) #define CMD_READ_SR1 ((0x05 << CMD_SHIFT)) #define CMD_WRITE_ENABLE ((0x06 << CMD_SHIFT)) +#define CMD_SECTOR_ERASE_4KB(addr) ((0x20 << CMD_SHIFT) | addr) #define CMD_SECTOR_ERASE_32KB(addr) ((0x52 << CMD_SHIFT) | addr) #define CMD_CHIP_ERASE ((0x60 << CMD_SHIFT)) #define CMD_READ_MANUF_DEV_ID ((0x90 << CMD_SHIFT)) #define CMD_RELEASE_POWERDOWN_NOID ((0xab << CMD_SHIFT)) +#define CMD_SECTOR_ERASE_64KB(addr) ((0xd8 << CMD_SHIFT) | addr) /* controller interface speeds */ #define EP_SPEED_FULL 0x2 /* full speed */ @@ -188,28 +199,43 @@ static int erase_chip(struct hfi1_devdata *dd) } /* - * Erase a range using the 32KB erase command. + * Erase a range. */ -static int erase_32kb_range(struct hfi1_devdata *dd, u32 start, u32 end) +static int erase_range(struct hfi1_devdata *dd, u32 start, u32 len) { + u32 end = start + len; int ret = 0; if (end < start) return -EINVAL; - if ((start & MASK_32KB) || (end & MASK_32KB)) { + /* check the end points for the minimum erase */ + if ((start & MASK_4KB) || (end & MASK_4KB)) { dd_dev_err(dd, - "%s: non-aligned range (0x%x,0x%x) for a 32KB erase\n", + "%s: non-aligned range (0x%x,0x%x) for a 4KB erase\n", __func__, start, end); return -EINVAL; } write_enable(dd); - for (; start < end; start += SIZE_32KB) { + while (start < end) { write_csr(dd, ASIC_EEP_ADDR_CMD, CMD_WRITE_ENABLE); - write_csr(dd, ASIC_EEP_ADDR_CMD, - CMD_SECTOR_ERASE_32KB(start)); + /* check in order of largest to smallest */ + if (((start & MASK_64KB) == 0) && (start + SIZE_64KB <= end)) { + write_csr(dd, ASIC_EEP_ADDR_CMD, + CMD_SECTOR_ERASE_64KB(start)); + start += SIZE_64KB; + } else if (((start & MASK_32KB) == 0) && + (start + SIZE_32KB <= end)) { + write_csr(dd, ASIC_EEP_ADDR_CMD, + CMD_SECTOR_ERASE_32KB(start)); + start += SIZE_32KB; + } else { /* 4KB will work */ + write_csr(dd, ASIC_EEP_ADDR_CMD, + CMD_SECTOR_ERASE_4KB(start)); + start += SIZE_4KB; + } ret = wait_for_not_busy(dd); if (ret) goto done; @@ -309,6 +335,18 @@ done: return ret; } +/* convert an range composite to a length, in bytes */ +static inline u32 extract_rlen(u32 composite) +{ + return (composite & 0xffff) * EP_PAGE_SIZE; +} + +/* convert an range composite to a start, in bytes */ +static inline u32 extract_rstart(u32 composite) +{ + return (composite >> 16) * EP_PAGE_SIZE; +} + /* * Perform the given operation on the EPROM. Called from user space. The * user credentials have already been checked. @@ -319,6 +357,8 @@ int handle_eprom_command(const struct hfi1_cmd *cmd) { struct hfi1_devdata *dd; u32 dev_id; + u32 rlen; /* range length */ + u32 rstart; /* range start */ int ret = 0; /* @@ -364,54 +404,29 @@ int handle_eprom_command(const struct hfi1_cmd *cmd) sizeof(u32))) ret = -EFAULT; break; + case HFI1_CMD_EP_ERASE_CHIP: ret = erase_chip(dd); break; - case HFI1_CMD_EP_ERASE_P0: - if (cmd->len != P0_SIZE) { - ret = -ERANGE; - break; - } - ret = erase_32kb_range(dd, 0, cmd->len); + + case HFI1_CMD_EP_ERASE_RANGE: + rlen = extract_rlen(cmd->len); + rstart = extract_rstart(cmd->len); + ret = erase_range(dd, rstart, rlen); break; - case HFI1_CMD_EP_ERASE_P1: - /* check for overflow */ - if (P1_START + cmd->len > ASIC_EEP_ADDR_CMD_EP_ADDR_MASK) { - ret = -ERANGE; - break; - } - ret = erase_32kb_range(dd, P1_START, P1_START + cmd->len); + + case HFI1_CMD_EP_READ_RANGE: + rlen = extract_rlen(cmd->len); + rstart = extract_rstart(cmd->len); + ret = read_length(dd, rstart, rlen, cmd->addr); break; - case HFI1_CMD_EP_READ_P0: - if (cmd->len != P0_SIZE) { - ret = -ERANGE; - break; - } - ret = read_length(dd, 0, cmd->len, cmd->addr); - break; - case HFI1_CMD_EP_READ_P1: - /* check for overflow */ - if (P1_START + cmd->len > ASIC_EEP_ADDR_CMD_EP_ADDR_MASK) { - ret = -ERANGE; - break; - } - ret = read_length(dd, P1_START, cmd->len, cmd->addr); - break; - case HFI1_CMD_EP_WRITE_P0: - if (cmd->len > P0_SIZE) { - ret = -ERANGE; - break; - } - ret = write_length(dd, 0, cmd->len, cmd->addr); - break; - case HFI1_CMD_EP_WRITE_P1: - /* check for overflow */ - if (P1_START + cmd->len > ASIC_EEP_ADDR_CMD_EP_ADDR_MASK) { - ret = -ERANGE; - break; - } - ret = write_length(dd, P1_START, cmd->len, cmd->addr); + + case HFI1_CMD_EP_WRITE_RANGE: + rlen = extract_rlen(cmd->len); + rstart = extract_rstart(cmd->len); + ret = write_length(dd, rstart, rlen, cmd->addr); break; + default: dd_dev_err(dd, "%s: unexpected command %d\n", __func__, cmd->type); diff --git a/drivers/staging/rdma/hfi1/file_ops.c b/drivers/staging/rdma/hfi1/file_ops.c index 22037ce984c8..874305f0a925 100644 --- a/drivers/staging/rdma/hfi1/file_ops.c +++ b/drivers/staging/rdma/hfi1/file_ops.c @@ -234,12 +234,9 @@ static ssize_t hfi1_file_write(struct file *fp, const char __user *data, break; case HFI1_CMD_EP_INFO: case HFI1_CMD_EP_ERASE_CHIP: - case HFI1_CMD_EP_ERASE_P0: - case HFI1_CMD_EP_ERASE_P1: - case HFI1_CMD_EP_READ_P0: - case HFI1_CMD_EP_READ_P1: - case HFI1_CMD_EP_WRITE_P0: - case HFI1_CMD_EP_WRITE_P1: + case HFI1_CMD_EP_ERASE_RANGE: + case HFI1_CMD_EP_READ_RANGE: + case HFI1_CMD_EP_WRITE_RANGE: uctxt_required = 0; /* assigned user context not required */ must_be_root = 1; /* validate user */ copy = 0; @@ -393,12 +390,9 @@ static ssize_t hfi1_file_write(struct file *fp, const char __user *data, } case HFI1_CMD_EP_INFO: case HFI1_CMD_EP_ERASE_CHIP: - case HFI1_CMD_EP_ERASE_P0: - case HFI1_CMD_EP_ERASE_P1: - case HFI1_CMD_EP_READ_P0: - case HFI1_CMD_EP_READ_P1: - case HFI1_CMD_EP_WRITE_P0: - case HFI1_CMD_EP_WRITE_P1: + case HFI1_CMD_EP_ERASE_RANGE: + case HFI1_CMD_EP_READ_RANGE: + case HFI1_CMD_EP_WRITE_RANGE: ret = handle_eprom_command(&cmd); break; } diff --git a/include/uapi/rdma/hfi/hfi1_user.h b/include/uapi/rdma/hfi/hfi1_user.h index a2fc6cbfe414..288694e422fb 100644 --- a/include/uapi/rdma/hfi/hfi1_user.h +++ b/include/uapi/rdma/hfi/hfi1_user.h @@ -137,12 +137,10 @@ /* separate EPROM commands from normal PSM commands */ #define HFI1_CMD_EP_INFO 64 /* read EPROM device ID */ #define HFI1_CMD_EP_ERASE_CHIP 65 /* erase whole EPROM */ -#define HFI1_CMD_EP_ERASE_P0 66 /* erase EPROM partition 0 */ -#define HFI1_CMD_EP_ERASE_P1 67 /* erase EPROM partition 1 */ -#define HFI1_CMD_EP_READ_P0 68 /* read EPROM partition 0 */ -#define HFI1_CMD_EP_READ_P1 69 /* read EPROM partition 1 */ -#define HFI1_CMD_EP_WRITE_P0 70 /* write EPROM partition 0 */ -#define HFI1_CMD_EP_WRITE_P1 71 /* write EPROM partition 1 */ +/* range 66-74 no longer used */ +#define HFI1_CMD_EP_ERASE_RANGE 75 /* erase EPROM range */ +#define HFI1_CMD_EP_READ_RANGE 76 /* read EPROM range */ +#define HFI1_CMD_EP_WRITE_RANGE 77 /* write EPROM range */ #define _HFI1_EVENT_FROZEN_BIT 0 #define _HFI1_EVENT_LINKDOWN_BIT 1 From 9d2f53ef42c15f6e47b48246beb0a32c4ff3b3ed Mon Sep 17 00:00:00 2001 From: Jubin John Date: Fri, 20 Nov 2015 18:13:08 -0500 Subject: [PATCH 696/843] staging/rdma/hfi1: Fix error in hfi1 driver build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit hfi1 driver build fails with the following error: In function ‘handle_receive_interrupt’: error: implicit declaration of function ‘skip_rcv_packet’ [-Werror=implicit-function-declaration] last = skip_rcv_packet(&packet, thread); ^ This is due to the inclusion of the skip_rcv_packet() in the CONFIG_PRESCAN_RXQ ifdef block. This function is independent of CONFIG_PRESCAN_RXQ and should be outside this block. Fixes: 82c2611daaf0 ("staging/rdma/hfi1: Handle packets with invalid RHF on context 0") Reviewed-by: Mike Marciniszyn Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rdma/hfi1/driver.c b/drivers/staging/rdma/hfi1/driver.c index 745817ea42e2..8485de1fce08 100644 --- a/drivers/staging/rdma/hfi1/driver.c +++ b/drivers/staging/rdma/hfi1/driver.c @@ -633,6 +633,7 @@ next: update_ps_mdata(&mdata, rcd); } } +#endif /* CONFIG_PRESCAN_RXQ */ static inline int skip_rcv_packet(struct hfi1_packet *packet, int thread) { @@ -659,7 +660,6 @@ static inline int skip_rcv_packet(struct hfi1_packet *packet, int thread) return ret; } -#endif /* CONFIG_PRESCAN_RXQ */ static inline int process_rcv_packet(struct hfi1_packet *packet, int thread) { From 4be81991ec5f21a9dcf4b951689d81cc1b03ca25 Mon Sep 17 00:00:00 2001 From: Ira Weiny Date: Fri, 20 Nov 2015 19:43:47 -0500 Subject: [PATCH 697/843] staging/rdma/hfi1: Eliminate WARN_ON when VL is invalid sdma_select_engine_vl only needs to protect itself from an invalid VL. Something higher up the stack should be warning the user when they try to use an SL which maps to an invalid VL. Reviewed-by: Dean Luick Reviewed-by: Mike Marciniszyn Reviewed-by: Kaike Wan Signed-off-by: Ira Weiny Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/sdma.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rdma/hfi1/sdma.c b/drivers/staging/rdma/hfi1/sdma.c index 90b7072a9969..0710e2ab767c 100644 --- a/drivers/staging/rdma/hfi1/sdma.c +++ b/drivers/staging/rdma/hfi1/sdma.c @@ -765,8 +765,14 @@ struct sdma_engine *sdma_select_engine_vl( struct sdma_map_elem *e; struct sdma_engine *rval; - if (WARN_ON(vl > 8)) - return &dd->per_sdma[0]; + /* NOTE This should only happen if SC->VL changed after the initial + * checks on the QP/AH + * Default will return engine 0 below + */ + if (vl >= num_vls) { + rval = NULL; + goto done; + } rcu_read_lock(); m = rcu_dereference(dd->sdma_map); @@ -778,6 +784,7 @@ struct sdma_engine *sdma_select_engine_vl( rval = e->sde[selector & e->mask]; rcu_read_unlock(); +done: rval = !rval ? &dd->per_sdma[0] : rval; trace_hfi1_sdma_engine_select(dd, selector, vl, rval->this_idx); return rval; From b3de842eed283f40aa769403a2d38fc0912dba2b Mon Sep 17 00:00:00 2001 From: Dean Luick Date: Tue, 1 Dec 2015 15:38:10 -0500 Subject: [PATCH 698/843] staging/rdma/hfi1: Support alternate firmware names Add support for an automatic fallback for firmware names to support debug-signed and production-signed firmware images. Reviewed-by: Dennis Dalessandro Signed-off-by: Dean Luick Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/firmware.c | 189 ++++++++++++++++++++++----- 1 file changed, 157 insertions(+), 32 deletions(-) diff --git a/drivers/staging/rdma/hfi1/firmware.c b/drivers/staging/rdma/hfi1/firmware.c index 938b97c040e6..28ae42faa018 100644 --- a/drivers/staging/rdma/hfi1/firmware.c +++ b/drivers/staging/rdma/hfi1/firmware.c @@ -68,6 +68,10 @@ #define DEFAULT_FW_SBUS_NAME "hfi1_sbus.fw" #define DEFAULT_FW_PCIE_NAME "hfi1_pcie.fw" #define DEFAULT_PLATFORM_CONFIG_NAME "hfi1_platform.dat" +#define ALT_FW_8051_NAME_ASIC "hfi1_dc8051_d.fw" +#define ALT_FW_FABRIC_NAME "hfi1_fabric_d.fw" +#define ALT_FW_SBUS_NAME "hfi1_sbus_d.fw" +#define ALT_FW_PCIE_NAME "hfi1_pcie_d.fw" static uint fw_8051_load = 1; static uint fw_fabric_serdes_load = 1; @@ -158,7 +162,8 @@ struct firmware_details { static DEFINE_MUTEX(fw_mutex); enum fw_state { FW_EMPTY, - FW_ACQUIRED, + FW_TRY, + FW_FINAL, FW_ERR }; static enum fw_state fw_state = FW_EMPTY; @@ -428,8 +433,8 @@ static int obtain_one_firmware(struct hfi1_devdata *dd, const char *name, ret = request_firmware(&fdet->fw, name, &dd->pcidev->dev); if (ret) { - dd_dev_err(dd, "cannot load firmware \"%s\", err %d\n", - name, ret); + dd_dev_err(dd, "cannot find firmware \"%s\", err %d\n", + name, ret); return ret; } @@ -539,28 +544,53 @@ done: static void dispose_one_firmware(struct firmware_details *fdet) { release_firmware(fdet->fw); - fdet->fw = NULL; + /* erase all previous information */ + memset(fdet, 0, sizeof(*fdet)); } /* - * Called by all HFIs when loading their firmware - i.e. device probe time. - * The first one will do the actual firmware load. Use a mutex to resolve - * any possible race condition. + * Obtain the 4 firmwares from the OS. All must be obtained at once or not + * at all. If called with the firmware state in FW_TRY, use alternate names. + * On exit, this routine will have set the firmware state to one of FW_TRY, + * FW_FINAL, or FW_ERR. * - * The call to this routine cannot be moved to driver load because the kernel - * call request_firmware() requires a device which is only available after - * the first device probe. + * Must be holding fw_mutex. */ -static int obtain_firmware(struct hfi1_devdata *dd) +static void __obtain_firmware(struct hfi1_devdata *dd) { int err = 0; - mutex_lock(&fw_mutex); - if (fw_state == FW_ACQUIRED) { - goto done; /* already acquired */ - } else if (fw_state == FW_ERR) { - err = fw_err; - goto done; /* already tried and failed */ + if (fw_state == FW_FINAL) /* nothing more to obtain */ + return; + if (fw_state == FW_ERR) /* already in error */ + return; + + /* fw_state is FW_EMPTY or FW_TRY */ +retry: + if (fw_state == FW_TRY) { + /* + * We tried the original and it failed. Move to the + * alternate. + */ + dd_dev_info(dd, "using alternate firmware names\n"); + /* + * Let others run. Some systems, when missing firmware, does + * something that holds for 30 seconds. If we do that twice + * in a row it triggers task blocked warning. + */ + cond_resched(); + if (fw_8051_load) + dispose_one_firmware(&fw_8051); + if (fw_fabric_serdes_load) + dispose_one_firmware(&fw_fabric); + if (fw_sbus_load) + dispose_one_firmware(&fw_sbus); + if (fw_pcie_serdes_load) + dispose_one_firmware(&fw_pcie); + fw_8051_name = ALT_FW_8051_NAME_ASIC; + fw_fabric_serdes_name = ALT_FW_FABRIC_NAME; + fw_sbus_name = ALT_FW_SBUS_NAME; + fw_pcie_serdes_name = ALT_FW_PCIE_NAME; } if (fw_8051_load) { @@ -588,27 +618,82 @@ static int obtain_firmware(struct hfi1_devdata *dd) goto done; } +done: + if (err) { + /* oops, had problems obtaining a firmware */ + if (fw_state == FW_EMPTY) { + /* retry with alternate */ + fw_state = FW_TRY; + goto retry; + } + fw_state = FW_ERR; + fw_err = -ENOENT; + } else { + /* success */ + if (fw_state == FW_EMPTY) + fw_state = FW_TRY; /* may retry later */ + else + fw_state = FW_FINAL; /* cannot try again */ + } +} + +/* + * Called by all HFIs when loading their firmware - i.e. device probe time. + * The first one will do the actual firmware load. Use a mutex to resolve + * any possible race condition. + * + * The call to this routine cannot be moved to driver load because the kernel + * call request_firmware() requires a device which is only available after + * the first device probe. + */ +static int obtain_firmware(struct hfi1_devdata *dd) +{ + unsigned long timeout; + int err = 0; + + mutex_lock(&fw_mutex); + + /* 40s delay due to long delay on missing firmware on some systems */ + timeout = jiffies + msecs_to_jiffies(40000); + while (fw_state == FW_TRY) { + /* + * Another device is trying the firmware. Wait until it + * decides what works (or not). + */ + if (time_after(jiffies, timeout)) { + /* waited too long */ + dd_dev_err(dd, "Timeout waiting for firmware try"); + fw_state = FW_ERR; + fw_err = -ETIMEDOUT; + break; + } + mutex_unlock(&fw_mutex); + msleep(20); /* arbitrary delay */ + mutex_lock(&fw_mutex); + } + /* not in FW_TRY state */ + + if (fw_state == FW_FINAL) + goto done; /* already acquired */ + else if (fw_state == FW_ERR) + goto done; /* already tried and failed */ + /* fw_state is FW_EMPTY */ + + /* set fw_state to FW_TRY, FW_FINAL, or FW_ERR, and fw_err */ + __obtain_firmware(dd); + if (platform_config_load) { platform_config = NULL; err = request_firmware(&platform_config, platform_config_name, &dd->pcidev->dev); - if (err) { - err = 0; + if (err) platform_config = NULL; - } } - /* success */ - fw_state = FW_ACQUIRED; - done: - if (err) { - fw_err = err; - fw_state = FW_ERR; - } mutex_unlock(&fw_mutex); - return err; + return fw_err; } /* @@ -637,6 +722,38 @@ void dispose_firmware(void) fw_state = FW_EMPTY; } +/* + * Called with the result of a firmware download. + * + * Return 1 to retry loading the firmware, 0 to stop. + */ +static int retry_firmware(struct hfi1_devdata *dd, int load_result) +{ + int retry; + + mutex_lock(&fw_mutex); + + if (load_result == 0) { + /* + * The load succeeded, so expect all others to do the same. + * Do not retry again. + */ + if (fw_state == FW_TRY) + fw_state = FW_FINAL; + retry = 0; /* do NOT retry */ + } else if (fw_state == FW_TRY) { + /* load failed, obtain alternate firmware */ + __obtain_firmware(dd); + retry = (fw_state == FW_FINAL); + } else { + /* else in FW_FINAL or FW_ERR, no retry in either case */ + retry = 0; + } + + mutex_unlock(&fw_mutex); + return retry; +} + /* * Write a block of data to a given array CSR. All calls will be in * multiples of 8 bytes. @@ -1248,7 +1365,9 @@ int load_firmware(struct hfi1_devdata *dd) fabric_serdes_addrs[dd->hfi1_id], NUM_FABRIC_SERDES); turn_off_spicos(dd, SPICO_FABRIC); - ret = load_fabric_serdes_firmware(dd, &fw_fabric); + do { + ret = load_fabric_serdes_firmware(dd, &fw_fabric); + } while (retry_firmware(dd, ret)); clear_sbus_fast_mode(dd); release_hw_mutex(dd); @@ -1257,7 +1376,9 @@ int load_firmware(struct hfi1_devdata *dd) } if (fw_8051_load) { - ret = load_8051_firmware(dd, &fw_8051); + do { + ret = load_8051_firmware(dd, &fw_8051); + } while (retry_firmware(dd, ret)); if (ret) return ret; } @@ -1570,7 +1691,9 @@ int load_pcie_firmware(struct hfi1_devdata *dd) if (fw_sbus_load) { turn_off_spicos(dd, SPICO_SBUS); - ret = load_sbus_firmware(dd, &fw_sbus); + do { + ret = load_sbus_firmware(dd, &fw_sbus); + } while (retry_firmware(dd, ret)); if (ret) goto done; } @@ -1581,7 +1704,9 @@ int load_pcie_firmware(struct hfi1_devdata *dd) pcie_serdes_broadcast[dd->hfi1_id], pcie_serdes_addrs[dd->hfi1_id], NUM_PCIE_SERDES); - ret = load_pcie_serdes_firmware(dd, &fw_pcie); + do { + ret = load_pcie_serdes_firmware(dd, &fw_pcie); + } while (retry_firmware(dd, ret)); if (ret) goto done; } From 93990be3023c11f054f7ac3bcbc2a1c4edda6bec Mon Sep 17 00:00:00 2001 From: Dean Luick Date: Tue, 1 Dec 2015 15:38:11 -0500 Subject: [PATCH 699/843] staging/rdma/hfi1: Decode CNP opcode Add CNP opcode decode. Prior to this patch the trace appeared like: -0 [001] d.h. 94062.578932: input_ibhdr: [0000:05:00.0] vl 0 lver 0 sl 0 lnh 2,LRH_BTH dlid 0003 len 6 slid 0001 op 0x80,0x80 se 0 m 0 pad 0 tver 0 pkey 0x8001 f 0 b 0 qpn 0x001234 a 0 psn 0x00000000 Note the "op 0x80,0x80". With this patch: -0 [000] d.h. 233975.912059: input_ibhdr: [0000:05:00.0] vl 0 lver 0 sl 0 lnh 2,LRH_BTH dlid 0015 len 6 slid 0014 op 0x80,CNP se 0 m 0 pad 0 tver 0 pkey 0x8001 f 0 b 0 qpn 0x001234 a 0 psn 0x00000000 Note the "op 0x80,CNP" Reviewed-by: Mike Marciniszyn Signed-off-by: Dean Luick Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/trace.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rdma/hfi1/trace.h b/drivers/staging/rdma/hfi1/trace.h index 57430295c404..86c12ebfd4f0 100644 --- a/drivers/staging/rdma/hfi1/trace.h +++ b/drivers/staging/rdma/hfi1/trace.h @@ -417,7 +417,8 @@ __print_symbolic(opcode, \ ib_opcode_name(UC_RDMA_WRITE_ONLY), \ ib_opcode_name(UC_RDMA_WRITE_ONLY_WITH_IMMEDIATE), \ ib_opcode_name(UD_SEND_ONLY), \ - ib_opcode_name(UD_SEND_ONLY_WITH_IMMEDIATE)) + ib_opcode_name(UD_SEND_ONLY_WITH_IMMEDIATE), \ + ib_opcode_name(CNP)) #define LRH_PRN "vl %d lver %d sl %d lnh %d,%s dlid %.4x len %d slid %.4x" From 3802f7eb886582735112b6867286e1acc3991f55 Mon Sep 17 00:00:00 2001 From: Dean Luick Date: Tue, 1 Dec 2015 15:38:12 -0500 Subject: [PATCH 700/843] staging/rdma/hfi1: Add aeth name syndrome decode Add aeth name syndrome decode to enhance debugging. The IBTA RC ACK contains an ACK extended transport header. Part of that header is the syndrome field that qualifies the RC ACK as an ACK, NAK, or RNR NAK. Without the patch here is the syndrome decode: aeth syn 0x00 Here is the decode with the fix: aeth syn 0x00 ACK Reviewed-by: Mike Marciniszyn Signed-off-by: Dean Luick Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/trace.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rdma/hfi1/trace.c b/drivers/staging/rdma/hfi1/trace.c index f55b75194847..10122e84cb2f 100644 --- a/drivers/staging/rdma/hfi1/trace.c +++ b/drivers/staging/rdma/hfi1/trace.c @@ -67,7 +67,7 @@ u8 ibhdr_exhdr_len(struct hfi1_ib_header *hdr) #define IMM_PRN "imm %d" #define RETH_PRN "reth vaddr 0x%.16llx rkey 0x%.8x dlen 0x%.8x" -#define AETH_PRN "aeth syn 0x%.2x msn 0x%.8x" +#define AETH_PRN "aeth syn 0x%.2x %s msn 0x%.8x" #define DETH_PRN "deth qkey 0x%.8x sqpn 0x%.6x" #define ATOMICACKETH_PRN "origdata %lld" #define ATOMICETH_PRN "vaddr 0x%llx rkey 0x%.8x sdata %lld cdata %lld" @@ -79,6 +79,19 @@ static u64 ib_u64_get(__be32 *p) return ((u64)be32_to_cpu(p[0]) << 32) | be32_to_cpu(p[1]); } +static const char *parse_syndrome(u8 syndrome) +{ + switch (syndrome >> 5) { + case 0: + return "ACK"; + case 1: + return "RNRNAK"; + case 3: + return "NAK"; + } + return ""; +} + const char *parse_everbs_hdrs( struct trace_seq *p, u8 opcode, @@ -124,16 +137,18 @@ const char *parse_everbs_hdrs( case OP(RC, RDMA_READ_RESPONSE_LAST): case OP(RC, RDMA_READ_RESPONSE_ONLY): case OP(RC, ACKNOWLEDGE): - trace_seq_printf(p, AETH_PRN, - be32_to_cpu(eh->aeth) >> 24, - be32_to_cpu(eh->aeth) & HFI1_MSN_MASK); + trace_seq_printf(p, AETH_PRN, be32_to_cpu(eh->aeth) >> 24, + parse_syndrome(be32_to_cpu(eh->aeth) >> 24), + be32_to_cpu(eh->aeth) & HFI1_MSN_MASK); break; /* aeth + atomicacketh */ case OP(RC, ATOMIC_ACKNOWLEDGE): trace_seq_printf(p, AETH_PRN " " ATOMICACKETH_PRN, - (be32_to_cpu(eh->at.aeth) >> 24) & 0xff, - be32_to_cpu(eh->at.aeth) & HFI1_MSN_MASK, - (unsigned long long)ib_u64_get(eh->at.atomic_ack_eth)); + be32_to_cpu(eh->at.aeth) >> 24, + parse_syndrome(be32_to_cpu(eh->at.aeth) >> 24), + be32_to_cpu(eh->at.aeth) & HFI1_MSN_MASK, + (unsigned long long) + ib_u64_get(eh->at.atomic_ack_eth)); break; /* atomiceth */ case OP(RC, COMPARE_SWAP): From 92d207f31532d48bb86a1a14f9a92df11c9a315c Mon Sep 17 00:00:00 2001 From: Kaike Wan Date: Tue, 1 Dec 2015 15:38:13 -0500 Subject: [PATCH 701/843] staging/rdma/hfi1: Fix qp.h comments This patch fixes a few incorrect header file comments in qp.h Reviewed-by: Mike Marciniszyn Signed-off-by: Kaike Wan Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/qp.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rdma/hfi1/qp.h b/drivers/staging/rdma/hfi1/qp.h index 94fd748a00a6..62a94c5d7dca 100644 --- a/drivers/staging/rdma/hfi1/qp.h +++ b/drivers/staging/rdma/hfi1/qp.h @@ -211,7 +211,7 @@ int hfi1_qp_init(struct hfi1_ibdev *dev); void hfi1_qp_exit(struct hfi1_ibdev *dev); /** - * hfi1_qp_waitup - wake up on the indicated event + * hfi1_qp_wakeup - wake up on the indicated event * @qp: the QP * @flag: flag the qp on which the qp is stalled */ @@ -222,19 +222,19 @@ struct sdma_engine *qp_to_sdma_engine(struct hfi1_qp *qp, u8 sc5); struct qp_iter; /** - * qp_iter_init - wake up on the indicated event + * qp_iter_init - initialize the iterator for the qp hash list * @dev: the hfi1_ibdev */ struct qp_iter *qp_iter_init(struct hfi1_ibdev *dev); /** - * qp_iter_next - wakeup on the indicated event + * qp_iter_next - Find the next qp in the hash list * @iter: the iterator for the qp hash list */ int qp_iter_next(struct qp_iter *iter); /** - * qp_iter_next - wake up on the indicated event + * qp_iter_print - print the qp information to seq_file * @s: the seq_file to emit the qp information on * @iter: the iterator for the qp hash list */ From bbdeb33d2774ddc7475aab7868a5c447503a256e Mon Sep 17 00:00:00 2001 From: Dean Luick Date: Tue, 1 Dec 2015 15:38:15 -0500 Subject: [PATCH 702/843] staging/rdma/hfi1: Add one-time LCB reset Add one-time LCB reset on driver load to pre-emptively work around any LCB power cycle issues. Reviewed-by: Easwar Hariharan Signed-off-by: Dean Luick Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/chip.c | 20 ++++++++++++++++++++ drivers/staging/rdma/hfi1/chip_registers.h | 3 +++ 2 files changed, 23 insertions(+) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index bcbd831d2b73..62813052fc99 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -5896,6 +5896,23 @@ void init_qsfp(struct hfi1_pportdata *ppd) } } +/* + * Do a one-time initialize of the LCB block. + */ +static void init_lcb(struct hfi1_devdata *dd) +{ + /* the DC has been reset earlier in the driver load */ + + /* set LCB for cclk loopback on the port */ + write_csr(dd, DC_LCB_CFG_TX_FIFOS_RESET, 0x01); + write_csr(dd, DC_LCB_CFG_LANE_WIDTH, 0x00); + write_csr(dd, DC_LCB_CFG_REINIT_AS_SLAVE, 0x00); + write_csr(dd, DC_LCB_CFG_CNT_FOR_SKIP_STALL, 0x110); + write_csr(dd, DC_LCB_CFG_CLK_CNTR, 0x08); + write_csr(dd, DC_LCB_CFG_LOOPBACK, 0x02); + write_csr(dd, DC_LCB_CFG_TX_FIFOS_RESET, 0x00); +} + int bringup_serdes(struct hfi1_pportdata *ppd) { struct hfi1_devdata *dd = ppd->dd; @@ -5917,6 +5934,9 @@ int bringup_serdes(struct hfi1_pportdata *ppd) /* Set linkinit_reason on power up per OPA spec */ ppd->linkinit_reason = OPA_LINKINIT_REASON_LINKUP; + /* one-time init of the LCB */ + init_lcb(dd); + if (loopback) { ret = init_loopback(dd); if (ret < 0) diff --git a/drivers/staging/rdma/hfi1/chip_registers.h b/drivers/staging/rdma/hfi1/chip_registers.h index 5056c848af35..701e9e1012a6 100644 --- a/drivers/staging/rdma/hfi1/chip_registers.h +++ b/drivers/staging/rdma/hfi1/chip_registers.h @@ -318,6 +318,9 @@ #define DC_LCB_CFG_TX_FIFOS_RADR_RST_VAL_SHIFT 0 #define DC_LCB_CFG_TX_FIFOS_RESET (DC_LCB_CSRS + 0x000000000008) #define DC_LCB_CFG_TX_FIFOS_RESET_VAL_SHIFT 0 +#define DC_LCB_CFG_REINIT_AS_SLAVE (DC_LCB_CSRS + 0x000000000030) +#define DC_LCB_CFG_CNT_FOR_SKIP_STALL (DC_LCB_CSRS + 0x000000000040) +#define DC_LCB_CFG_CLK_CNTR (DC_LCB_CSRS + 0x000000000110) #define DC_LCB_ERR_CLR (DC_LCB_CSRS + 0x000000000308) #define DC_LCB_ERR_EN (DC_LCB_CSRS + 0x000000000310) #define DC_LCB_ERR_FLG (DC_LCB_CSRS + 0x000000000300) From 05087f3b224ad42086c019ff11679298faeb50f2 Mon Sep 17 00:00:00 2001 From: Dean Luick Date: Tue, 1 Dec 2015 15:38:16 -0500 Subject: [PATCH 703/843] staging/rdma/hfi1: Extend quiet timeout The longest quiet timeout is now 6s. Extend the driver wait to 6s. The driver wasn't following our internal specification: 6 seconds. This patch corrects that issue. Reviewed-by: Dennis Dalessandro Signed-off-by: Dean Luick Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/chip.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index 62813052fc99..03a665f0254e 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -6379,9 +6379,10 @@ static int goto_offline(struct hfi1_pportdata *ppd, u8 rem_reason) * depending on how the link went down. The 8051 firmware * will observe the needed wait time and only move to ready * when that is completed. The largest of the quiet timeouts - * is 2.5s, so wait that long and then a bit more. + * is 6s, so wait that long and then at least 0.5s more for + * other transitions, and another 0.5s for a buffer. */ - ret = wait_fm_ready(dd, 3000); + ret = wait_fm_ready(dd, 7000); if (ret) { dd_dev_err(dd, "After going offline, timed out waiting for the 8051 to become ready to accept host requests\n"); From d22f9d6bf5622bc3ffb709fb229715167a8bd533 Mon Sep 17 00:00:00 2001 From: Dean Luick Date: Tue, 1 Dec 2015 15:38:17 -0500 Subject: [PATCH 704/843] staging/rdma/hfi1: Add a credit push on diagpkt allocate fail When sending a diagnostic packet, if the send context does not have enough room, force a credit return and try again. Reviewed-by: Dennis Dalessandro Signed-off-by: Dean Luick Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/diag.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/staging/rdma/hfi1/diag.c b/drivers/staging/rdma/hfi1/diag.c index 0aaad7412842..e4cd333bba83 100644 --- a/drivers/staging/rdma/hfi1/diag.c +++ b/drivers/staging/rdma/hfi1/diag.c @@ -379,6 +379,7 @@ static ssize_t diagpkt_send(struct diag_pkt *dp) pio_release_cb credit_cb = NULL; void *credit_arg = NULL; struct diagpkt_wait *wait = NULL; + int trycount = 0; dd = hfi1_lookup(dp->unit); if (!dd || !(dd->flags & HFI1_PRESENT) || !dd->kregbase) { @@ -493,8 +494,15 @@ static ssize_t diagpkt_send(struct diag_pkt *dp) credit_arg = wait; } +retry: pbuf = sc_buffer_alloc(sc, total_len, credit_cb, credit_arg); if (!pbuf) { + if (trycount == 0) { + /* force a credit return and try again */ + sc_return_credits(sc); + trycount = 1; + goto retry; + } /* * No send buffer means no credit callback. Undo * the wait set-up that was done above. We free wait From 11a5909b26942683d5ec7e6810054a36d5a6ee67 Mon Sep 17 00:00:00 2001 From: Dean Luick Date: Tue, 1 Dec 2015 15:38:18 -0500 Subject: [PATCH 705/843] staging/rdma/hfi1: Correctly limit VLs against SDMA engines Correctly reduce the number of VLs when limited by the number of SDMA engines. The hardware has multiple egress mechanisms, SDMA and pio, and multiples of those. These mechanisms are chosen using the VL (8) The fix corrects a panic issue with one of the platforms that doesn't have enough SDMA (4) mechanisms for the typical number of VLs. Reviewed-by: Mike Marciniszyn Signed-off-by: Dean Luick Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/chip.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index 03a665f0254e..0c27cc09c918 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -10645,9 +10645,9 @@ struct hfi1_devdata *hfi1_init_dd(struct pci_dev *pdev, /* insure num_vls isn't larger than number of sdma engines */ if (HFI1_CAP_IS_KSET(SDMA) && num_vls > dd->chip_sdma_engines) { dd_dev_err(dd, "num_vls %u too large, using %u VLs\n", - num_vls, HFI1_MAX_VLS_SUPPORTED); - ppd->vls_supported = num_vls = HFI1_MAX_VLS_SUPPORTED; - ppd->vls_operational = ppd->vls_supported; + num_vls, dd->chip_sdma_engines); + num_vls = dd->chip_sdma_engines; + ppd->vls_supported = dd->chip_sdma_engines; } /* From 2c5b521ae688a6943d79e3f1210502084b375ced Mon Sep 17 00:00:00 2001 From: Joel Rosenzweig Date: Tue, 1 Dec 2015 15:38:19 -0500 Subject: [PATCH 706/843] staging/rdma/hfi1: Adds software counters for bitfields within various error status fields Provides error status counters for CceErrStatus, Send*ErrStatus, RcvErrStatus and MISC_ERR_STATUS Reviewed-by: Mitko Haralanov Reviewed-by: Mike Marciniszyn Signed-off-by: Joel Rosenzweig Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/chip.c | 3185 +++++++++++++++++++++++++++++- drivers/staging/rdma/hfi1/chip.h | 269 +++ drivers/staging/rdma/hfi1/hfi.h | 34 + 3 files changed, 3487 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index 0c27cc09c918..3cf6fea0bf35 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -664,7 +664,7 @@ static struct flag_table egress_err_info_flags[] = { */ #define SES(name) SEND_ERR_STATUS_SEND_##name##_ERR_SMASK static struct flag_table send_err_status_flags[] = { -/* 0*/ FLAG_ENTRY0("SDmaRpyTagErr", SES(CSR_PARITY)), +/* 0*/ FLAG_ENTRY0("SendCsrParityErr", SES(CSR_PARITY)), /* 1*/ FLAG_ENTRY0("SendCsrReadBadAddrErr", SES(CSR_READ_BAD_ADDR)), /* 2*/ FLAG_ENTRY0("SendCsrWriteBadAddrErr", SES(CSR_WRITE_BAD_ADDR)) }; @@ -1539,6 +1539,2336 @@ static u64 access_sw_send_schedule(const struct cntr_entry *entry, return dd->verbs_dev.n_send_schedule; } +/* Software counters for the error status bits within MISC_ERR_STATUS */ +static u64 access_misc_pll_lock_fail_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->misc_err_status_cnt[12]; +} + +static u64 access_misc_mbist_fail_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->misc_err_status_cnt[11]; +} + +static u64 access_misc_invalid_eep_cmd_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->misc_err_status_cnt[10]; +} + +static u64 access_misc_efuse_done_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->misc_err_status_cnt[9]; +} + +static u64 access_misc_efuse_write_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->misc_err_status_cnt[8]; +} + +static u64 access_misc_efuse_read_bad_addr_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->misc_err_status_cnt[7]; +} + +static u64 access_misc_efuse_csr_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->misc_err_status_cnt[6]; +} + +static u64 access_misc_fw_auth_failed_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->misc_err_status_cnt[5]; +} + +static u64 access_misc_key_mismatch_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->misc_err_status_cnt[4]; +} + +static u64 access_misc_sbus_write_failed_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->misc_err_status_cnt[3]; +} + +static u64 access_misc_csr_write_bad_addr_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->misc_err_status_cnt[2]; +} + +static u64 access_misc_csr_read_bad_addr_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->misc_err_status_cnt[1]; +} + +static u64 access_misc_csr_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->misc_err_status_cnt[0]; +} + +/* + * Software counter for the aggregate of + * individual CceErrStatus counters + */ +static u64 access_sw_cce_err_status_aggregated_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_cce_err_status_aggregate; +} + +/* + * Software counters corresponding to each of the + * error status bits within CceErrStatus + */ +static u64 access_cce_msix_csr_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[40]; +} + +static u64 access_cce_int_map_unc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[39]; +} + +static u64 access_cce_int_map_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[38]; +} + +static u64 access_cce_msix_table_unc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[37]; +} + +static u64 access_cce_msix_table_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[36]; +} + +static u64 access_cce_rxdma_conv_fifo_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[35]; +} + +static u64 access_cce_rcpl_async_fifo_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[34]; +} + +static u64 access_cce_seg_write_bad_addr_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[33]; +} + +static u64 access_cce_seg_read_bad_addr_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[32]; +} + +static u64 access_la_triggered_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[31]; +} + +static u64 access_cce_trgt_cpl_timeout_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[30]; +} + +static u64 access_pcic_receive_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[29]; +} + +static u64 access_pcic_transmit_back_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[28]; +} + +static u64 access_pcic_transmit_front_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[27]; +} + +static u64 access_pcic_cpl_dat_q_unc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[26]; +} + +static u64 access_pcic_cpl_hd_q_unc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[25]; +} + +static u64 access_pcic_post_dat_q_unc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[24]; +} + +static u64 access_pcic_post_hd_q_unc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[23]; +} + +static u64 access_pcic_retry_sot_mem_unc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[22]; +} + +static u64 access_pcic_retry_mem_unc_err(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[21]; +} + +static u64 access_pcic_n_post_dat_q_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[20]; +} + +static u64 access_pcic_n_post_h_q_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[19]; +} + +static u64 access_pcic_cpl_dat_q_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[18]; +} + +static u64 access_pcic_cpl_hd_q_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[17]; +} + +static u64 access_pcic_post_dat_q_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[16]; +} + +static u64 access_pcic_post_hd_q_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[15]; +} + +static u64 access_pcic_retry_sot_mem_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[14]; +} + +static u64 access_pcic_retry_mem_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[13]; +} + +static u64 access_cce_cli1_async_fifo_dbg_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[12]; +} + +static u64 access_cce_cli1_async_fifo_rxdma_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[11]; +} + +static u64 access_cce_cli1_async_fifo_sdma_hd_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[10]; +} + +static u64 access_cce_cl1_async_fifo_pio_crdt_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[9]; +} + +static u64 access_cce_cli2_async_fifo_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[8]; +} + +static u64 access_cce_csr_cfg_bus_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[7]; +} + +static u64 access_cce_cli0_async_fifo_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[6]; +} + +static u64 access_cce_rspd_data_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[5]; +} + +static u64 access_cce_trgt_access_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[4]; +} + +static u64 access_cce_trgt_async_fifo_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[3]; +} + +static u64 access_cce_csr_write_bad_addr_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[2]; +} + +static u64 access_cce_csr_read_bad_addr_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[1]; +} + +static u64 access_ccs_csr_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->cce_err_status_cnt[0]; +} + +/* + * Software counters corresponding to each of the + * error status bits within RcvErrStatus + */ +static u64 access_rx_csr_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[63]; +} + +static u64 access_rx_csr_write_bad_addr_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[62]; +} + +static u64 access_rx_csr_read_bad_addr_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[61]; +} + +static u64 access_rx_dma_csr_unc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[60]; +} + +static u64 access_rx_dma_dq_fsm_encoding_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[59]; +} + +static u64 access_rx_dma_eq_fsm_encoding_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[58]; +} + +static u64 access_rx_dma_csr_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[57]; +} + +static u64 access_rx_rbuf_data_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[56]; +} + +static u64 access_rx_rbuf_data_unc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[55]; +} + +static u64 access_rx_dma_data_fifo_rd_cor_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[54]; +} + +static u64 access_rx_dma_data_fifo_rd_unc_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[53]; +} + +static u64 access_rx_dma_hdr_fifo_rd_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[52]; +} + +static u64 access_rx_dma_hdr_fifo_rd_unc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[51]; +} + +static u64 access_rx_rbuf_desc_part2_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[50]; +} + +static u64 access_rx_rbuf_desc_part2_unc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[49]; +} + +static u64 access_rx_rbuf_desc_part1_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[48]; +} + +static u64 access_rx_rbuf_desc_part1_unc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[47]; +} + +static u64 access_rx_hq_intr_fsm_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[46]; +} + +static u64 access_rx_hq_intr_csr_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[45]; +} + +static u64 access_rx_lookup_csr_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[44]; +} + +static u64 access_rx_lookup_rcv_array_cor_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[43]; +} + +static u64 access_rx_lookup_rcv_array_unc_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[42]; +} + +static u64 access_rx_lookup_des_part2_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[41]; +} + +static u64 access_rx_lookup_des_part1_unc_cor_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[40]; +} + +static u64 access_rx_lookup_des_part1_unc_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[39]; +} + +static u64 access_rx_rbuf_next_free_buf_cor_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[38]; +} + +static u64 access_rx_rbuf_next_free_buf_unc_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[37]; +} + +static u64 access_rbuf_fl_init_wr_addr_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[36]; +} + +static u64 access_rx_rbuf_fl_initdone_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[35]; +} + +static u64 access_rx_rbuf_fl_write_addr_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[34]; +} + +static u64 access_rx_rbuf_fl_rd_addr_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[33]; +} + +static u64 access_rx_rbuf_empty_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[32]; +} + +static u64 access_rx_rbuf_full_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[31]; +} + +static u64 access_rbuf_bad_lookup_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[30]; +} + +static u64 access_rbuf_ctx_id_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[29]; +} + +static u64 access_rbuf_csr_qeopdw_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[28]; +} + +static u64 access_rx_rbuf_csr_q_num_of_pkt_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[27]; +} + +static u64 access_rx_rbuf_csr_q_t1_ptr_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[26]; +} + +static u64 access_rx_rbuf_csr_q_hd_ptr_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[25]; +} + +static u64 access_rx_rbuf_csr_q_vld_bit_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[24]; +} + +static u64 access_rx_rbuf_csr_q_next_buf_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[23]; +} + +static u64 access_rx_rbuf_csr_q_ent_cnt_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[22]; +} + +static u64 access_rx_rbuf_csr_q_head_buf_num_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[21]; +} + +static u64 access_rx_rbuf_block_list_read_cor_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[20]; +} + +static u64 access_rx_rbuf_block_list_read_unc_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[19]; +} + +static u64 access_rx_rbuf_lookup_des_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[18]; +} + +static u64 access_rx_rbuf_lookup_des_unc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[17]; +} + +static u64 access_rx_rbuf_lookup_des_reg_unc_cor_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[16]; +} + +static u64 access_rx_rbuf_lookup_des_reg_unc_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[15]; +} + +static u64 access_rx_rbuf_free_list_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[14]; +} + +static u64 access_rx_rbuf_free_list_unc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[13]; +} + +static u64 access_rx_rcv_fsm_encoding_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[12]; +} + +static u64 access_rx_dma_flag_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[11]; +} + +static u64 access_rx_dma_flag_unc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[10]; +} + +static u64 access_rx_dc_sop_eop_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[9]; +} + +static u64 access_rx_rcv_csr_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[8]; +} + +static u64 access_rx_rcv_qp_map_table_cor_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[7]; +} + +static u64 access_rx_rcv_qp_map_table_unc_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[6]; +} + +static u64 access_rx_rcv_data_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[5]; +} + +static u64 access_rx_rcv_data_unc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[4]; +} + +static u64 access_rx_rcv_hdr_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[3]; +} + +static u64 access_rx_rcv_hdr_unc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[2]; +} + +static u64 access_rx_dc_intf_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[1]; +} + +static u64 access_rx_dma_csr_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->rcv_err_status_cnt[0]; +} + +/* + * Software counters corresponding to each of the + * error status bits within SendPioErrStatus + */ +static u64 access_pio_pec_sop_head_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[35]; +} + +static u64 access_pio_pcc_sop_head_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[34]; +} + +static u64 access_pio_last_returned_cnt_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[33]; +} + +static u64 access_pio_current_free_cnt_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[32]; +} + +static u64 access_pio_reserved_31_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[31]; +} + +static u64 access_pio_reserved_30_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[30]; +} + +static u64 access_pio_ppmc_sop_len_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[29]; +} + +static u64 access_pio_ppmc_bqc_mem_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[28]; +} + +static u64 access_pio_vl_fifo_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[27]; +} + +static u64 access_pio_vlf_sop_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[26]; +} + +static u64 access_pio_vlf_v1_len_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[25]; +} + +static u64 access_pio_block_qw_count_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[24]; +} + +static u64 access_pio_write_qw_valid_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[23]; +} + +static u64 access_pio_state_machine_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[22]; +} + +static u64 access_pio_write_data_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[21]; +} + +static u64 access_pio_host_addr_mem_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[20]; +} + +static u64 access_pio_host_addr_mem_unc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[19]; +} + +static u64 access_pio_pkt_evict_sm_or_arb_sm_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[18]; +} + +static u64 access_pio_init_sm_in_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[17]; +} + +static u64 access_pio_ppmc_pbl_fifo_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[16]; +} + +static u64 access_pio_credit_ret_fifo_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[15]; +} + +static u64 access_pio_v1_len_mem_bank1_cor_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[14]; +} + +static u64 access_pio_v1_len_mem_bank0_cor_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[13]; +} + +static u64 access_pio_v1_len_mem_bank1_unc_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[12]; +} + +static u64 access_pio_v1_len_mem_bank0_unc_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[11]; +} + +static u64 access_pio_sm_pkt_reset_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[10]; +} + +static u64 access_pio_pkt_evict_fifo_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[9]; +} + +static u64 access_pio_sbrdctrl_crrel_fifo_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[8]; +} + +static u64 access_pio_sbrdctl_crrel_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[7]; +} + +static u64 access_pio_pec_fifo_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[6]; +} + +static u64 access_pio_pcc_fifo_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[5]; +} + +static u64 access_pio_sb_mem_fifo1_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[4]; +} + +static u64 access_pio_sb_mem_fifo0_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[3]; +} + +static u64 access_pio_csr_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[2]; +} + +static u64 access_pio_write_addr_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[1]; +} + +static u64 access_pio_write_bad_ctxt_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_pio_err_status_cnt[0]; +} + +/* + * Software counters corresponding to each of the + * error status bits within SendDmaErrStatus + */ +static u64 access_sdma_pcie_req_tracking_cor_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_dma_err_status_cnt[3]; +} + +static u64 access_sdma_pcie_req_tracking_unc_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_dma_err_status_cnt[2]; +} + +static u64 access_sdma_csr_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_dma_err_status_cnt[1]; +} + +static u64 access_sdma_rpy_tag_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_dma_err_status_cnt[0]; +} + +/* + * Software counters corresponding to each of the + * error status bits within SendEgressErrStatus + */ +static u64 access_tx_read_pio_memory_csr_unc_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[63]; +} + +static u64 access_tx_read_sdma_memory_csr_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[62]; +} + +static u64 access_tx_egress_fifo_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[61]; +} + +static u64 access_tx_read_pio_memory_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[60]; +} + +static u64 access_tx_read_sdma_memory_cor_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[59]; +} + +static u64 access_tx_sb_hdr_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[58]; +} + +static u64 access_tx_credit_overrun_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[57]; +} + +static u64 access_tx_launch_fifo8_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[56]; +} + +static u64 access_tx_launch_fifo7_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[55]; +} + +static u64 access_tx_launch_fifo6_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[54]; +} + +static u64 access_tx_launch_fifo5_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[53]; +} + +static u64 access_tx_launch_fifo4_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[52]; +} + +static u64 access_tx_launch_fifo3_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[51]; +} + +static u64 access_tx_launch_fifo2_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[50]; +} + +static u64 access_tx_launch_fifo1_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[49]; +} + +static u64 access_tx_launch_fifo0_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[48]; +} + +static u64 access_tx_credit_return_vl_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[47]; +} + +static u64 access_tx_hcrc_insertion_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[46]; +} + +static u64 access_tx_egress_fifo_unc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[45]; +} + +static u64 access_tx_read_pio_memory_unc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[44]; +} + +static u64 access_tx_read_sdma_memory_unc_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[43]; +} + +static u64 access_tx_sb_hdr_unc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[42]; +} + +static u64 access_tx_credit_return_partiy_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[41]; +} + +static u64 access_tx_launch_fifo8_unc_or_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[40]; +} + +static u64 access_tx_launch_fifo7_unc_or_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[39]; +} + +static u64 access_tx_launch_fifo6_unc_or_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[38]; +} + +static u64 access_tx_launch_fifo5_unc_or_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[37]; +} + +static u64 access_tx_launch_fifo4_unc_or_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[36]; +} + +static u64 access_tx_launch_fifo3_unc_or_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[35]; +} + +static u64 access_tx_launch_fifo2_unc_or_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[34]; +} + +static u64 access_tx_launch_fifo1_unc_or_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[33]; +} + +static u64 access_tx_launch_fifo0_unc_or_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[32]; +} + +static u64 access_tx_sdma15_disallowed_packet_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[31]; +} + +static u64 access_tx_sdma14_disallowed_packet_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[30]; +} + +static u64 access_tx_sdma13_disallowed_packet_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[29]; +} + +static u64 access_tx_sdma12_disallowed_packet_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[28]; +} + +static u64 access_tx_sdma11_disallowed_packet_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[27]; +} + +static u64 access_tx_sdma10_disallowed_packet_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[26]; +} + +static u64 access_tx_sdma9_disallowed_packet_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[25]; +} + +static u64 access_tx_sdma8_disallowed_packet_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[24]; +} + +static u64 access_tx_sdma7_disallowed_packet_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[23]; +} + +static u64 access_tx_sdma6_disallowed_packet_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[22]; +} + +static u64 access_tx_sdma5_disallowed_packet_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[21]; +} + +static u64 access_tx_sdma4_disallowed_packet_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[20]; +} + +static u64 access_tx_sdma3_disallowed_packet_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[19]; +} + +static u64 access_tx_sdma2_disallowed_packet_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[18]; +} + +static u64 access_tx_sdma1_disallowed_packet_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[17]; +} + +static u64 access_tx_sdma0_disallowed_packet_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[16]; +} + +static u64 access_tx_config_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[15]; +} + +static u64 access_tx_sbrd_ctl_csr_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[14]; +} + +static u64 access_tx_launch_csr_parity_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[13]; +} + +static u64 access_tx_illegal_vl_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[12]; +} + +static u64 access_tx_sbrd_ctl_state_machine_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[11]; +} + +static u64 access_egress_reserved_10_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[10]; +} + +static u64 access_egress_reserved_9_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[9]; +} + +static u64 access_tx_sdma_launch_intf_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[8]; +} + +static u64 access_tx_pio_launch_intf_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[7]; +} + +static u64 access_egress_reserved_6_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[6]; +} + +static u64 access_tx_incorrect_link_state_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[5]; +} + +static u64 access_tx_linkdown_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[4]; +} + +static u64 access_tx_egress_fifi_underrun_or_parity_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[3]; +} + +static u64 access_egress_reserved_2_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[2]; +} + +static u64 access_tx_pkt_integrity_mem_unc_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[1]; +} + +static u64 access_tx_pkt_integrity_mem_cor_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_egress_err_status_cnt[0]; +} + +/* + * Software counters corresponding to each of the + * error status bits within SendErrStatus + */ +static u64 access_send_csr_write_bad_addr_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_err_status_cnt[2]; +} + +static u64 access_send_csr_read_bad_addr_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_err_status_cnt[1]; +} + +static u64 access_send_csr_parity_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->send_err_status_cnt[0]; +} + +/* + * Software counters corresponding to each of the + * error status bits within SendCtxtErrStatus + */ +static u64 access_pio_write_out_of_bounds_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_ctxt_err_status_cnt[4]; +} + +static u64 access_pio_write_overflow_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_ctxt_err_status_cnt[3]; +} + +static u64 access_pio_write_crosses_boundary_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_ctxt_err_status_cnt[2]; +} + +static u64 access_pio_disallowed_packet_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_ctxt_err_status_cnt[1]; +} + +static u64 access_pio_inconsistent_sop_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_ctxt_err_status_cnt[0]; +} + +/* + * Software counters corresponding to each of the + * error status bits within SendDmaEngErrStatus + */ +static u64 access_sdma_header_request_fifo_cor_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[23]; +} + +static u64 access_sdma_header_storage_cor_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[22]; +} + +static u64 access_sdma_packet_tracking_cor_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[21]; +} + +static u64 access_sdma_assembly_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[20]; +} + +static u64 access_sdma_desc_table_cor_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[19]; +} + +static u64 access_sdma_header_request_fifo_unc_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[18]; +} + +static u64 access_sdma_header_storage_unc_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[17]; +} + +static u64 access_sdma_packet_tracking_unc_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[16]; +} + +static u64 access_sdma_assembly_unc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[15]; +} + +static u64 access_sdma_desc_table_unc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[14]; +} + +static u64 access_sdma_timeout_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[13]; +} + +static u64 access_sdma_header_length_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[12]; +} + +static u64 access_sdma_header_address_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[11]; +} + +static u64 access_sdma_header_select_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[10]; +} + +static u64 access_sdma_reserved_9_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[9]; +} + +static u64 access_sdma_packet_desc_overflow_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[8]; +} + +static u64 access_sdma_length_mismatch_err_cnt(const struct cntr_entry *entry, + void *context, int vl, + int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[7]; +} + +static u64 access_sdma_halt_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[6]; +} + +static u64 access_sdma_mem_read_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[5]; +} + +static u64 access_sdma_first_desc_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[4]; +} + +static u64 access_sdma_tail_out_of_bounds_err_cnt( + const struct cntr_entry *entry, + void *context, int vl, int mode, u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[3]; +} + +static u64 access_sdma_too_long_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[2]; +} + +static u64 access_sdma_gen_mismatch_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[1]; +} + +static u64 access_sdma_wrong_dw_err_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_devdata *dd = (struct hfi1_devdata *)context; + + return dd->sw_send_dma_eng_err_status_cnt[0]; +} + #define def_access_sw_cpu(cntr) \ static u64 access_sw_cpu_##cntr(const struct cntr_entry *entry, \ void *context, int vl, int mode, u64 data) \ @@ -1729,6 +4059,794 @@ static struct cntr_entry dev_cntrs[DEV_CNTR_LAST] = { access_sw_kmem_wait), [C_SW_SEND_SCHED] = CNTR_ELEM("SendSched", 0, 0, CNTR_NORMAL, access_sw_send_schedule), +/* MISC_ERR_STATUS */ +[C_MISC_PLL_LOCK_FAIL_ERR] = CNTR_ELEM("MISC_PLL_LOCK_FAIL_ERR", 0, 0, + CNTR_NORMAL, + access_misc_pll_lock_fail_err_cnt), +[C_MISC_MBIST_FAIL_ERR] = CNTR_ELEM("MISC_MBIST_FAIL_ERR", 0, 0, + CNTR_NORMAL, + access_misc_mbist_fail_err_cnt), +[C_MISC_INVALID_EEP_CMD_ERR] = CNTR_ELEM("MISC_INVALID_EEP_CMD_ERR", 0, 0, + CNTR_NORMAL, + access_misc_invalid_eep_cmd_err_cnt), +[C_MISC_EFUSE_DONE_PARITY_ERR] = CNTR_ELEM("MISC_EFUSE_DONE_PARITY_ERR", 0, 0, + CNTR_NORMAL, + access_misc_efuse_done_parity_err_cnt), +[C_MISC_EFUSE_WRITE_ERR] = CNTR_ELEM("MISC_EFUSE_WRITE_ERR", 0, 0, + CNTR_NORMAL, + access_misc_efuse_write_err_cnt), +[C_MISC_EFUSE_READ_BAD_ADDR_ERR] = CNTR_ELEM("MISC_EFUSE_READ_BAD_ADDR_ERR", 0, + 0, CNTR_NORMAL, + access_misc_efuse_read_bad_addr_err_cnt), +[C_MISC_EFUSE_CSR_PARITY_ERR] = CNTR_ELEM("MISC_EFUSE_CSR_PARITY_ERR", 0, 0, + CNTR_NORMAL, + access_misc_efuse_csr_parity_err_cnt), +[C_MISC_FW_AUTH_FAILED_ERR] = CNTR_ELEM("MISC_FW_AUTH_FAILED_ERR", 0, 0, + CNTR_NORMAL, + access_misc_fw_auth_failed_err_cnt), +[C_MISC_KEY_MISMATCH_ERR] = CNTR_ELEM("MISC_KEY_MISMATCH_ERR", 0, 0, + CNTR_NORMAL, + access_misc_key_mismatch_err_cnt), +[C_MISC_SBUS_WRITE_FAILED_ERR] = CNTR_ELEM("MISC_SBUS_WRITE_FAILED_ERR", 0, 0, + CNTR_NORMAL, + access_misc_sbus_write_failed_err_cnt), +[C_MISC_CSR_WRITE_BAD_ADDR_ERR] = CNTR_ELEM("MISC_CSR_WRITE_BAD_ADDR_ERR", 0, 0, + CNTR_NORMAL, + access_misc_csr_write_bad_addr_err_cnt), +[C_MISC_CSR_READ_BAD_ADDR_ERR] = CNTR_ELEM("MISC_CSR_READ_BAD_ADDR_ERR", 0, 0, + CNTR_NORMAL, + access_misc_csr_read_bad_addr_err_cnt), +[C_MISC_CSR_PARITY_ERR] = CNTR_ELEM("MISC_CSR_PARITY_ERR", 0, 0, + CNTR_NORMAL, + access_misc_csr_parity_err_cnt), +/* CceErrStatus */ +[C_CCE_ERR_STATUS_AGGREGATED_CNT] = CNTR_ELEM("CceErrStatusAggregatedCnt", 0, 0, + CNTR_NORMAL, + access_sw_cce_err_status_aggregated_cnt), +[C_CCE_MSIX_CSR_PARITY_ERR] = CNTR_ELEM("CceMsixCsrParityErr", 0, 0, + CNTR_NORMAL, + access_cce_msix_csr_parity_err_cnt), +[C_CCE_INT_MAP_UNC_ERR] = CNTR_ELEM("CceIntMapUncErr", 0, 0, + CNTR_NORMAL, + access_cce_int_map_unc_err_cnt), +[C_CCE_INT_MAP_COR_ERR] = CNTR_ELEM("CceIntMapCorErr", 0, 0, + CNTR_NORMAL, + access_cce_int_map_cor_err_cnt), +[C_CCE_MSIX_TABLE_UNC_ERR] = CNTR_ELEM("CceMsixTableUncErr", 0, 0, + CNTR_NORMAL, + access_cce_msix_table_unc_err_cnt), +[C_CCE_MSIX_TABLE_COR_ERR] = CNTR_ELEM("CceMsixTableCorErr", 0, 0, + CNTR_NORMAL, + access_cce_msix_table_cor_err_cnt), +[C_CCE_RXDMA_CONV_FIFO_PARITY_ERR] = CNTR_ELEM("CceRxdmaConvFifoParityErr", 0, + 0, CNTR_NORMAL, + access_cce_rxdma_conv_fifo_parity_err_cnt), +[C_CCE_RCPL_ASYNC_FIFO_PARITY_ERR] = CNTR_ELEM("CceRcplAsyncFifoParityErr", 0, + 0, CNTR_NORMAL, + access_cce_rcpl_async_fifo_parity_err_cnt), +[C_CCE_SEG_WRITE_BAD_ADDR_ERR] = CNTR_ELEM("CceSegWriteBadAddrErr", 0, 0, + CNTR_NORMAL, + access_cce_seg_write_bad_addr_err_cnt), +[C_CCE_SEG_READ_BAD_ADDR_ERR] = CNTR_ELEM("CceSegReadBadAddrErr", 0, 0, + CNTR_NORMAL, + access_cce_seg_read_bad_addr_err_cnt), +[C_LA_TRIGGERED] = CNTR_ELEM("Cce LATriggered", 0, 0, + CNTR_NORMAL, + access_la_triggered_cnt), +[C_CCE_TRGT_CPL_TIMEOUT_ERR] = CNTR_ELEM("CceTrgtCplTimeoutErr", 0, 0, + CNTR_NORMAL, + access_cce_trgt_cpl_timeout_err_cnt), +[C_PCIC_RECEIVE_PARITY_ERR] = CNTR_ELEM("PcicReceiveParityErr", 0, 0, + CNTR_NORMAL, + access_pcic_receive_parity_err_cnt), +[C_PCIC_TRANSMIT_BACK_PARITY_ERR] = CNTR_ELEM("PcicTransmitBackParityErr", 0, 0, + CNTR_NORMAL, + access_pcic_transmit_back_parity_err_cnt), +[C_PCIC_TRANSMIT_FRONT_PARITY_ERR] = CNTR_ELEM("PcicTransmitFrontParityErr", 0, + 0, CNTR_NORMAL, + access_pcic_transmit_front_parity_err_cnt), +[C_PCIC_CPL_DAT_Q_UNC_ERR] = CNTR_ELEM("PcicCplDatQUncErr", 0, 0, + CNTR_NORMAL, + access_pcic_cpl_dat_q_unc_err_cnt), +[C_PCIC_CPL_HD_Q_UNC_ERR] = CNTR_ELEM("PcicCplHdQUncErr", 0, 0, + CNTR_NORMAL, + access_pcic_cpl_hd_q_unc_err_cnt), +[C_PCIC_POST_DAT_Q_UNC_ERR] = CNTR_ELEM("PcicPostDatQUncErr", 0, 0, + CNTR_NORMAL, + access_pcic_post_dat_q_unc_err_cnt), +[C_PCIC_POST_HD_Q_UNC_ERR] = CNTR_ELEM("PcicPostHdQUncErr", 0, 0, + CNTR_NORMAL, + access_pcic_post_hd_q_unc_err_cnt), +[C_PCIC_RETRY_SOT_MEM_UNC_ERR] = CNTR_ELEM("PcicRetrySotMemUncErr", 0, 0, + CNTR_NORMAL, + access_pcic_retry_sot_mem_unc_err_cnt), +[C_PCIC_RETRY_MEM_UNC_ERR] = CNTR_ELEM("PcicRetryMemUncErr", 0, 0, + CNTR_NORMAL, + access_pcic_retry_mem_unc_err), +[C_PCIC_N_POST_DAT_Q_PARITY_ERR] = CNTR_ELEM("PcicNPostDatQParityErr", 0, 0, + CNTR_NORMAL, + access_pcic_n_post_dat_q_parity_err_cnt), +[C_PCIC_N_POST_H_Q_PARITY_ERR] = CNTR_ELEM("PcicNPostHQParityErr", 0, 0, + CNTR_NORMAL, + access_pcic_n_post_h_q_parity_err_cnt), +[C_PCIC_CPL_DAT_Q_COR_ERR] = CNTR_ELEM("PcicCplDatQCorErr", 0, 0, + CNTR_NORMAL, + access_pcic_cpl_dat_q_cor_err_cnt), +[C_PCIC_CPL_HD_Q_COR_ERR] = CNTR_ELEM("PcicCplHdQCorErr", 0, 0, + CNTR_NORMAL, + access_pcic_cpl_hd_q_cor_err_cnt), +[C_PCIC_POST_DAT_Q_COR_ERR] = CNTR_ELEM("PcicPostDatQCorErr", 0, 0, + CNTR_NORMAL, + access_pcic_post_dat_q_cor_err_cnt), +[C_PCIC_POST_HD_Q_COR_ERR] = CNTR_ELEM("PcicPostHdQCorErr", 0, 0, + CNTR_NORMAL, + access_pcic_post_hd_q_cor_err_cnt), +[C_PCIC_RETRY_SOT_MEM_COR_ERR] = CNTR_ELEM("PcicRetrySotMemCorErr", 0, 0, + CNTR_NORMAL, + access_pcic_retry_sot_mem_cor_err_cnt), +[C_PCIC_RETRY_MEM_COR_ERR] = CNTR_ELEM("PcicRetryMemCorErr", 0, 0, + CNTR_NORMAL, + access_pcic_retry_mem_cor_err_cnt), +[C_CCE_CLI1_ASYNC_FIFO_DBG_PARITY_ERR] = CNTR_ELEM( + "CceCli1AsyncFifoDbgParityError", 0, 0, + CNTR_NORMAL, + access_cce_cli1_async_fifo_dbg_parity_err_cnt), +[C_CCE_CLI1_ASYNC_FIFO_RXDMA_PARITY_ERR] = CNTR_ELEM( + "CceCli1AsyncFifoRxdmaParityError", 0, 0, + CNTR_NORMAL, + access_cce_cli1_async_fifo_rxdma_parity_err_cnt + ), +[C_CCE_CLI1_ASYNC_FIFO_SDMA_HD_PARITY_ERR] = CNTR_ELEM( + "CceCli1AsyncFifoSdmaHdParityErr", 0, 0, + CNTR_NORMAL, + access_cce_cli1_async_fifo_sdma_hd_parity_err_cnt), +[C_CCE_CLI1_ASYNC_FIFO_PIO_CRDT_PARITY_ERR] = CNTR_ELEM( + "CceCli1AsyncFifoPioCrdtParityErr", 0, 0, + CNTR_NORMAL, + access_cce_cl1_async_fifo_pio_crdt_parity_err_cnt), +[C_CCE_CLI2_ASYNC_FIFO_PARITY_ERR] = CNTR_ELEM("CceCli2AsyncFifoParityErr", 0, + 0, CNTR_NORMAL, + access_cce_cli2_async_fifo_parity_err_cnt), +[C_CCE_CSR_CFG_BUS_PARITY_ERR] = CNTR_ELEM("CceCsrCfgBusParityErr", 0, 0, + CNTR_NORMAL, + access_cce_csr_cfg_bus_parity_err_cnt), +[C_CCE_CLI0_ASYNC_FIFO_PARTIY_ERR] = CNTR_ELEM("CceCli0AsyncFifoParityErr", 0, + 0, CNTR_NORMAL, + access_cce_cli0_async_fifo_parity_err_cnt), +[C_CCE_RSPD_DATA_PARITY_ERR] = CNTR_ELEM("CceRspdDataParityErr", 0, 0, + CNTR_NORMAL, + access_cce_rspd_data_parity_err_cnt), +[C_CCE_TRGT_ACCESS_ERR] = CNTR_ELEM("CceTrgtAccessErr", 0, 0, + CNTR_NORMAL, + access_cce_trgt_access_err_cnt), +[C_CCE_TRGT_ASYNC_FIFO_PARITY_ERR] = CNTR_ELEM("CceTrgtAsyncFifoParityErr", 0, + 0, CNTR_NORMAL, + access_cce_trgt_async_fifo_parity_err_cnt), +[C_CCE_CSR_WRITE_BAD_ADDR_ERR] = CNTR_ELEM("CceCsrWriteBadAddrErr", 0, 0, + CNTR_NORMAL, + access_cce_csr_write_bad_addr_err_cnt), +[C_CCE_CSR_READ_BAD_ADDR_ERR] = CNTR_ELEM("CceCsrReadBadAddrErr", 0, 0, + CNTR_NORMAL, + access_cce_csr_read_bad_addr_err_cnt), +[C_CCE_CSR_PARITY_ERR] = CNTR_ELEM("CceCsrParityErr", 0, 0, + CNTR_NORMAL, + access_ccs_csr_parity_err_cnt), + +/* RcvErrStatus */ +[C_RX_CSR_PARITY_ERR] = CNTR_ELEM("RxCsrParityErr", 0, 0, + CNTR_NORMAL, + access_rx_csr_parity_err_cnt), +[C_RX_CSR_WRITE_BAD_ADDR_ERR] = CNTR_ELEM("RxCsrWriteBadAddrErr", 0, 0, + CNTR_NORMAL, + access_rx_csr_write_bad_addr_err_cnt), +[C_RX_CSR_READ_BAD_ADDR_ERR] = CNTR_ELEM("RxCsrReadBadAddrErr", 0, 0, + CNTR_NORMAL, + access_rx_csr_read_bad_addr_err_cnt), +[C_RX_DMA_CSR_UNC_ERR] = CNTR_ELEM("RxDmaCsrUncErr", 0, 0, + CNTR_NORMAL, + access_rx_dma_csr_unc_err_cnt), +[C_RX_DMA_DQ_FSM_ENCODING_ERR] = CNTR_ELEM("RxDmaDqFsmEncodingErr", 0, 0, + CNTR_NORMAL, + access_rx_dma_dq_fsm_encoding_err_cnt), +[C_RX_DMA_EQ_FSM_ENCODING_ERR] = CNTR_ELEM("RxDmaEqFsmEncodingErr", 0, 0, + CNTR_NORMAL, + access_rx_dma_eq_fsm_encoding_err_cnt), +[C_RX_DMA_CSR_PARITY_ERR] = CNTR_ELEM("RxDmaCsrParityErr", 0, 0, + CNTR_NORMAL, + access_rx_dma_csr_parity_err_cnt), +[C_RX_RBUF_DATA_COR_ERR] = CNTR_ELEM("RxRbufDataCorErr", 0, 0, + CNTR_NORMAL, + access_rx_rbuf_data_cor_err_cnt), +[C_RX_RBUF_DATA_UNC_ERR] = CNTR_ELEM("RxRbufDataUncErr", 0, 0, + CNTR_NORMAL, + access_rx_rbuf_data_unc_err_cnt), +[C_RX_DMA_DATA_FIFO_RD_COR_ERR] = CNTR_ELEM("RxDmaDataFifoRdCorErr", 0, 0, + CNTR_NORMAL, + access_rx_dma_data_fifo_rd_cor_err_cnt), +[C_RX_DMA_DATA_FIFO_RD_UNC_ERR] = CNTR_ELEM("RxDmaDataFifoRdUncErr", 0, 0, + CNTR_NORMAL, + access_rx_dma_data_fifo_rd_unc_err_cnt), +[C_RX_DMA_HDR_FIFO_RD_COR_ERR] = CNTR_ELEM("RxDmaHdrFifoRdCorErr", 0, 0, + CNTR_NORMAL, + access_rx_dma_hdr_fifo_rd_cor_err_cnt), +[C_RX_DMA_HDR_FIFO_RD_UNC_ERR] = CNTR_ELEM("RxDmaHdrFifoRdUncErr", 0, 0, + CNTR_NORMAL, + access_rx_dma_hdr_fifo_rd_unc_err_cnt), +[C_RX_RBUF_DESC_PART2_COR_ERR] = CNTR_ELEM("RxRbufDescPart2CorErr", 0, 0, + CNTR_NORMAL, + access_rx_rbuf_desc_part2_cor_err_cnt), +[C_RX_RBUF_DESC_PART2_UNC_ERR] = CNTR_ELEM("RxRbufDescPart2UncErr", 0, 0, + CNTR_NORMAL, + access_rx_rbuf_desc_part2_unc_err_cnt), +[C_RX_RBUF_DESC_PART1_COR_ERR] = CNTR_ELEM("RxRbufDescPart1CorErr", 0, 0, + CNTR_NORMAL, + access_rx_rbuf_desc_part1_cor_err_cnt), +[C_RX_RBUF_DESC_PART1_UNC_ERR] = CNTR_ELEM("RxRbufDescPart1UncErr", 0, 0, + CNTR_NORMAL, + access_rx_rbuf_desc_part1_unc_err_cnt), +[C_RX_HQ_INTR_FSM_ERR] = CNTR_ELEM("RxHqIntrFsmErr", 0, 0, + CNTR_NORMAL, + access_rx_hq_intr_fsm_err_cnt), +[C_RX_HQ_INTR_CSR_PARITY_ERR] = CNTR_ELEM("RxHqIntrCsrParityErr", 0, 0, + CNTR_NORMAL, + access_rx_hq_intr_csr_parity_err_cnt), +[C_RX_LOOKUP_CSR_PARITY_ERR] = CNTR_ELEM("RxLookupCsrParityErr", 0, 0, + CNTR_NORMAL, + access_rx_lookup_csr_parity_err_cnt), +[C_RX_LOOKUP_RCV_ARRAY_COR_ERR] = CNTR_ELEM("RxLookupRcvArrayCorErr", 0, 0, + CNTR_NORMAL, + access_rx_lookup_rcv_array_cor_err_cnt), +[C_RX_LOOKUP_RCV_ARRAY_UNC_ERR] = CNTR_ELEM("RxLookupRcvArrayUncErr", 0, 0, + CNTR_NORMAL, + access_rx_lookup_rcv_array_unc_err_cnt), +[C_RX_LOOKUP_DES_PART2_PARITY_ERR] = CNTR_ELEM("RxLookupDesPart2ParityErr", 0, + 0, CNTR_NORMAL, + access_rx_lookup_des_part2_parity_err_cnt), +[C_RX_LOOKUP_DES_PART1_UNC_COR_ERR] = CNTR_ELEM("RxLookupDesPart1UncCorErr", 0, + 0, CNTR_NORMAL, + access_rx_lookup_des_part1_unc_cor_err_cnt), +[C_RX_LOOKUP_DES_PART1_UNC_ERR] = CNTR_ELEM("RxLookupDesPart1UncErr", 0, 0, + CNTR_NORMAL, + access_rx_lookup_des_part1_unc_err_cnt), +[C_RX_RBUF_NEXT_FREE_BUF_COR_ERR] = CNTR_ELEM("RxRbufNextFreeBufCorErr", 0, 0, + CNTR_NORMAL, + access_rx_rbuf_next_free_buf_cor_err_cnt), +[C_RX_RBUF_NEXT_FREE_BUF_UNC_ERR] = CNTR_ELEM("RxRbufNextFreeBufUncErr", 0, 0, + CNTR_NORMAL, + access_rx_rbuf_next_free_buf_unc_err_cnt), +[C_RX_RBUF_FL_INIT_WR_ADDR_PARITY_ERR] = CNTR_ELEM( + "RxRbufFlInitWrAddrParityErr", 0, 0, + CNTR_NORMAL, + access_rbuf_fl_init_wr_addr_parity_err_cnt), +[C_RX_RBUF_FL_INITDONE_PARITY_ERR] = CNTR_ELEM("RxRbufFlInitdoneParityErr", 0, + 0, CNTR_NORMAL, + access_rx_rbuf_fl_initdone_parity_err_cnt), +[C_RX_RBUF_FL_WRITE_ADDR_PARITY_ERR] = CNTR_ELEM("RxRbufFlWrAddrParityErr", 0, + 0, CNTR_NORMAL, + access_rx_rbuf_fl_write_addr_parity_err_cnt), +[C_RX_RBUF_FL_RD_ADDR_PARITY_ERR] = CNTR_ELEM("RxRbufFlRdAddrParityErr", 0, 0, + CNTR_NORMAL, + access_rx_rbuf_fl_rd_addr_parity_err_cnt), +[C_RX_RBUF_EMPTY_ERR] = CNTR_ELEM("RxRbufEmptyErr", 0, 0, + CNTR_NORMAL, + access_rx_rbuf_empty_err_cnt), +[C_RX_RBUF_FULL_ERR] = CNTR_ELEM("RxRbufFullErr", 0, 0, + CNTR_NORMAL, + access_rx_rbuf_full_err_cnt), +[C_RX_RBUF_BAD_LOOKUP_ERR] = CNTR_ELEM("RxRBufBadLookupErr", 0, 0, + CNTR_NORMAL, + access_rbuf_bad_lookup_err_cnt), +[C_RX_RBUF_CTX_ID_PARITY_ERR] = CNTR_ELEM("RxRbufCtxIdParityErr", 0, 0, + CNTR_NORMAL, + access_rbuf_ctx_id_parity_err_cnt), +[C_RX_RBUF_CSR_QEOPDW_PARITY_ERR] = CNTR_ELEM("RxRbufCsrQEOPDWParityErr", 0, 0, + CNTR_NORMAL, + access_rbuf_csr_qeopdw_parity_err_cnt), +[C_RX_RBUF_CSR_Q_NUM_OF_PKT_PARITY_ERR] = CNTR_ELEM( + "RxRbufCsrQNumOfPktParityErr", 0, 0, + CNTR_NORMAL, + access_rx_rbuf_csr_q_num_of_pkt_parity_err_cnt), +[C_RX_RBUF_CSR_Q_T1_PTR_PARITY_ERR] = CNTR_ELEM( + "RxRbufCsrQTlPtrParityErr", 0, 0, + CNTR_NORMAL, + access_rx_rbuf_csr_q_t1_ptr_parity_err_cnt), +[C_RX_RBUF_CSR_Q_HD_PTR_PARITY_ERR] = CNTR_ELEM("RxRbufCsrQHdPtrParityErr", 0, + 0, CNTR_NORMAL, + access_rx_rbuf_csr_q_hd_ptr_parity_err_cnt), +[C_RX_RBUF_CSR_Q_VLD_BIT_PARITY_ERR] = CNTR_ELEM("RxRbufCsrQVldBitParityErr", 0, + 0, CNTR_NORMAL, + access_rx_rbuf_csr_q_vld_bit_parity_err_cnt), +[C_RX_RBUF_CSR_Q_NEXT_BUF_PARITY_ERR] = CNTR_ELEM("RxRbufCsrQNextBufParityErr", + 0, 0, CNTR_NORMAL, + access_rx_rbuf_csr_q_next_buf_parity_err_cnt), +[C_RX_RBUF_CSR_Q_ENT_CNT_PARITY_ERR] = CNTR_ELEM("RxRbufCsrQEntCntParityErr", 0, + 0, CNTR_NORMAL, + access_rx_rbuf_csr_q_ent_cnt_parity_err_cnt), +[C_RX_RBUF_CSR_Q_HEAD_BUF_NUM_PARITY_ERR] = CNTR_ELEM( + "RxRbufCsrQHeadBufNumParityErr", 0, 0, + CNTR_NORMAL, + access_rx_rbuf_csr_q_head_buf_num_parity_err_cnt), +[C_RX_RBUF_BLOCK_LIST_READ_COR_ERR] = CNTR_ELEM("RxRbufBlockListReadCorErr", 0, + 0, CNTR_NORMAL, + access_rx_rbuf_block_list_read_cor_err_cnt), +[C_RX_RBUF_BLOCK_LIST_READ_UNC_ERR] = CNTR_ELEM("RxRbufBlockListReadUncErr", 0, + 0, CNTR_NORMAL, + access_rx_rbuf_block_list_read_unc_err_cnt), +[C_RX_RBUF_LOOKUP_DES_COR_ERR] = CNTR_ELEM("RxRbufLookupDesCorErr", 0, 0, + CNTR_NORMAL, + access_rx_rbuf_lookup_des_cor_err_cnt), +[C_RX_RBUF_LOOKUP_DES_UNC_ERR] = CNTR_ELEM("RxRbufLookupDesUncErr", 0, 0, + CNTR_NORMAL, + access_rx_rbuf_lookup_des_unc_err_cnt), +[C_RX_RBUF_LOOKUP_DES_REG_UNC_COR_ERR] = CNTR_ELEM( + "RxRbufLookupDesRegUncCorErr", 0, 0, + CNTR_NORMAL, + access_rx_rbuf_lookup_des_reg_unc_cor_err_cnt), +[C_RX_RBUF_LOOKUP_DES_REG_UNC_ERR] = CNTR_ELEM("RxRbufLookupDesRegUncErr", 0, 0, + CNTR_NORMAL, + access_rx_rbuf_lookup_des_reg_unc_err_cnt), +[C_RX_RBUF_FREE_LIST_COR_ERR] = CNTR_ELEM("RxRbufFreeListCorErr", 0, 0, + CNTR_NORMAL, + access_rx_rbuf_free_list_cor_err_cnt), +[C_RX_RBUF_FREE_LIST_UNC_ERR] = CNTR_ELEM("RxRbufFreeListUncErr", 0, 0, + CNTR_NORMAL, + access_rx_rbuf_free_list_unc_err_cnt), +[C_RX_RCV_FSM_ENCODING_ERR] = CNTR_ELEM("RxRcvFsmEncodingErr", 0, 0, + CNTR_NORMAL, + access_rx_rcv_fsm_encoding_err_cnt), +[C_RX_DMA_FLAG_COR_ERR] = CNTR_ELEM("RxDmaFlagCorErr", 0, 0, + CNTR_NORMAL, + access_rx_dma_flag_cor_err_cnt), +[C_RX_DMA_FLAG_UNC_ERR] = CNTR_ELEM("RxDmaFlagUncErr", 0, 0, + CNTR_NORMAL, + access_rx_dma_flag_unc_err_cnt), +[C_RX_DC_SOP_EOP_PARITY_ERR] = CNTR_ELEM("RxDcSopEopParityErr", 0, 0, + CNTR_NORMAL, + access_rx_dc_sop_eop_parity_err_cnt), +[C_RX_RCV_CSR_PARITY_ERR] = CNTR_ELEM("RxRcvCsrParityErr", 0, 0, + CNTR_NORMAL, + access_rx_rcv_csr_parity_err_cnt), +[C_RX_RCV_QP_MAP_TABLE_COR_ERR] = CNTR_ELEM("RxRcvQpMapTableCorErr", 0, 0, + CNTR_NORMAL, + access_rx_rcv_qp_map_table_cor_err_cnt), +[C_RX_RCV_QP_MAP_TABLE_UNC_ERR] = CNTR_ELEM("RxRcvQpMapTableUncErr", 0, 0, + CNTR_NORMAL, + access_rx_rcv_qp_map_table_unc_err_cnt), +[C_RX_RCV_DATA_COR_ERR] = CNTR_ELEM("RxRcvDataCorErr", 0, 0, + CNTR_NORMAL, + access_rx_rcv_data_cor_err_cnt), +[C_RX_RCV_DATA_UNC_ERR] = CNTR_ELEM("RxRcvDataUncErr", 0, 0, + CNTR_NORMAL, + access_rx_rcv_data_unc_err_cnt), +[C_RX_RCV_HDR_COR_ERR] = CNTR_ELEM("RxRcvHdrCorErr", 0, 0, + CNTR_NORMAL, + access_rx_rcv_hdr_cor_err_cnt), +[C_RX_RCV_HDR_UNC_ERR] = CNTR_ELEM("RxRcvHdrUncErr", 0, 0, + CNTR_NORMAL, + access_rx_rcv_hdr_unc_err_cnt), +[C_RX_DC_INTF_PARITY_ERR] = CNTR_ELEM("RxDcIntfParityErr", 0, 0, + CNTR_NORMAL, + access_rx_dc_intf_parity_err_cnt), +[C_RX_DMA_CSR_COR_ERR] = CNTR_ELEM("RxDmaCsrCorErr", 0, 0, + CNTR_NORMAL, + access_rx_dma_csr_cor_err_cnt), +/* SendPioErrStatus */ +[C_PIO_PEC_SOP_HEAD_PARITY_ERR] = CNTR_ELEM("PioPecSopHeadParityErr", 0, 0, + CNTR_NORMAL, + access_pio_pec_sop_head_parity_err_cnt), +[C_PIO_PCC_SOP_HEAD_PARITY_ERR] = CNTR_ELEM("PioPccSopHeadParityErr", 0, 0, + CNTR_NORMAL, + access_pio_pcc_sop_head_parity_err_cnt), +[C_PIO_LAST_RETURNED_CNT_PARITY_ERR] = CNTR_ELEM("PioLastReturnedCntParityErr", + 0, 0, CNTR_NORMAL, + access_pio_last_returned_cnt_parity_err_cnt), +[C_PIO_CURRENT_FREE_CNT_PARITY_ERR] = CNTR_ELEM("PioCurrentFreeCntParityErr", 0, + 0, CNTR_NORMAL, + access_pio_current_free_cnt_parity_err_cnt), +[C_PIO_RSVD_31_ERR] = CNTR_ELEM("Pio Reserved 31", 0, 0, + CNTR_NORMAL, + access_pio_reserved_31_err_cnt), +[C_PIO_RSVD_30_ERR] = CNTR_ELEM("Pio Reserved 30", 0, 0, + CNTR_NORMAL, + access_pio_reserved_30_err_cnt), +[C_PIO_PPMC_SOP_LEN_ERR] = CNTR_ELEM("PioPpmcSopLenErr", 0, 0, + CNTR_NORMAL, + access_pio_ppmc_sop_len_err_cnt), +[C_PIO_PPMC_BQC_MEM_PARITY_ERR] = CNTR_ELEM("PioPpmcBqcMemParityErr", 0, 0, + CNTR_NORMAL, + access_pio_ppmc_bqc_mem_parity_err_cnt), +[C_PIO_VL_FIFO_PARITY_ERR] = CNTR_ELEM("PioVlFifoParityErr", 0, 0, + CNTR_NORMAL, + access_pio_vl_fifo_parity_err_cnt), +[C_PIO_VLF_SOP_PARITY_ERR] = CNTR_ELEM("PioVlfSopParityErr", 0, 0, + CNTR_NORMAL, + access_pio_vlf_sop_parity_err_cnt), +[C_PIO_VLF_V1_LEN_PARITY_ERR] = CNTR_ELEM("PioVlfVlLenParityErr", 0, 0, + CNTR_NORMAL, + access_pio_vlf_v1_len_parity_err_cnt), +[C_PIO_BLOCK_QW_COUNT_PARITY_ERR] = CNTR_ELEM("PioBlockQwCountParityErr", 0, 0, + CNTR_NORMAL, + access_pio_block_qw_count_parity_err_cnt), +[C_PIO_WRITE_QW_VALID_PARITY_ERR] = CNTR_ELEM("PioWriteQwValidParityErr", 0, 0, + CNTR_NORMAL, + access_pio_write_qw_valid_parity_err_cnt), +[C_PIO_STATE_MACHINE_ERR] = CNTR_ELEM("PioStateMachineErr", 0, 0, + CNTR_NORMAL, + access_pio_state_machine_err_cnt), +[C_PIO_WRITE_DATA_PARITY_ERR] = CNTR_ELEM("PioWriteDataParityErr", 0, 0, + CNTR_NORMAL, + access_pio_write_data_parity_err_cnt), +[C_PIO_HOST_ADDR_MEM_COR_ERR] = CNTR_ELEM("PioHostAddrMemCorErr", 0, 0, + CNTR_NORMAL, + access_pio_host_addr_mem_cor_err_cnt), +[C_PIO_HOST_ADDR_MEM_UNC_ERR] = CNTR_ELEM("PioHostAddrMemUncErr", 0, 0, + CNTR_NORMAL, + access_pio_host_addr_mem_unc_err_cnt), +[C_PIO_PKT_EVICT_SM_OR_ARM_SM_ERR] = CNTR_ELEM("PioPktEvictSmOrArbSmErr", 0, 0, + CNTR_NORMAL, + access_pio_pkt_evict_sm_or_arb_sm_err_cnt), +[C_PIO_INIT_SM_IN_ERR] = CNTR_ELEM("PioInitSmInErr", 0, 0, + CNTR_NORMAL, + access_pio_init_sm_in_err_cnt), +[C_PIO_PPMC_PBL_FIFO_ERR] = CNTR_ELEM("PioPpmcPblFifoErr", 0, 0, + CNTR_NORMAL, + access_pio_ppmc_pbl_fifo_err_cnt), +[C_PIO_CREDIT_RET_FIFO_PARITY_ERR] = CNTR_ELEM("PioCreditRetFifoParityErr", 0, + 0, CNTR_NORMAL, + access_pio_credit_ret_fifo_parity_err_cnt), +[C_PIO_V1_LEN_MEM_BANK1_COR_ERR] = CNTR_ELEM("PioVlLenMemBank1CorErr", 0, 0, + CNTR_NORMAL, + access_pio_v1_len_mem_bank1_cor_err_cnt), +[C_PIO_V1_LEN_MEM_BANK0_COR_ERR] = CNTR_ELEM("PioVlLenMemBank0CorErr", 0, 0, + CNTR_NORMAL, + access_pio_v1_len_mem_bank0_cor_err_cnt), +[C_PIO_V1_LEN_MEM_BANK1_UNC_ERR] = CNTR_ELEM("PioVlLenMemBank1UncErr", 0, 0, + CNTR_NORMAL, + access_pio_v1_len_mem_bank1_unc_err_cnt), +[C_PIO_V1_LEN_MEM_BANK0_UNC_ERR] = CNTR_ELEM("PioVlLenMemBank0UncErr", 0, 0, + CNTR_NORMAL, + access_pio_v1_len_mem_bank0_unc_err_cnt), +[C_PIO_SM_PKT_RESET_PARITY_ERR] = CNTR_ELEM("PioSmPktResetParityErr", 0, 0, + CNTR_NORMAL, + access_pio_sm_pkt_reset_parity_err_cnt), +[C_PIO_PKT_EVICT_FIFO_PARITY_ERR] = CNTR_ELEM("PioPktEvictFifoParityErr", 0, 0, + CNTR_NORMAL, + access_pio_pkt_evict_fifo_parity_err_cnt), +[C_PIO_SBRDCTRL_CRREL_FIFO_PARITY_ERR] = CNTR_ELEM( + "PioSbrdctrlCrrelFifoParityErr", 0, 0, + CNTR_NORMAL, + access_pio_sbrdctrl_crrel_fifo_parity_err_cnt), +[C_PIO_SBRDCTL_CRREL_PARITY_ERR] = CNTR_ELEM("PioSbrdctlCrrelParityErr", 0, 0, + CNTR_NORMAL, + access_pio_sbrdctl_crrel_parity_err_cnt), +[C_PIO_PEC_FIFO_PARITY_ERR] = CNTR_ELEM("PioPecFifoParityErr", 0, 0, + CNTR_NORMAL, + access_pio_pec_fifo_parity_err_cnt), +[C_PIO_PCC_FIFO_PARITY_ERR] = CNTR_ELEM("PioPccFifoParityErr", 0, 0, + CNTR_NORMAL, + access_pio_pcc_fifo_parity_err_cnt), +[C_PIO_SB_MEM_FIFO1_ERR] = CNTR_ELEM("PioSbMemFifo1Err", 0, 0, + CNTR_NORMAL, + access_pio_sb_mem_fifo1_err_cnt), +[C_PIO_SB_MEM_FIFO0_ERR] = CNTR_ELEM("PioSbMemFifo0Err", 0, 0, + CNTR_NORMAL, + access_pio_sb_mem_fifo0_err_cnt), +[C_PIO_CSR_PARITY_ERR] = CNTR_ELEM("PioCsrParityErr", 0, 0, + CNTR_NORMAL, + access_pio_csr_parity_err_cnt), +[C_PIO_WRITE_ADDR_PARITY_ERR] = CNTR_ELEM("PioWriteAddrParityErr", 0, 0, + CNTR_NORMAL, + access_pio_write_addr_parity_err_cnt), +[C_PIO_WRITE_BAD_CTXT_ERR] = CNTR_ELEM("PioWriteBadCtxtErr", 0, 0, + CNTR_NORMAL, + access_pio_write_bad_ctxt_err_cnt), +/* SendDmaErrStatus */ +[C_SDMA_PCIE_REQ_TRACKING_COR_ERR] = CNTR_ELEM("SDmaPcieReqTrackingCorErr", 0, + 0, CNTR_NORMAL, + access_sdma_pcie_req_tracking_cor_err_cnt), +[C_SDMA_PCIE_REQ_TRACKING_UNC_ERR] = CNTR_ELEM("SDmaPcieReqTrackingUncErr", 0, + 0, CNTR_NORMAL, + access_sdma_pcie_req_tracking_unc_err_cnt), +[C_SDMA_CSR_PARITY_ERR] = CNTR_ELEM("SDmaCsrParityErr", 0, 0, + CNTR_NORMAL, + access_sdma_csr_parity_err_cnt), +[C_SDMA_RPY_TAG_ERR] = CNTR_ELEM("SDmaRpyTagErr", 0, 0, + CNTR_NORMAL, + access_sdma_rpy_tag_err_cnt), +/* SendEgressErrStatus */ +[C_TX_READ_PIO_MEMORY_CSR_UNC_ERR] = CNTR_ELEM("TxReadPioMemoryCsrUncErr", 0, 0, + CNTR_NORMAL, + access_tx_read_pio_memory_csr_unc_err_cnt), +[C_TX_READ_SDMA_MEMORY_CSR_UNC_ERR] = CNTR_ELEM("TxReadSdmaMemoryCsrUncErr", 0, + 0, CNTR_NORMAL, + access_tx_read_sdma_memory_csr_err_cnt), +[C_TX_EGRESS_FIFO_COR_ERR] = CNTR_ELEM("TxEgressFifoCorErr", 0, 0, + CNTR_NORMAL, + access_tx_egress_fifo_cor_err_cnt), +[C_TX_READ_PIO_MEMORY_COR_ERR] = CNTR_ELEM("TxReadPioMemoryCorErr", 0, 0, + CNTR_NORMAL, + access_tx_read_pio_memory_cor_err_cnt), +[C_TX_READ_SDMA_MEMORY_COR_ERR] = CNTR_ELEM("TxReadSdmaMemoryCorErr", 0, 0, + CNTR_NORMAL, + access_tx_read_sdma_memory_cor_err_cnt), +[C_TX_SB_HDR_COR_ERR] = CNTR_ELEM("TxSbHdrCorErr", 0, 0, + CNTR_NORMAL, + access_tx_sb_hdr_cor_err_cnt), +[C_TX_CREDIT_OVERRUN_ERR] = CNTR_ELEM("TxCreditOverrunErr", 0, 0, + CNTR_NORMAL, + access_tx_credit_overrun_err_cnt), +[C_TX_LAUNCH_FIFO8_COR_ERR] = CNTR_ELEM("TxLaunchFifo8CorErr", 0, 0, + CNTR_NORMAL, + access_tx_launch_fifo8_cor_err_cnt), +[C_TX_LAUNCH_FIFO7_COR_ERR] = CNTR_ELEM("TxLaunchFifo7CorErr", 0, 0, + CNTR_NORMAL, + access_tx_launch_fifo7_cor_err_cnt), +[C_TX_LAUNCH_FIFO6_COR_ERR] = CNTR_ELEM("TxLaunchFifo6CorErr", 0, 0, + CNTR_NORMAL, + access_tx_launch_fifo6_cor_err_cnt), +[C_TX_LAUNCH_FIFO5_COR_ERR] = CNTR_ELEM("TxLaunchFifo5CorErr", 0, 0, + CNTR_NORMAL, + access_tx_launch_fifo5_cor_err_cnt), +[C_TX_LAUNCH_FIFO4_COR_ERR] = CNTR_ELEM("TxLaunchFifo4CorErr", 0, 0, + CNTR_NORMAL, + access_tx_launch_fifo4_cor_err_cnt), +[C_TX_LAUNCH_FIFO3_COR_ERR] = CNTR_ELEM("TxLaunchFifo3CorErr", 0, 0, + CNTR_NORMAL, + access_tx_launch_fifo3_cor_err_cnt), +[C_TX_LAUNCH_FIFO2_COR_ERR] = CNTR_ELEM("TxLaunchFifo2CorErr", 0, 0, + CNTR_NORMAL, + access_tx_launch_fifo2_cor_err_cnt), +[C_TX_LAUNCH_FIFO1_COR_ERR] = CNTR_ELEM("TxLaunchFifo1CorErr", 0, 0, + CNTR_NORMAL, + access_tx_launch_fifo1_cor_err_cnt), +[C_TX_LAUNCH_FIFO0_COR_ERR] = CNTR_ELEM("TxLaunchFifo0CorErr", 0, 0, + CNTR_NORMAL, + access_tx_launch_fifo0_cor_err_cnt), +[C_TX_CREDIT_RETURN_VL_ERR] = CNTR_ELEM("TxCreditReturnVLErr", 0, 0, + CNTR_NORMAL, + access_tx_credit_return_vl_err_cnt), +[C_TX_HCRC_INSERTION_ERR] = CNTR_ELEM("TxHcrcInsertionErr", 0, 0, + CNTR_NORMAL, + access_tx_hcrc_insertion_err_cnt), +[C_TX_EGRESS_FIFI_UNC_ERR] = CNTR_ELEM("TxEgressFifoUncErr", 0, 0, + CNTR_NORMAL, + access_tx_egress_fifo_unc_err_cnt), +[C_TX_READ_PIO_MEMORY_UNC_ERR] = CNTR_ELEM("TxReadPioMemoryUncErr", 0, 0, + CNTR_NORMAL, + access_tx_read_pio_memory_unc_err_cnt), +[C_TX_READ_SDMA_MEMORY_UNC_ERR] = CNTR_ELEM("TxReadSdmaMemoryUncErr", 0, 0, + CNTR_NORMAL, + access_tx_read_sdma_memory_unc_err_cnt), +[C_TX_SB_HDR_UNC_ERR] = CNTR_ELEM("TxSbHdrUncErr", 0, 0, + CNTR_NORMAL, + access_tx_sb_hdr_unc_err_cnt), +[C_TX_CREDIT_RETURN_PARITY_ERR] = CNTR_ELEM("TxCreditReturnParityErr", 0, 0, + CNTR_NORMAL, + access_tx_credit_return_partiy_err_cnt), +[C_TX_LAUNCH_FIFO8_UNC_OR_PARITY_ERR] = CNTR_ELEM("TxLaunchFifo8UncOrParityErr", + 0, 0, CNTR_NORMAL, + access_tx_launch_fifo8_unc_or_parity_err_cnt), +[C_TX_LAUNCH_FIFO7_UNC_OR_PARITY_ERR] = CNTR_ELEM("TxLaunchFifo7UncOrParityErr", + 0, 0, CNTR_NORMAL, + access_tx_launch_fifo7_unc_or_parity_err_cnt), +[C_TX_LAUNCH_FIFO6_UNC_OR_PARITY_ERR] = CNTR_ELEM("TxLaunchFifo6UncOrParityErr", + 0, 0, CNTR_NORMAL, + access_tx_launch_fifo6_unc_or_parity_err_cnt), +[C_TX_LAUNCH_FIFO5_UNC_OR_PARITY_ERR] = CNTR_ELEM("TxLaunchFifo5UncOrParityErr", + 0, 0, CNTR_NORMAL, + access_tx_launch_fifo5_unc_or_parity_err_cnt), +[C_TX_LAUNCH_FIFO4_UNC_OR_PARITY_ERR] = CNTR_ELEM("TxLaunchFifo4UncOrParityErr", + 0, 0, CNTR_NORMAL, + access_tx_launch_fifo4_unc_or_parity_err_cnt), +[C_TX_LAUNCH_FIFO3_UNC_OR_PARITY_ERR] = CNTR_ELEM("TxLaunchFifo3UncOrParityErr", + 0, 0, CNTR_NORMAL, + access_tx_launch_fifo3_unc_or_parity_err_cnt), +[C_TX_LAUNCH_FIFO2_UNC_OR_PARITY_ERR] = CNTR_ELEM("TxLaunchFifo2UncOrParityErr", + 0, 0, CNTR_NORMAL, + access_tx_launch_fifo2_unc_or_parity_err_cnt), +[C_TX_LAUNCH_FIFO1_UNC_OR_PARITY_ERR] = CNTR_ELEM("TxLaunchFifo1UncOrParityErr", + 0, 0, CNTR_NORMAL, + access_tx_launch_fifo1_unc_or_parity_err_cnt), +[C_TX_LAUNCH_FIFO0_UNC_OR_PARITY_ERR] = CNTR_ELEM("TxLaunchFifo0UncOrParityErr", + 0, 0, CNTR_NORMAL, + access_tx_launch_fifo0_unc_or_parity_err_cnt), +[C_TX_SDMA15_DISALLOWED_PACKET_ERR] = CNTR_ELEM("TxSdma15DisallowedPacketErr", + 0, 0, CNTR_NORMAL, + access_tx_sdma15_disallowed_packet_err_cnt), +[C_TX_SDMA14_DISALLOWED_PACKET_ERR] = CNTR_ELEM("TxSdma14DisallowedPacketErr", + 0, 0, CNTR_NORMAL, + access_tx_sdma14_disallowed_packet_err_cnt), +[C_TX_SDMA13_DISALLOWED_PACKET_ERR] = CNTR_ELEM("TxSdma13DisallowedPacketErr", + 0, 0, CNTR_NORMAL, + access_tx_sdma13_disallowed_packet_err_cnt), +[C_TX_SDMA12_DISALLOWED_PACKET_ERR] = CNTR_ELEM("TxSdma12DisallowedPacketErr", + 0, 0, CNTR_NORMAL, + access_tx_sdma12_disallowed_packet_err_cnt), +[C_TX_SDMA11_DISALLOWED_PACKET_ERR] = CNTR_ELEM("TxSdma11DisallowedPacketErr", + 0, 0, CNTR_NORMAL, + access_tx_sdma11_disallowed_packet_err_cnt), +[C_TX_SDMA10_DISALLOWED_PACKET_ERR] = CNTR_ELEM("TxSdma10DisallowedPacketErr", + 0, 0, CNTR_NORMAL, + access_tx_sdma10_disallowed_packet_err_cnt), +[C_TX_SDMA9_DISALLOWED_PACKET_ERR] = CNTR_ELEM("TxSdma9DisallowedPacketErr", + 0, 0, CNTR_NORMAL, + access_tx_sdma9_disallowed_packet_err_cnt), +[C_TX_SDMA8_DISALLOWED_PACKET_ERR] = CNTR_ELEM("TxSdma8DisallowedPacketErr", + 0, 0, CNTR_NORMAL, + access_tx_sdma8_disallowed_packet_err_cnt), +[C_TX_SDMA7_DISALLOWED_PACKET_ERR] = CNTR_ELEM("TxSdma7DisallowedPacketErr", + 0, 0, CNTR_NORMAL, + access_tx_sdma7_disallowed_packet_err_cnt), +[C_TX_SDMA6_DISALLOWED_PACKET_ERR] = CNTR_ELEM("TxSdma6DisallowedPacketErr", + 0, 0, CNTR_NORMAL, + access_tx_sdma6_disallowed_packet_err_cnt), +[C_TX_SDMA5_DISALLOWED_PACKET_ERR] = CNTR_ELEM("TxSdma5DisallowedPacketErr", + 0, 0, CNTR_NORMAL, + access_tx_sdma5_disallowed_packet_err_cnt), +[C_TX_SDMA4_DISALLOWED_PACKET_ERR] = CNTR_ELEM("TxSdma4DisallowedPacketErr", + 0, 0, CNTR_NORMAL, + access_tx_sdma4_disallowed_packet_err_cnt), +[C_TX_SDMA3_DISALLOWED_PACKET_ERR] = CNTR_ELEM("TxSdma3DisallowedPacketErr", + 0, 0, CNTR_NORMAL, + access_tx_sdma3_disallowed_packet_err_cnt), +[C_TX_SDMA2_DISALLOWED_PACKET_ERR] = CNTR_ELEM("TxSdma2DisallowedPacketErr", + 0, 0, CNTR_NORMAL, + access_tx_sdma2_disallowed_packet_err_cnt), +[C_TX_SDMA1_DISALLOWED_PACKET_ERR] = CNTR_ELEM("TxSdma1DisallowedPacketErr", + 0, 0, CNTR_NORMAL, + access_tx_sdma1_disallowed_packet_err_cnt), +[C_TX_SDMA0_DISALLOWED_PACKET_ERR] = CNTR_ELEM("TxSdma0DisallowedPacketErr", + 0, 0, CNTR_NORMAL, + access_tx_sdma0_disallowed_packet_err_cnt), +[C_TX_CONFIG_PARITY_ERR] = CNTR_ELEM("TxConfigParityErr", 0, 0, + CNTR_NORMAL, + access_tx_config_parity_err_cnt), +[C_TX_SBRD_CTL_CSR_PARITY_ERR] = CNTR_ELEM("TxSbrdCtlCsrParityErr", 0, 0, + CNTR_NORMAL, + access_tx_sbrd_ctl_csr_parity_err_cnt), +[C_TX_LAUNCH_CSR_PARITY_ERR] = CNTR_ELEM("TxLaunchCsrParityErr", 0, 0, + CNTR_NORMAL, + access_tx_launch_csr_parity_err_cnt), +[C_TX_ILLEGAL_CL_ERR] = CNTR_ELEM("TxIllegalVLErr", 0, 0, + CNTR_NORMAL, + access_tx_illegal_vl_err_cnt), +[C_TX_SBRD_CTL_STATE_MACHINE_PARITY_ERR] = CNTR_ELEM( + "TxSbrdCtlStateMachineParityErr", 0, 0, + CNTR_NORMAL, + access_tx_sbrd_ctl_state_machine_parity_err_cnt), +[C_TX_RESERVED_10] = CNTR_ELEM("Tx Egress Reserved 10", 0, 0, + CNTR_NORMAL, + access_egress_reserved_10_err_cnt), +[C_TX_RESERVED_9] = CNTR_ELEM("Tx Egress Reserved 9", 0, 0, + CNTR_NORMAL, + access_egress_reserved_9_err_cnt), +[C_TX_SDMA_LAUNCH_INTF_PARITY_ERR] = CNTR_ELEM("TxSdmaLaunchIntfParityErr", + 0, 0, CNTR_NORMAL, + access_tx_sdma_launch_intf_parity_err_cnt), +[C_TX_PIO_LAUNCH_INTF_PARITY_ERR] = CNTR_ELEM("TxPioLaunchIntfParityErr", 0, 0, + CNTR_NORMAL, + access_tx_pio_launch_intf_parity_err_cnt), +[C_TX_RESERVED_6] = CNTR_ELEM("Tx Egress Reserved 6", 0, 0, + CNTR_NORMAL, + access_egress_reserved_6_err_cnt), +[C_TX_INCORRECT_LINK_STATE_ERR] = CNTR_ELEM("TxIncorrectLinkStateErr", 0, 0, + CNTR_NORMAL, + access_tx_incorrect_link_state_err_cnt), +[C_TX_LINK_DOWN_ERR] = CNTR_ELEM("TxLinkdownErr", 0, 0, + CNTR_NORMAL, + access_tx_linkdown_err_cnt), +[C_TX_EGRESS_FIFO_UNDERRUN_OR_PARITY_ERR] = CNTR_ELEM( + "EgressFifoUnderrunOrParityErr", 0, 0, + CNTR_NORMAL, + access_tx_egress_fifi_underrun_or_parity_err_cnt), +[C_TX_RESERVED_2] = CNTR_ELEM("Tx Egress Reserved 2", 0, 0, + CNTR_NORMAL, + access_egress_reserved_2_err_cnt), +[C_TX_PKT_INTEGRITY_MEM_UNC_ERR] = CNTR_ELEM("TxPktIntegrityMemUncErr", 0, 0, + CNTR_NORMAL, + access_tx_pkt_integrity_mem_unc_err_cnt), +[C_TX_PKT_INTEGRITY_MEM_COR_ERR] = CNTR_ELEM("TxPktIntegrityMemCorErr", 0, 0, + CNTR_NORMAL, + access_tx_pkt_integrity_mem_cor_err_cnt), +/* SendErrStatus */ +[C_SEND_CSR_WRITE_BAD_ADDR_ERR] = CNTR_ELEM("SendCsrWriteBadAddrErr", 0, 0, + CNTR_NORMAL, + access_send_csr_write_bad_addr_err_cnt), +[C_SEND_CSR_READ_BAD_ADD_ERR] = CNTR_ELEM("SendCsrReadBadAddrErr", 0, 0, + CNTR_NORMAL, + access_send_csr_read_bad_addr_err_cnt), +[C_SEND_CSR_PARITY_ERR] = CNTR_ELEM("SendCsrParityErr", 0, 0, + CNTR_NORMAL, + access_send_csr_parity_cnt), +/* SendCtxtErrStatus */ +[C_PIO_WRITE_OUT_OF_BOUNDS_ERR] = CNTR_ELEM("PioWriteOutOfBoundsErr", 0, 0, + CNTR_NORMAL, + access_pio_write_out_of_bounds_err_cnt), +[C_PIO_WRITE_OVERFLOW_ERR] = CNTR_ELEM("PioWriteOverflowErr", 0, 0, + CNTR_NORMAL, + access_pio_write_overflow_err_cnt), +[C_PIO_WRITE_CROSSES_BOUNDARY_ERR] = CNTR_ELEM("PioWriteCrossesBoundaryErr", + 0, 0, CNTR_NORMAL, + access_pio_write_crosses_boundary_err_cnt), +[C_PIO_DISALLOWED_PACKET_ERR] = CNTR_ELEM("PioDisallowedPacketErr", 0, 0, + CNTR_NORMAL, + access_pio_disallowed_packet_err_cnt), +[C_PIO_INCONSISTENT_SOP_ERR] = CNTR_ELEM("PioInconsistentSopErr", 0, 0, + CNTR_NORMAL, + access_pio_inconsistent_sop_err_cnt), +/* SendDmaEngErrStatus */ +[C_SDMA_HEADER_REQUEST_FIFO_COR_ERR] = CNTR_ELEM("SDmaHeaderRequestFifoCorErr", + 0, 0, CNTR_NORMAL, + access_sdma_header_request_fifo_cor_err_cnt), +[C_SDMA_HEADER_STORAGE_COR_ERR] = CNTR_ELEM("SDmaHeaderStorageCorErr", 0, 0, + CNTR_NORMAL, + access_sdma_header_storage_cor_err_cnt), +[C_SDMA_PACKET_TRACKING_COR_ERR] = CNTR_ELEM("SDmaPacketTrackingCorErr", 0, 0, + CNTR_NORMAL, + access_sdma_packet_tracking_cor_err_cnt), +[C_SDMA_ASSEMBLY_COR_ERR] = CNTR_ELEM("SDmaAssemblyCorErr", 0, 0, + CNTR_NORMAL, + access_sdma_assembly_cor_err_cnt), +[C_SDMA_DESC_TABLE_COR_ERR] = CNTR_ELEM("SDmaDescTableCorErr", 0, 0, + CNTR_NORMAL, + access_sdma_desc_table_cor_err_cnt), +[C_SDMA_HEADER_REQUEST_FIFO_UNC_ERR] = CNTR_ELEM("SDmaHeaderRequestFifoUncErr", + 0, 0, CNTR_NORMAL, + access_sdma_header_request_fifo_unc_err_cnt), +[C_SDMA_HEADER_STORAGE_UNC_ERR] = CNTR_ELEM("SDmaHeaderStorageUncErr", 0, 0, + CNTR_NORMAL, + access_sdma_header_storage_unc_err_cnt), +[C_SDMA_PACKET_TRACKING_UNC_ERR] = CNTR_ELEM("SDmaPacketTrackingUncErr", 0, 0, + CNTR_NORMAL, + access_sdma_packet_tracking_unc_err_cnt), +[C_SDMA_ASSEMBLY_UNC_ERR] = CNTR_ELEM("SDmaAssemblyUncErr", 0, 0, + CNTR_NORMAL, + access_sdma_assembly_unc_err_cnt), +[C_SDMA_DESC_TABLE_UNC_ERR] = CNTR_ELEM("SDmaDescTableUncErr", 0, 0, + CNTR_NORMAL, + access_sdma_desc_table_unc_err_cnt), +[C_SDMA_TIMEOUT_ERR] = CNTR_ELEM("SDmaTimeoutErr", 0, 0, + CNTR_NORMAL, + access_sdma_timeout_err_cnt), +[C_SDMA_HEADER_LENGTH_ERR] = CNTR_ELEM("SDmaHeaderLengthErr", 0, 0, + CNTR_NORMAL, + access_sdma_header_length_err_cnt), +[C_SDMA_HEADER_ADDRESS_ERR] = CNTR_ELEM("SDmaHeaderAddressErr", 0, 0, + CNTR_NORMAL, + access_sdma_header_address_err_cnt), +[C_SDMA_HEADER_SELECT_ERR] = CNTR_ELEM("SDmaHeaderSelectErr", 0, 0, + CNTR_NORMAL, + access_sdma_header_select_err_cnt), +[C_SMDA_RESERVED_9] = CNTR_ELEM("SDma Reserved 9", 0, 0, + CNTR_NORMAL, + access_sdma_reserved_9_err_cnt), +[C_SDMA_PACKET_DESC_OVERFLOW_ERR] = CNTR_ELEM("SDmaPacketDescOverflowErr", 0, 0, + CNTR_NORMAL, + access_sdma_packet_desc_overflow_err_cnt), +[C_SDMA_LENGTH_MISMATCH_ERR] = CNTR_ELEM("SDmaLengthMismatchErr", 0, 0, + CNTR_NORMAL, + access_sdma_length_mismatch_err_cnt), +[C_SDMA_HALT_ERR] = CNTR_ELEM("SDmaHaltErr", 0, 0, + CNTR_NORMAL, + access_sdma_halt_err_cnt), +[C_SDMA_MEM_READ_ERR] = CNTR_ELEM("SDmaMemReadErr", 0, 0, + CNTR_NORMAL, + access_sdma_mem_read_err_cnt), +[C_SDMA_FIRST_DESC_ERR] = CNTR_ELEM("SDmaFirstDescErr", 0, 0, + CNTR_NORMAL, + access_sdma_first_desc_err_cnt), +[C_SDMA_TAIL_OUT_OF_BOUNDS_ERR] = CNTR_ELEM("SDmaTailOutOfBoundsErr", 0, 0, + CNTR_NORMAL, + access_sdma_tail_out_of_bounds_err_cnt), +[C_SDMA_TOO_LONG_ERR] = CNTR_ELEM("SDmaTooLongErr", 0, 0, + CNTR_NORMAL, + access_sdma_too_long_err_cnt), +[C_SDMA_GEN_MISMATCH_ERR] = CNTR_ELEM("SDmaGenMismatchErr", 0, 0, + CNTR_NORMAL, + access_sdma_gen_mismatch_err_cnt), +[C_SDMA_WRONG_DW_ERR] = CNTR_ELEM("SDmaWrongDwErr", 0, 0, + CNTR_NORMAL, + access_sdma_wrong_dw_err_cnt), }; static struct cntr_entry port_cntrs[PORT_CNTR_LAST] = { @@ -2174,6 +5292,7 @@ static char *send_err_status_string(char *buf, int buf_len, u64 flags) static void handle_cce_err(struct hfi1_devdata *dd, u32 unused, u64 reg) { char buf[96]; + int i = 0; /* * For most these errors, there is nothing that can be done except @@ -2188,6 +5307,14 @@ static void handle_cce_err(struct hfi1_devdata *dd, u32 unused, u64 reg) /* then a fix up */ start_freeze_handling(dd->pport, FREEZE_SELF); } + + for (i = 0; i < NUM_CCE_ERR_STATUS_COUNTERS; i++) { + if (reg & (1ull << i)) { + incr_cntr64(&dd->cce_err_status_cnt[i]); + /* maintain a counter over all cce_err_status errors */ + incr_cntr64(&dd->sw_cce_err_status_aggregate); + } + } } /* @@ -2232,6 +5359,7 @@ static void free_rcverr(struct hfi1_devdata *dd) static void handle_rxe_err(struct hfi1_devdata *dd, u32 unused, u64 reg) { char buf[96]; + int i = 0; dd_dev_info(dd, "Receive Error: %s\n", rxe_err_status_string(buf, sizeof(buf), reg)); @@ -2248,36 +5376,58 @@ static void handle_rxe_err(struct hfi1_devdata *dd, u32 unused, u64 reg) start_freeze_handling(dd->pport, flags); } + + for (i = 0; i < NUM_RCV_ERR_STATUS_COUNTERS; i++) { + if (reg & (1ull << i)) + incr_cntr64(&dd->rcv_err_status_cnt[i]); + } } static void handle_misc_err(struct hfi1_devdata *dd, u32 unused, u64 reg) { char buf[96]; + int i = 0; dd_dev_info(dd, "Misc Error: %s", misc_err_status_string(buf, sizeof(buf), reg)); + for (i = 0; i < NUM_MISC_ERR_STATUS_COUNTERS; i++) { + if (reg & (1ull << i)) + incr_cntr64(&dd->misc_err_status_cnt[i]); + } } static void handle_pio_err(struct hfi1_devdata *dd, u32 unused, u64 reg) { char buf[96]; + int i = 0; dd_dev_info(dd, "PIO Error: %s\n", pio_err_status_string(buf, sizeof(buf), reg)); if (reg & ALL_PIO_FREEZE_ERR) start_freeze_handling(dd->pport, 0); + + for (i = 0; i < NUM_SEND_PIO_ERR_STATUS_COUNTERS; i++) { + if (reg & (1ull << i)) + incr_cntr64(&dd->send_pio_err_status_cnt[i]); + } } static void handle_sdma_err(struct hfi1_devdata *dd, u32 unused, u64 reg) { char buf[96]; + int i = 0; dd_dev_info(dd, "SDMA Error: %s\n", sdma_err_status_string(buf, sizeof(buf), reg)); if (reg & ALL_SDMA_FREEZE_ERR) start_freeze_handling(dd->pport, 0); + + for (i = 0; i < NUM_SEND_DMA_ERR_STATUS_COUNTERS; i++) { + if (reg & (1ull << i)) + incr_cntr64(&dd->send_dma_err_status_cnt[i]); + } } static void count_port_inactive(struct hfi1_devdata *dd) @@ -2343,6 +5493,7 @@ static void handle_egress_err(struct hfi1_devdata *dd, u32 unused, u64 reg) { u64 reg_copy = reg, handled = 0; char buf[96]; + int i = 0; if (reg & ALL_TXE_EGRESS_FREEZE_ERR) start_freeze_handling(dd->pport, 0); @@ -2374,15 +5525,25 @@ static void handle_egress_err(struct hfi1_devdata *dd, u32 unused, u64 reg) if (reg) dd_dev_info(dd, "Egress Error: %s\n", egress_err_status_string(buf, sizeof(buf), reg)); + + for (i = 0; i < NUM_SEND_EGRESS_ERR_STATUS_COUNTERS; i++) { + if (reg & (1ull << i)) + incr_cntr64(&dd->send_egress_err_status_cnt[i]); + } } static void handle_txe_err(struct hfi1_devdata *dd, u32 unused, u64 reg) { char buf[96]; + int i = 0; dd_dev_info(dd, "Send Error: %s\n", send_err_status_string(buf, sizeof(buf), reg)); + for (i = 0; i < NUM_SEND_ERR_STATUS_COUNTERS; i++) { + if (reg & (1ull << i)) + incr_cntr64(&dd->send_err_status_cnt[i]); + } } /* @@ -2474,6 +5635,7 @@ static void is_sendctxt_err_int(struct hfi1_devdata *dd, char flags[96]; u64 status; u32 sw_index; + int i = 0; sw_index = dd->hw_to_sw[hw_context]; if (sw_index >= dd->num_send_contexts) { @@ -2507,12 +5669,23 @@ static void is_sendctxt_err_int(struct hfi1_devdata *dd, */ if (sc->type != SC_USER) queue_work(dd->pport->hfi1_wq, &sc->halt_work); + + /* + * Update the counters for the corresponding status bits. + * Note that these particular counters are aggregated over all + * 160 contexts. + */ + for (i = 0; i < NUM_SEND_CTXT_ERR_STATUS_COUNTERS; i++) { + if (status & (1ull << i)) + incr_cntr64(&dd->sw_ctxt_err_status_cnt[i]); + } } static void handle_sdma_eng_err(struct hfi1_devdata *dd, unsigned int source, u64 status) { struct sdma_engine *sde; + int i = 0; sde = &dd->per_sdma[source]; #ifdef CONFIG_SDMA_VERBOSITY @@ -2522,6 +5695,16 @@ static void handle_sdma_eng_err(struct hfi1_devdata *dd, sde->this_idx, source, (unsigned long long)status); #endif sdma_engine_error(sde, status); + + /* + * Update the counters for the corresponding status bits. + * Note that these particular counters are aggregated over + * all 16 DMA engines. + */ + for (i = 0; i < NUM_SEND_DMA_ENG_ERR_STATUS_COUNTERS; i++) { + if (status & (1ull << i)) + incr_cntr64(&dd->sw_send_dma_eng_err_status_cnt[i]); + } } /* diff --git a/drivers/staging/rdma/hfi1/chip.h b/drivers/staging/rdma/hfi1/chip.h index 177862b9230b..ceed637a7634 100644 --- a/drivers/staging/rdma/hfi1/chip.h +++ b/drivers/staging/rdma/hfi1/chip.h @@ -787,6 +787,275 @@ enum { C_SW_PIO_WAIT, C_SW_KMEM_WAIT, C_SW_SEND_SCHED, +/* MISC_ERR_STATUS */ + C_MISC_PLL_LOCK_FAIL_ERR, + C_MISC_MBIST_FAIL_ERR, + C_MISC_INVALID_EEP_CMD_ERR, + C_MISC_EFUSE_DONE_PARITY_ERR, + C_MISC_EFUSE_WRITE_ERR, + C_MISC_EFUSE_READ_BAD_ADDR_ERR, + C_MISC_EFUSE_CSR_PARITY_ERR, + C_MISC_FW_AUTH_FAILED_ERR, + C_MISC_KEY_MISMATCH_ERR, + C_MISC_SBUS_WRITE_FAILED_ERR, + C_MISC_CSR_WRITE_BAD_ADDR_ERR, + C_MISC_CSR_READ_BAD_ADDR_ERR, + C_MISC_CSR_PARITY_ERR, +/* CceErrStatus */ + /* + * A special counter that is the aggregate count + * of all the cce_err_status errors. The remainder + * are actual bits in the CceErrStatus register. + */ + C_CCE_ERR_STATUS_AGGREGATED_CNT, + C_CCE_MSIX_CSR_PARITY_ERR, + C_CCE_INT_MAP_UNC_ERR, + C_CCE_INT_MAP_COR_ERR, + C_CCE_MSIX_TABLE_UNC_ERR, + C_CCE_MSIX_TABLE_COR_ERR, + C_CCE_RXDMA_CONV_FIFO_PARITY_ERR, + C_CCE_RCPL_ASYNC_FIFO_PARITY_ERR, + C_CCE_SEG_WRITE_BAD_ADDR_ERR, + C_CCE_SEG_READ_BAD_ADDR_ERR, + C_LA_TRIGGERED, + C_CCE_TRGT_CPL_TIMEOUT_ERR, + C_PCIC_RECEIVE_PARITY_ERR, + C_PCIC_TRANSMIT_BACK_PARITY_ERR, + C_PCIC_TRANSMIT_FRONT_PARITY_ERR, + C_PCIC_CPL_DAT_Q_UNC_ERR, + C_PCIC_CPL_HD_Q_UNC_ERR, + C_PCIC_POST_DAT_Q_UNC_ERR, + C_PCIC_POST_HD_Q_UNC_ERR, + C_PCIC_RETRY_SOT_MEM_UNC_ERR, + C_PCIC_RETRY_MEM_UNC_ERR, + C_PCIC_N_POST_DAT_Q_PARITY_ERR, + C_PCIC_N_POST_H_Q_PARITY_ERR, + C_PCIC_CPL_DAT_Q_COR_ERR, + C_PCIC_CPL_HD_Q_COR_ERR, + C_PCIC_POST_DAT_Q_COR_ERR, + C_PCIC_POST_HD_Q_COR_ERR, + C_PCIC_RETRY_SOT_MEM_COR_ERR, + C_PCIC_RETRY_MEM_COR_ERR, + C_CCE_CLI1_ASYNC_FIFO_DBG_PARITY_ERR, + C_CCE_CLI1_ASYNC_FIFO_RXDMA_PARITY_ERR, + C_CCE_CLI1_ASYNC_FIFO_SDMA_HD_PARITY_ERR, + C_CCE_CLI1_ASYNC_FIFO_PIO_CRDT_PARITY_ERR, + C_CCE_CLI2_ASYNC_FIFO_PARITY_ERR, + C_CCE_CSR_CFG_BUS_PARITY_ERR, + C_CCE_CLI0_ASYNC_FIFO_PARTIY_ERR, + C_CCE_RSPD_DATA_PARITY_ERR, + C_CCE_TRGT_ACCESS_ERR, + C_CCE_TRGT_ASYNC_FIFO_PARITY_ERR, + C_CCE_CSR_WRITE_BAD_ADDR_ERR, + C_CCE_CSR_READ_BAD_ADDR_ERR, + C_CCE_CSR_PARITY_ERR, +/* RcvErrStatus */ + C_RX_CSR_PARITY_ERR, + C_RX_CSR_WRITE_BAD_ADDR_ERR, + C_RX_CSR_READ_BAD_ADDR_ERR, + C_RX_DMA_CSR_UNC_ERR, + C_RX_DMA_DQ_FSM_ENCODING_ERR, + C_RX_DMA_EQ_FSM_ENCODING_ERR, + C_RX_DMA_CSR_PARITY_ERR, + C_RX_RBUF_DATA_COR_ERR, + C_RX_RBUF_DATA_UNC_ERR, + C_RX_DMA_DATA_FIFO_RD_COR_ERR, + C_RX_DMA_DATA_FIFO_RD_UNC_ERR, + C_RX_DMA_HDR_FIFO_RD_COR_ERR, + C_RX_DMA_HDR_FIFO_RD_UNC_ERR, + C_RX_RBUF_DESC_PART2_COR_ERR, + C_RX_RBUF_DESC_PART2_UNC_ERR, + C_RX_RBUF_DESC_PART1_COR_ERR, + C_RX_RBUF_DESC_PART1_UNC_ERR, + C_RX_HQ_INTR_FSM_ERR, + C_RX_HQ_INTR_CSR_PARITY_ERR, + C_RX_LOOKUP_CSR_PARITY_ERR, + C_RX_LOOKUP_RCV_ARRAY_COR_ERR, + C_RX_LOOKUP_RCV_ARRAY_UNC_ERR, + C_RX_LOOKUP_DES_PART2_PARITY_ERR, + C_RX_LOOKUP_DES_PART1_UNC_COR_ERR, + C_RX_LOOKUP_DES_PART1_UNC_ERR, + C_RX_RBUF_NEXT_FREE_BUF_COR_ERR, + C_RX_RBUF_NEXT_FREE_BUF_UNC_ERR, + C_RX_RBUF_FL_INIT_WR_ADDR_PARITY_ERR, + C_RX_RBUF_FL_INITDONE_PARITY_ERR, + C_RX_RBUF_FL_WRITE_ADDR_PARITY_ERR, + C_RX_RBUF_FL_RD_ADDR_PARITY_ERR, + C_RX_RBUF_EMPTY_ERR, + C_RX_RBUF_FULL_ERR, + C_RX_RBUF_BAD_LOOKUP_ERR, + C_RX_RBUF_CTX_ID_PARITY_ERR, + C_RX_RBUF_CSR_QEOPDW_PARITY_ERR, + C_RX_RBUF_CSR_Q_NUM_OF_PKT_PARITY_ERR, + C_RX_RBUF_CSR_Q_T1_PTR_PARITY_ERR, + C_RX_RBUF_CSR_Q_HD_PTR_PARITY_ERR, + C_RX_RBUF_CSR_Q_VLD_BIT_PARITY_ERR, + C_RX_RBUF_CSR_Q_NEXT_BUF_PARITY_ERR, + C_RX_RBUF_CSR_Q_ENT_CNT_PARITY_ERR, + C_RX_RBUF_CSR_Q_HEAD_BUF_NUM_PARITY_ERR, + C_RX_RBUF_BLOCK_LIST_READ_COR_ERR, + C_RX_RBUF_BLOCK_LIST_READ_UNC_ERR, + C_RX_RBUF_LOOKUP_DES_COR_ERR, + C_RX_RBUF_LOOKUP_DES_UNC_ERR, + C_RX_RBUF_LOOKUP_DES_REG_UNC_COR_ERR, + C_RX_RBUF_LOOKUP_DES_REG_UNC_ERR, + C_RX_RBUF_FREE_LIST_COR_ERR, + C_RX_RBUF_FREE_LIST_UNC_ERR, + C_RX_RCV_FSM_ENCODING_ERR, + C_RX_DMA_FLAG_COR_ERR, + C_RX_DMA_FLAG_UNC_ERR, + C_RX_DC_SOP_EOP_PARITY_ERR, + C_RX_RCV_CSR_PARITY_ERR, + C_RX_RCV_QP_MAP_TABLE_COR_ERR, + C_RX_RCV_QP_MAP_TABLE_UNC_ERR, + C_RX_RCV_DATA_COR_ERR, + C_RX_RCV_DATA_UNC_ERR, + C_RX_RCV_HDR_COR_ERR, + C_RX_RCV_HDR_UNC_ERR, + C_RX_DC_INTF_PARITY_ERR, + C_RX_DMA_CSR_COR_ERR, +/* SendPioErrStatus */ + C_PIO_PEC_SOP_HEAD_PARITY_ERR, + C_PIO_PCC_SOP_HEAD_PARITY_ERR, + C_PIO_LAST_RETURNED_CNT_PARITY_ERR, + C_PIO_CURRENT_FREE_CNT_PARITY_ERR, + C_PIO_RSVD_31_ERR, + C_PIO_RSVD_30_ERR, + C_PIO_PPMC_SOP_LEN_ERR, + C_PIO_PPMC_BQC_MEM_PARITY_ERR, + C_PIO_VL_FIFO_PARITY_ERR, + C_PIO_VLF_SOP_PARITY_ERR, + C_PIO_VLF_V1_LEN_PARITY_ERR, + C_PIO_BLOCK_QW_COUNT_PARITY_ERR, + C_PIO_WRITE_QW_VALID_PARITY_ERR, + C_PIO_STATE_MACHINE_ERR, + C_PIO_WRITE_DATA_PARITY_ERR, + C_PIO_HOST_ADDR_MEM_COR_ERR, + C_PIO_HOST_ADDR_MEM_UNC_ERR, + C_PIO_PKT_EVICT_SM_OR_ARM_SM_ERR, + C_PIO_INIT_SM_IN_ERR, + C_PIO_PPMC_PBL_FIFO_ERR, + C_PIO_CREDIT_RET_FIFO_PARITY_ERR, + C_PIO_V1_LEN_MEM_BANK1_COR_ERR, + C_PIO_V1_LEN_MEM_BANK0_COR_ERR, + C_PIO_V1_LEN_MEM_BANK1_UNC_ERR, + C_PIO_V1_LEN_MEM_BANK0_UNC_ERR, + C_PIO_SM_PKT_RESET_PARITY_ERR, + C_PIO_PKT_EVICT_FIFO_PARITY_ERR, + C_PIO_SBRDCTRL_CRREL_FIFO_PARITY_ERR, + C_PIO_SBRDCTL_CRREL_PARITY_ERR, + C_PIO_PEC_FIFO_PARITY_ERR, + C_PIO_PCC_FIFO_PARITY_ERR, + C_PIO_SB_MEM_FIFO1_ERR, + C_PIO_SB_MEM_FIFO0_ERR, + C_PIO_CSR_PARITY_ERR, + C_PIO_WRITE_ADDR_PARITY_ERR, + C_PIO_WRITE_BAD_CTXT_ERR, +/* SendDmaErrStatus */ + C_SDMA_PCIE_REQ_TRACKING_COR_ERR, + C_SDMA_PCIE_REQ_TRACKING_UNC_ERR, + C_SDMA_CSR_PARITY_ERR, + C_SDMA_RPY_TAG_ERR, +/* SendEgressErrStatus */ + C_TX_READ_PIO_MEMORY_CSR_UNC_ERR, + C_TX_READ_SDMA_MEMORY_CSR_UNC_ERR, + C_TX_EGRESS_FIFO_COR_ERR, + C_TX_READ_PIO_MEMORY_COR_ERR, + C_TX_READ_SDMA_MEMORY_COR_ERR, + C_TX_SB_HDR_COR_ERR, + C_TX_CREDIT_OVERRUN_ERR, + C_TX_LAUNCH_FIFO8_COR_ERR, + C_TX_LAUNCH_FIFO7_COR_ERR, + C_TX_LAUNCH_FIFO6_COR_ERR, + C_TX_LAUNCH_FIFO5_COR_ERR, + C_TX_LAUNCH_FIFO4_COR_ERR, + C_TX_LAUNCH_FIFO3_COR_ERR, + C_TX_LAUNCH_FIFO2_COR_ERR, + C_TX_LAUNCH_FIFO1_COR_ERR, + C_TX_LAUNCH_FIFO0_COR_ERR, + C_TX_CREDIT_RETURN_VL_ERR, + C_TX_HCRC_INSERTION_ERR, + C_TX_EGRESS_FIFI_UNC_ERR, + C_TX_READ_PIO_MEMORY_UNC_ERR, + C_TX_READ_SDMA_MEMORY_UNC_ERR, + C_TX_SB_HDR_UNC_ERR, + C_TX_CREDIT_RETURN_PARITY_ERR, + C_TX_LAUNCH_FIFO8_UNC_OR_PARITY_ERR, + C_TX_LAUNCH_FIFO7_UNC_OR_PARITY_ERR, + C_TX_LAUNCH_FIFO6_UNC_OR_PARITY_ERR, + C_TX_LAUNCH_FIFO5_UNC_OR_PARITY_ERR, + C_TX_LAUNCH_FIFO4_UNC_OR_PARITY_ERR, + C_TX_LAUNCH_FIFO3_UNC_OR_PARITY_ERR, + C_TX_LAUNCH_FIFO2_UNC_OR_PARITY_ERR, + C_TX_LAUNCH_FIFO1_UNC_OR_PARITY_ERR, + C_TX_LAUNCH_FIFO0_UNC_OR_PARITY_ERR, + C_TX_SDMA15_DISALLOWED_PACKET_ERR, + C_TX_SDMA14_DISALLOWED_PACKET_ERR, + C_TX_SDMA13_DISALLOWED_PACKET_ERR, + C_TX_SDMA12_DISALLOWED_PACKET_ERR, + C_TX_SDMA11_DISALLOWED_PACKET_ERR, + C_TX_SDMA10_DISALLOWED_PACKET_ERR, + C_TX_SDMA9_DISALLOWED_PACKET_ERR, + C_TX_SDMA8_DISALLOWED_PACKET_ERR, + C_TX_SDMA7_DISALLOWED_PACKET_ERR, + C_TX_SDMA6_DISALLOWED_PACKET_ERR, + C_TX_SDMA5_DISALLOWED_PACKET_ERR, + C_TX_SDMA4_DISALLOWED_PACKET_ERR, + C_TX_SDMA3_DISALLOWED_PACKET_ERR, + C_TX_SDMA2_DISALLOWED_PACKET_ERR, + C_TX_SDMA1_DISALLOWED_PACKET_ERR, + C_TX_SDMA0_DISALLOWED_PACKET_ERR, + C_TX_CONFIG_PARITY_ERR, + C_TX_SBRD_CTL_CSR_PARITY_ERR, + C_TX_LAUNCH_CSR_PARITY_ERR, + C_TX_ILLEGAL_CL_ERR, + C_TX_SBRD_CTL_STATE_MACHINE_PARITY_ERR, + C_TX_RESERVED_10, + C_TX_RESERVED_9, + C_TX_SDMA_LAUNCH_INTF_PARITY_ERR, + C_TX_PIO_LAUNCH_INTF_PARITY_ERR, + C_TX_RESERVED_6, + C_TX_INCORRECT_LINK_STATE_ERR, + C_TX_LINK_DOWN_ERR, + C_TX_EGRESS_FIFO_UNDERRUN_OR_PARITY_ERR, + C_TX_RESERVED_2, + C_TX_PKT_INTEGRITY_MEM_UNC_ERR, + C_TX_PKT_INTEGRITY_MEM_COR_ERR, +/* SendErrStatus */ + C_SEND_CSR_WRITE_BAD_ADDR_ERR, + C_SEND_CSR_READ_BAD_ADD_ERR, + C_SEND_CSR_PARITY_ERR, +/* SendCtxtErrStatus */ + C_PIO_WRITE_OUT_OF_BOUNDS_ERR, + C_PIO_WRITE_OVERFLOW_ERR, + C_PIO_WRITE_CROSSES_BOUNDARY_ERR, + C_PIO_DISALLOWED_PACKET_ERR, + C_PIO_INCONSISTENT_SOP_ERR, +/*SendDmaEngErrStatus */ + C_SDMA_HEADER_REQUEST_FIFO_COR_ERR, + C_SDMA_HEADER_STORAGE_COR_ERR, + C_SDMA_PACKET_TRACKING_COR_ERR, + C_SDMA_ASSEMBLY_COR_ERR, + C_SDMA_DESC_TABLE_COR_ERR, + C_SDMA_HEADER_REQUEST_FIFO_UNC_ERR, + C_SDMA_HEADER_STORAGE_UNC_ERR, + C_SDMA_PACKET_TRACKING_UNC_ERR, + C_SDMA_ASSEMBLY_UNC_ERR, + C_SDMA_DESC_TABLE_UNC_ERR, + C_SDMA_TIMEOUT_ERR, + C_SDMA_HEADER_LENGTH_ERR, + C_SDMA_HEADER_ADDRESS_ERR, + C_SDMA_HEADER_SELECT_ERR, + C_SMDA_RESERVED_9, + C_SDMA_PACKET_DESC_OVERFLOW_ERR, + C_SDMA_LENGTH_MISMATCH_ERR, + C_SDMA_HALT_ERR, + C_SDMA_MEM_READ_ERR, + C_SDMA_FIRST_DESC_ERR, + C_SDMA_TAIL_OUT_OF_BOUNDS_ERR, + C_SDMA_TOO_LONG_ERR, + C_SDMA_GEN_MISMATCH_ERR, + C_SDMA_WRONG_DW_ERR, DEV_CNTR_LAST /* Must be kept last */ }; diff --git a/drivers/staging/rdma/hfi1/hfi.h b/drivers/staging/rdma/hfi1/hfi.h index 98db0fe4d0f0..9ee3951af128 100644 --- a/drivers/staging/rdma/hfi1/hfi.h +++ b/drivers/staging/rdma/hfi1/hfi.h @@ -105,6 +105,20 @@ extern unsigned long hfi1_cap_mask; */ #define HFI1_CTRL_CTXT 0 +/* + * Driver context will store software counters for each of the events + * associated with these status registers + */ +#define NUM_CCE_ERR_STATUS_COUNTERS 41 +#define NUM_RCV_ERR_STATUS_COUNTERS 64 +#define NUM_MISC_ERR_STATUS_COUNTERS 13 +#define NUM_SEND_PIO_ERR_STATUS_COUNTERS 36 +#define NUM_SEND_DMA_ERR_STATUS_COUNTERS 4 +#define NUM_SEND_EGRESS_ERR_STATUS_COUNTERS 64 +#define NUM_SEND_ERR_STATUS_COUNTERS 3 +#define NUM_SEND_CTXT_ERR_STATUS_COUNTERS 5 +#define NUM_SEND_DMA_ENG_ERR_STATUS_COUNTERS 24 + /* * per driver stats, either not device nor port-specific, or * summed over all of the devices and ports. @@ -1046,6 +1060,26 @@ struct hfi1_devdata { atomic_t drop_packet; u8 do_drop; + /* + * Software counters for the status bits defined by the + * associated error status registers + */ + u64 cce_err_status_cnt[NUM_CCE_ERR_STATUS_COUNTERS]; + u64 rcv_err_status_cnt[NUM_RCV_ERR_STATUS_COUNTERS]; + u64 misc_err_status_cnt[NUM_MISC_ERR_STATUS_COUNTERS]; + u64 send_pio_err_status_cnt[NUM_SEND_PIO_ERR_STATUS_COUNTERS]; + u64 send_dma_err_status_cnt[NUM_SEND_DMA_ERR_STATUS_COUNTERS]; + u64 send_egress_err_status_cnt[NUM_SEND_EGRESS_ERR_STATUS_COUNTERS]; + u64 send_err_status_cnt[NUM_SEND_ERR_STATUS_COUNTERS]; + + /* Software counter that spans all contexts */ + u64 sw_ctxt_err_status_cnt[NUM_SEND_CTXT_ERR_STATUS_COUNTERS]; + /* Software counter that spans all DMA engines */ + u64 sw_send_dma_eng_err_status_cnt[ + NUM_SEND_DMA_ENG_ERR_STATUS_COUNTERS]; + /* Software counter that aggregates all cce_err_status errors */ + u64 sw_cce_err_status_aggregate; + /* receive interrupt functions */ rhf_rcv_function_ptr *rhf_rcv_function_map; rhf_rcv_function_ptr normal_rhf_rcv_functions[8]; From e8597eb01456f11f978f316c41ea54c935eb2f50 Mon Sep 17 00:00:00 2001 From: Harish Chegondi Date: Tue, 1 Dec 2015 15:38:20 -0500 Subject: [PATCH 707/843] staging/rdma/hfi1: Destroy workqueues if hfi1_register_ib_device() call returns error Currently, if hfi1_register_ib_device() call is unsuccessful, workqueues are not being destroyed before bailing out. This patch fixes this issue. Reviewed-by: Dennis Dalessandro Signed-off-by: Harish Chegondi Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/init.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rdma/hfi1/init.c b/drivers/staging/rdma/hfi1/init.c index 52fa86f47186..2d52f91c03dc 100644 --- a/drivers/staging/rdma/hfi1/init.c +++ b/drivers/staging/rdma/hfi1/init.c @@ -1336,6 +1336,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) { int ret = 0, j, pidx, initfail; struct hfi1_devdata *dd = NULL; + struct hfi1_pportdata *ppd; /* First, lock the non-writable module parameters */ HFI1_CAP_LOCK(); @@ -1431,8 +1432,14 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) if (initfail || ret) { stop_timers(dd); flush_workqueue(ib_wq); - for (pidx = 0; pidx < dd->num_pports; ++pidx) + for (pidx = 0; pidx < dd->num_pports; ++pidx) { hfi1_quiet_serdes(dd->pport + pidx); + ppd = dd->pport + pidx; + if (ppd->hfi1_wq) { + destroy_workqueue(ppd->hfi1_wq); + ppd->hfi1_wq = NULL; + } + } if (!j) hfi1_device_remove(dd); if (!ret) From 8764522e5251b76666aa39e207069c43f742801d Mon Sep 17 00:00:00 2001 From: Dean Luick Date: Tue, 1 Dec 2015 15:38:21 -0500 Subject: [PATCH 708/843] staging/rdma/hfi1: Unexpected link up pkey values are not an error Only warn when link up pkeys are not what we expect. Also, allow for the pkey to already be initialized. Reviewed-by: Arthur Kepner Signed-off-by: Dean Luick Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/chip.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index 3cf6fea0bf35..e201c80c7644 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -6716,10 +6716,10 @@ static void add_full_mgmt_pkey(struct hfi1_pportdata *ppd) { struct hfi1_devdata *dd = ppd->dd; - /* Sanity check - ppd->pkeys[2] should be 0 */ - if (ppd->pkeys[2] != 0) - dd_dev_err(dd, "%s pkey[2] already set to 0x%x, resetting it to 0x%x\n", - __func__, ppd->pkeys[2], FULL_MGMT_P_KEY); + /* Sanity check - ppd->pkeys[2] should be 0, or already initalized */ + if (!((ppd->pkeys[2] == 0) || (ppd->pkeys[2] == FULL_MGMT_P_KEY))) + dd_dev_warn(dd, "%s pkey[2] already set to 0x%x, resetting it to 0x%x\n", + __func__, ppd->pkeys[2], FULL_MGMT_P_KEY); ppd->pkeys[2] = FULL_MGMT_P_KEY; (void)hfi1_set_ib_cfg(ppd, HFI1_IB_CFG_PKEYS, 0); } From 56af5543f8cf078da18a0912b8fa04baf724b210 Mon Sep 17 00:00:00 2001 From: Dean Luick Date: Tue, 1 Dec 2015 15:38:22 -0500 Subject: [PATCH 709/843] staging/rdma/hfi1: remove SPC freeze error messages An SPC freeze is not an error. Remove the messages. Reviewed-by: Dennis Dalessandro Signed-off-by: Dean Luick Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/chip.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index e201c80c7644..719e3f1e4499 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -6487,7 +6487,6 @@ void handle_freeze(struct work_struct *work) struct hfi1_devdata *dd = ppd->dd; /* wait for freeze indicators on all affected blocks */ - dd_dev_info(dd, "Entering SPC freeze\n"); wait_for_freeze_status(dd, 1); /* SPC is now frozen */ @@ -6545,7 +6544,6 @@ void handle_freeze(struct work_struct *work) wake_up(&dd->event_queue); /* no longer frozen */ - dd_dev_err(dd, "Exiting SPC freeze\n"); } /* From 6d0145308252ebcc1d373e6c3acd8f1ce7fec377 Mon Sep 17 00:00:00 2001 From: Dean Luick Date: Tue, 1 Dec 2015 15:38:23 -0500 Subject: [PATCH 710/843] staging/rdma/hfi1: unknown frame messages are not errors Change reported unknown frame messages into a counter. These are informational, no errors. Reviewed-by: Dennis Dalessandro Signed-off-by: Dean Luick Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/chip.c | 18 ++++++++++++++++++ drivers/staging/rdma/hfi1/chip.h | 1 + drivers/staging/rdma/hfi1/hfi.h | 2 ++ 3 files changed, 21 insertions(+) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index 719e3f1e4499..cb73243c497a 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -1418,6 +1418,17 @@ static u64 access_sw_link_up_cnt(const struct cntr_entry *entry, void *context, return read_write_sw(ppd->dd, &ppd->link_up, mode, data); } +static u64 access_sw_unknown_frame_cnt(const struct cntr_entry *entry, + void *context, int vl, int mode, + u64 data) +{ + struct hfi1_pportdata *ppd = (struct hfi1_pportdata *)context; + + if (vl != CNTR_INVALID_VL) + return 0; + return read_write_sw(ppd->dd, &ppd->unknown_frame_count, mode, data); +} + static u64 access_sw_xmit_discards(const struct cntr_entry *entry, void *context, int vl, int mode, u64 data) { @@ -4879,6 +4890,8 @@ static struct cntr_entry port_cntrs[PORT_CNTR_LAST] = { access_sw_link_dn_cnt), [C_SW_LINK_UP] = CNTR_ELEM("SwLinkUp", 0, 0, CNTR_SYNTH | CNTR_32BIT, access_sw_link_up_cnt), +[C_SW_UNKNOWN_FRAME] = CNTR_ELEM("UnknownFrame", 0, 0, CNTR_NORMAL, + access_sw_unknown_frame_cnt), [C_SW_XMIT_DSCD] = CNTR_ELEM("XmitDscd", 0, 0, CNTR_SYNTH | CNTR_32BIT, access_sw_xmit_discards), [C_SW_XMIT_DSCD_VL] = CNTR_ELEM("XmitDscdVl", 0, 0, @@ -7235,6 +7248,11 @@ static void handle_8051_interrupt(struct hfi1_devdata *dd, u32 unused, u64 reg) } err &= ~(u64)FAILED_LNI; } + /* unknown frames can happen durning LNI, just count */ + if (err & UNKNOWN_FRAME) { + ppd->unknown_frame_count++; + err &= ~(u64)UNKNOWN_FRAME; + } if (err) { /* report remaining errors, but do not do anything */ dd_dev_err(dd, "8051 info error: %s\n", diff --git a/drivers/staging/rdma/hfi1/chip.h b/drivers/staging/rdma/hfi1/chip.h index ceed637a7634..5b375ddc345d 100644 --- a/drivers/staging/rdma/hfi1/chip.h +++ b/drivers/staging/rdma/hfi1/chip.h @@ -1078,6 +1078,7 @@ enum { C_RX_WORDS, C_SW_LINK_DOWN, C_SW_LINK_UP, + C_SW_UNKNOWN_FRAME, C_SW_XMIT_DSCD, C_SW_XMIT_DSCD_VL, C_SW_XMIT_CSTR_ERR, diff --git a/drivers/staging/rdma/hfi1/hfi.h b/drivers/staging/rdma/hfi1/hfi.h index 9ee3951af128..7f8cafa841b5 100644 --- a/drivers/staging/rdma/hfi1/hfi.h +++ b/drivers/staging/rdma/hfi1/hfi.h @@ -713,6 +713,8 @@ struct hfi1_pportdata { u64 link_downed; /* number of times link retrained successfully */ u64 link_up; + /* number of times a link unknown frame was reported */ + u64 unknown_frame_count; /* port_ltp_crc_mode is returned in 'portinfo' MADs */ u16 port_ltp_crc_mode; /* port_crc_mode_enabled is the crc we support */ From 6cc6ad2eb886e8cb47e8b15e9d4132fe8275021f Mon Sep 17 00:00:00 2001 From: Harish Chegondi Date: Tue, 1 Dec 2015 15:38:24 -0500 Subject: [PATCH 711/843] staging/rdma/hfi1: Consider VL15 MTU also when calculating the maximum VL MTU Currently, only MTUs of VLs 0-7 are checked when calculating the maximum VL MTU which is used to set the port MTU capability in DCC_CFG_PORT_CONFIG CSR This can cause a port MTU capability to be set to 0 if MTUs of VLs 0-7 is 0 This would affect the VL15 traffic. Reviewed-by: Dean Luick Reviewed-by: Arthur Kepner Signed-off-by: Harish Chegondi Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/chip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index cb73243c497a..d88945a80250 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -9407,7 +9407,8 @@ u32 lrh_max_header_bytes(struct hfi1_devdata *dd) static void set_send_length(struct hfi1_pportdata *ppd) { struct hfi1_devdata *dd = ppd->dd; - u32 max_hb = lrh_max_header_bytes(dd), maxvlmtu = 0, dcmtu; + u32 max_hb = lrh_max_header_bytes(dd), dcmtu; + u32 maxvlmtu = dd->vld[15].mtu; u64 len1 = 0, len2 = (((dd->vld[15].mtu + max_hb) >> 2) & SEND_LEN_CHECK1_LEN_VL15_MASK) << SEND_LEN_CHECK1_LEN_VL15_SHIFT; From f0852922507c386257891e694315a56c2ba09224 Mon Sep 17 00:00:00 2001 From: Andrea Lowe Date: Tue, 1 Dec 2015 15:38:26 -0500 Subject: [PATCH 712/843] staging/rdma/hfi1: Adding counter resolutions for DataPortCounters Changing the 32-bit reserved field in opa_port_data_counters_msg to the new 'resolution' field. PMA will use resolutions to right- shift values for LocalLinkIntegrity and LinkErrorRecovery when computing the ErrorCounterSummary for a DataPortCounters request. Reviewed-by: Mike Marciniszyn Signed-off-by: Andrea Lowe Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/mad.c | 38 ++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/drivers/staging/rdma/hfi1/mad.c b/drivers/staging/rdma/hfi1/mad.c index 4bc003f036c0..a785664371d0 100644 --- a/drivers/staging/rdma/hfi1/mad.c +++ b/drivers/staging/rdma/hfi1/mad.c @@ -2076,13 +2076,20 @@ struct opa_aggregate { u8 data[0]; }; -/* Request contains first two fields, response contains those plus the rest */ +#define MSK_LLI 0x000000f0 +#define MSK_LLI_SFT 4 +#define MSK_LER 0x0000000f +#define MSK_LER_SFT 0 +#define ADD_LLI 8 +#define ADD_LER 2 + +/* Request contains first three fields, response contains those plus the rest */ struct opa_port_data_counters_msg { __be64 port_select_mask[4]; __be32 vl_select_mask; + __be32 resolution; /* Response fields follow */ - __be32 reserved1; struct _port_dctrs { u8 port_number; u8 reserved2[3]; @@ -2443,7 +2450,8 @@ static int pma_get_opa_portstatus(struct opa_pma_mad *pmp, return reply((struct ib_mad_hdr *)pmp); } -static u64 get_error_counter_summary(struct ib_device *ibdev, u8 port) +static u64 get_error_counter_summary(struct ib_device *ibdev, u8 port, + u8 res_lli, u8 res_ler) { struct hfi1_devdata *dd = dd_from_ibdev(ibdev); struct hfi1_ibport *ibp = to_iport(ibdev, port); @@ -2459,14 +2467,14 @@ static u64 get_error_counter_summary(struct ib_device *ibdev, u8 port) CNTR_INVALID_VL); error_counter_summary += read_dev_cntr(dd, C_DC_RMT_PHY_ERR, CNTR_INVALID_VL); - error_counter_summary += read_dev_cntr(dd, C_DC_TX_REPLAY, - CNTR_INVALID_VL); - error_counter_summary += read_dev_cntr(dd, C_DC_RX_REPLAY, - CNTR_INVALID_VL); - error_counter_summary += read_dev_cntr(dd, C_DC_SEQ_CRC_CNT, - CNTR_INVALID_VL); - error_counter_summary += read_dev_cntr(dd, C_DC_REINIT_FROM_PEER_CNT, - CNTR_INVALID_VL); + /* local link integrity must be right-shifted by the lli resolution */ + tmp = read_dev_cntr(dd, C_DC_RX_REPLAY, CNTR_INVALID_VL); + tmp += read_dev_cntr(dd, C_DC_TX_REPLAY, CNTR_INVALID_VL); + error_counter_summary += (tmp >> res_lli); + /* link error recovery must b right-shifted by the ler resolution */ + tmp = read_dev_cntr(dd, C_DC_SEQ_CRC_CNT, CNTR_INVALID_VL); + tmp += read_dev_cntr(dd, C_DC_REINIT_FROM_PEER_CNT, CNTR_INVALID_VL); + error_counter_summary += (tmp >> res_ler); error_counter_summary += read_dev_cntr(dd, C_DC_RCV_ERR, CNTR_INVALID_VL); error_counter_summary += read_dev_cntr(dd, C_RCV_OVF, CNTR_INVALID_VL); @@ -2520,6 +2528,7 @@ static int pma_get_opa_datacounters(struct opa_pma_mad *pmp, u32 num_ports; u8 num_pslm; u8 lq, num_vls; + u8 res_lli, res_ler; u64 port_mask; unsigned long port_num; unsigned long vl; @@ -2530,6 +2539,10 @@ static int pma_get_opa_datacounters(struct opa_pma_mad *pmp, num_pslm = hweight64(be64_to_cpu(req->port_select_mask[3])); num_vls = hweight32(be32_to_cpu(req->vl_select_mask)); vl_select_mask = be32_to_cpu(req->vl_select_mask); + res_lli = (u8)(be32_to_cpu(req->resolution) & MSK_LLI) >> MSK_LLI_SFT; + res_lli = res_lli ? res_lli + ADD_LLI : 0; + res_ler = (u8)(be32_to_cpu(req->resolution) & MSK_LER) >> MSK_LER_SFT; + res_ler = res_ler ? res_ler + ADD_LER : 0; if (num_ports != 1 || (vl_select_mask & ~VL_MASK_ALL)) { pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; @@ -2598,7 +2611,8 @@ static int pma_get_opa_datacounters(struct opa_pma_mad *pmp, cpu_to_be64(read_dev_cntr(dd, C_DC_RCV_BCN, CNTR_INVALID_VL)); rsp->port_error_counter_summary = - cpu_to_be64(get_error_counter_summary(ibdev, port)); + cpu_to_be64(get_error_counter_summary(ibdev, port, + res_lli, res_ler)); vlinfo = &(rsp->vls[0]); vfi = 0; From 799d904bf84c23531cf85c1a505aaed0e264babe Mon Sep 17 00:00:00 2001 From: Ira Weiny Date: Wed, 2 Dec 2015 00:43:26 -0500 Subject: [PATCH 713/843] staging/rdma/hfi1: diag.c use BIT macros Use BIT macros rather than shifts. Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/diag.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rdma/hfi1/diag.c b/drivers/staging/rdma/hfi1/diag.c index e4cd333bba83..3e08165104ba 100644 --- a/drivers/staging/rdma/hfi1/diag.c +++ b/drivers/staging/rdma/hfi1/diag.c @@ -78,8 +78,8 @@ hfi1_cdbg(SNOOP, fmt, ##__VA_ARGS__) /* Snoop option mask */ -#define SNOOP_DROP_SEND (1 << 0) -#define SNOOP_USE_METADATA (1 << 1) +#define SNOOP_DROP_SEND BIT(0) +#define SNOOP_USE_METADATA BIT(1) static u8 snoop_flags; From cce6bd86cbef8f0c2e5e24aaf31858f309d32a3f Mon Sep 17 00:00:00 2001 From: Ira Weiny Date: Wed, 2 Dec 2015 00:43:27 -0500 Subject: [PATCH 714/843] staging/rdma/hfi1: diag.c fix alignment Fix line alignment in various places as caught by checkpatch --strict. Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/diag.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rdma/hfi1/diag.c b/drivers/staging/rdma/hfi1/diag.c index 3e08165104ba..06c5cc649ff1 100644 --- a/drivers/staging/rdma/hfi1/diag.c +++ b/drivers/staging/rdma/hfi1/diag.c @@ -135,7 +135,7 @@ static struct cdev diagpkt_cdev; static struct device *diagpkt_device; static ssize_t diagpkt_write(struct file *fp, const char __user *data, - size_t count, loff_t *off); + size_t count, loff_t *off); static const struct file_operations diagpkt_file_ops = { .owner = THIS_MODULE, @@ -202,12 +202,12 @@ struct hfi1_link_info { static int hfi1_snoop_open(struct inode *in, struct file *fp); static ssize_t hfi1_snoop_read(struct file *fp, char __user *data, - size_t pkt_len, loff_t *off); + size_t pkt_len, loff_t *off); static ssize_t hfi1_snoop_write(struct file *fp, const char __user *data, - size_t count, loff_t *off); + size_t count, loff_t *off); static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg); static unsigned int hfi1_snoop_poll(struct file *fp, - struct poll_table_struct *wait); + struct poll_table_struct *wait); static int hfi1_snoop_release(struct inode *in, struct file *fp); struct hfi1_packet_filter_command { @@ -394,7 +394,7 @@ static ssize_t diagpkt_send(struct diag_pkt *dp) if (dp->version != _DIAG_PKT_VERS) { dd_dev_err(dd, "Invalid version %u for diagpkt_write\n", - dp->version); + dp->version); ret = -EINVAL; goto bail; } @@ -553,7 +553,7 @@ bail: } static ssize_t diagpkt_write(struct file *fp, const char __user *data, - size_t count, loff_t *off) + size_t count, loff_t *off) { struct hfi1_devdata *dd; struct send_context *sc; @@ -606,7 +606,7 @@ static int hfi1_snoop_add(struct hfi1_devdata *dd, const char *name) if (ret) { dd_dev_err(dd, "Couldn't create %s device: %d", name, ret); hfi1_cdev_cleanup(&dd->hfi1_snoop.cdev, - &dd->hfi1_snoop.class_dev); + &dd->hfi1_snoop.class_dev); } return ret; @@ -954,7 +954,7 @@ static ssize_t hfi1_snoop_read(struct file *fp, char __user *data, spin_unlock_irqrestore(&dd->hfi1_snoop.snoop_lock, flags); if (pkt_len >= packet->total_len) { if (copy_to_user(data, packet->data, - packet->total_len)) + packet->total_len)) ret = -EFAULT; else ret = packet->total_len; From f398ab17b2d702620431ad71bc05265e936cc9f1 Mon Sep 17 00:00:00 2001 From: Ira Weiny Date: Wed, 2 Dec 2015 00:43:28 -0500 Subject: [PATCH 715/843] staging/rdma/hfi1: diag.c fix logical continuations Place logical operators at the end of the previous line when using a multi-line statement. Found by checkpatch --strict Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/diag.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rdma/hfi1/diag.c b/drivers/staging/rdma/hfi1/diag.c index 06c5cc649ff1..94368403e3ef 100644 --- a/drivers/staging/rdma/hfi1/diag.c +++ b/drivers/staging/rdma/hfi1/diag.c @@ -538,9 +538,9 @@ retry: * NOTE: PRC_FILL_ERR is at best informational and cannot * be depended on. */ - if (!ret && (((wait->code & PRC_STATUS_ERR) - || (wait->code & PRC_FILL_ERR) - || (wait->code & PRC_SC_DISABLE)))) + if (!ret && (((wait->code & PRC_STATUS_ERR) || + (wait->code & PRC_FILL_ERR) || + (wait->code & PRC_SC_DISABLE)))) ret = -EIO; put_diagpkt_wait(wait); /* finished with the structure */ From be98b87ff7d197dfc2e6cf4fea685f682f5d1cc7 Mon Sep 17 00:00:00 2001 From: Ira Weiny Date: Wed, 2 Dec 2015 00:43:29 -0500 Subject: [PATCH 716/843] staging/rdma/hfi1: diag.c fix white space errors Add or remove whitespace according to checkpatch --strict Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/diag.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/drivers/staging/rdma/hfi1/diag.c b/drivers/staging/rdma/hfi1/diag.c index 94368403e3ef..a9dc5e9cbc38 100644 --- a/drivers/staging/rdma/hfi1/diag.c +++ b/drivers/staging/rdma/hfi1/diag.c @@ -177,27 +177,27 @@ struct hfi1_link_info { #define HFI1_SNOOP_IOCGETLINKSTATE \ _IO(HFI1_SNOOP_IOC_MAGIC, HFI1_SNOOP_IOC_BASE_SEQ) #define HFI1_SNOOP_IOCSETLINKSTATE \ - _IO(HFI1_SNOOP_IOC_MAGIC, HFI1_SNOOP_IOC_BASE_SEQ+1) + _IO(HFI1_SNOOP_IOC_MAGIC, HFI1_SNOOP_IOC_BASE_SEQ + 1) #define HFI1_SNOOP_IOCCLEARQUEUE \ - _IO(HFI1_SNOOP_IOC_MAGIC, HFI1_SNOOP_IOC_BASE_SEQ+2) + _IO(HFI1_SNOOP_IOC_MAGIC, HFI1_SNOOP_IOC_BASE_SEQ + 2) #define HFI1_SNOOP_IOCCLEARFILTER \ - _IO(HFI1_SNOOP_IOC_MAGIC, HFI1_SNOOP_IOC_BASE_SEQ+3) + _IO(HFI1_SNOOP_IOC_MAGIC, HFI1_SNOOP_IOC_BASE_SEQ + 3) #define HFI1_SNOOP_IOCSETFILTER \ - _IO(HFI1_SNOOP_IOC_MAGIC, HFI1_SNOOP_IOC_BASE_SEQ+4) + _IO(HFI1_SNOOP_IOC_MAGIC, HFI1_SNOOP_IOC_BASE_SEQ + 4) #define HFI1_SNOOP_IOCGETVERSION \ - _IO(HFI1_SNOOP_IOC_MAGIC, HFI1_SNOOP_IOC_BASE_SEQ+5) + _IO(HFI1_SNOOP_IOC_MAGIC, HFI1_SNOOP_IOC_BASE_SEQ + 5) #define HFI1_SNOOP_IOCSET_OPTS \ - _IO(HFI1_SNOOP_IOC_MAGIC, HFI1_SNOOP_IOC_BASE_SEQ+6) + _IO(HFI1_SNOOP_IOC_MAGIC, HFI1_SNOOP_IOC_BASE_SEQ + 6) /* * These offsets +6/+7 could change, but these are already known and used * IOCTL numbers so don't change them without a good reason. */ #define HFI1_SNOOP_IOCGETLINKSTATE_EXTRA \ - _IOWR(HFI1_SNOOP_IOC_MAGIC, HFI1_SNOOP_IOC_BASE_SEQ+6, \ + _IOWR(HFI1_SNOOP_IOC_MAGIC, HFI1_SNOOP_IOC_BASE_SEQ + 6, \ struct hfi1_link_info) #define HFI1_SNOOP_IOCSETLINKSTATE_EXTRA \ - _IOWR(HFI1_SNOOP_IOC_MAGIC, HFI1_SNOOP_IOC_BASE_SEQ+7, \ + _IOWR(HFI1_SNOOP_IOC_MAGIC, HFI1_SNOOP_IOC_BASE_SEQ + 7, \ struct hfi1_link_info) static int hfi1_snoop_open(struct inode *in, struct file *fp); @@ -323,14 +323,12 @@ static void hfi1_snoop_remove(struct hfi1_devdata *dd) void hfi1_diag_remove(struct hfi1_devdata *dd) { - hfi1_snoop_remove(dd); if (atomic_dec_and_test(&diagpkt_count)) hfi1_cdev_cleanup(&diagpkt_cdev, &diagpkt_device); hfi1_cdev_cleanup(&dd->diag_cdev, &dd->diag_device); } - /* * Allocated structure shared between the credit return mechanism and * diagpkt_send(). @@ -441,7 +439,7 @@ static ssize_t diagpkt_send(struct diag_pkt *dp) } if (copy_from_user(tmpbuf, - (const void __user *) (unsigned long) dp->data, + (const void __user *)(unsigned long)dp->data, dp->len)) { ret = -EFAULT; goto bail; @@ -619,7 +617,6 @@ static struct hfi1_devdata *hfi1_dd_from_sc_inode(struct inode *in) dd = hfi1_lookup(unit); return dd; - } /* clear or restore send context integrity checks */ @@ -813,7 +810,6 @@ static unsigned int hfi1_snoop_poll(struct file *fp, spin_unlock_irqrestore(&dd->hfi1_snoop.snoop_lock, flags); return ret; - } static ssize_t hfi1_snoop_write(struct file *fp, const char __user *data, @@ -855,7 +851,7 @@ static ssize_t hfi1_snoop_write(struct file *fp, const char __user *data, if (copy_from_user(&byte_one, data, 1)) return -EINVAL; - if (copy_from_user(&byte_two, data+1, 1)) + if (copy_from_user(&byte_two, data + 1, 1)) return -EINVAL; sc4 = (byte_one >> 4) & 0xf; @@ -1329,7 +1325,6 @@ static int hfi1_filter_mad_mgmt_class(void *ibhdr, void *packet_data, static int hfi1_filter_qp_number(void *ibhdr, void *packet_data, void *value) { - struct hfi1_ib_header *hdr; struct hfi1_other_headers *ohdr = NULL; int ret; @@ -1412,7 +1407,6 @@ static int hfi1_filter_ib_service_level(void *ibhdr, void *packet_data, static int hfi1_filter_ib_pkey(void *ibhdr, void *packet_data, void *value) { - u32 lnh = 0; struct hfi1_ib_header *hdr; struct hfi1_other_headers *ohdr = NULL; @@ -1484,7 +1478,6 @@ static struct snoop_packet *allocate_snoop_packet(u32 hdr_len, u32 data_len, u32 md_len) { - struct snoop_packet *packet; packet = kzalloc(sizeof(struct snoop_packet) + hdr_len + data_len @@ -1493,7 +1486,6 @@ static struct snoop_packet *allocate_snoop_packet(u32 hdr_len, if (likely(packet)) INIT_LIST_HEAD(&packet->list); - return packet; } @@ -1550,7 +1542,6 @@ int snoop_recv_handler(struct hfi1_packet *packet) unlikely(snoop_flags & SNOOP_USE_METADATA)) md_len = sizeof(struct capture_md); - s_packet = allocate_snoop_packet(header_size, tlen - header_size, md_len); @@ -1877,5 +1868,4 @@ void snoop_inline_pio_send(struct hfi1_devdata *dd, struct pio_buf *pbuf, inline_pio_out: pio_copy(dd, pbuf, pbc, from, count); - } From 47bc16971939367a8e6b5c38637ba8afb3b8908d Mon Sep 17 00:00:00 2001 From: Ira Weiny Date: Wed, 2 Dec 2015 00:43:30 -0500 Subject: [PATCH 717/843] staging/rdma/hfi1: diag.c change null comparisons Use !foo rather than (foo == NULL) as recommended by checkpatch --strict Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/diag.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rdma/hfi1/diag.c b/drivers/staging/rdma/hfi1/diag.c index a9dc5e9cbc38..f687ddfe264d 100644 --- a/drivers/staging/rdma/hfi1/diag.c +++ b/drivers/staging/rdma/hfi1/diag.c @@ -571,7 +571,7 @@ static ssize_t diagpkt_write(struct file *fp, const char __user *data, */ if (dp.pbc) { dd = hfi1_lookup(dp.unit); - if (dd == NULL) + if (!dd) return -ENODEV; vl = (dp.pbc >> PBC_VL_SHIFT) & PBC_VL_MASK; sc = dd->vld[vl].sc; @@ -657,7 +657,7 @@ static int hfi1_snoop_open(struct inode *in, struct file *fp) mutex_lock(&hfi1_mutex); dd = hfi1_dd_from_sc_inode(in); - if (dd == NULL) { + if (!dd) { ret = -ENODEV; goto bail; } @@ -744,7 +744,7 @@ static int hfi1_snoop_release(struct inode *in, struct file *fp) int mode_flag; dd = hfi1_dd_from_sc_inode(in); - if (dd == NULL) + if (!dd) return -ENODEV; spin_lock_irqsave(&dd->hfi1_snoop.snoop_lock, flags); @@ -799,7 +799,7 @@ static unsigned int hfi1_snoop_poll(struct file *fp, struct hfi1_devdata *dd; dd = hfi1_dd_from_sc_inode(fp->f_inode); - if (dd == NULL) + if (!dd) return -ENODEV; spin_lock_irqsave(&dd->hfi1_snoop.snoop_lock, flags); @@ -826,7 +826,7 @@ static ssize_t hfi1_snoop_write(struct file *fp, const char __user *data, struct hfi1_pportdata *ppd; dd = hfi1_dd_from_sc_inode(fp->f_inode); - if (dd == NULL) + if (!dd) return -ENODEV; ppd = dd->pport; @@ -924,7 +924,7 @@ static ssize_t hfi1_snoop_read(struct file *fp, char __user *data, struct hfi1_devdata *dd; dd = hfi1_dd_from_sc_inode(fp->f_inode); - if (dd == NULL) + if (!dd) return -ENODEV; spin_lock_irqsave(&dd->hfi1_snoop.snoop_lock, flags); @@ -982,7 +982,7 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) struct hfi1_link_info link_info; dd = hfi1_dd_from_sc_inode(fp->f_inode); - if (dd == NULL) + if (!dd) return -ENODEV; spin_lock_irqsave(&dd->hfi1_snoop.snoop_lock, flags); @@ -1546,7 +1546,7 @@ int snoop_recv_handler(struct hfi1_packet *packet) tlen - header_size, md_len); - if (unlikely(s_packet == NULL)) { + if (unlikely(!s_packet)) { dd_dev_warn_ratelimited(ppd->dd, "Unable to allocate snoop/capture packet\n"); break; } @@ -1667,7 +1667,7 @@ int snoop_send_pio_handler(struct hfi1_qp *qp, struct hfi1_pkt_state *ps, /* not using ss->total_len as arg 2 b/c that does not count CRC */ s_packet = allocate_snoop_packet(hdr_len, tlen - hdr_len, md_len); - if (unlikely(s_packet == NULL)) { + if (unlikely(!s_packet)) { dd_dev_warn_ratelimited(ppd->dd, "Unable to allocate snoop/capture packet\n"); goto out; } @@ -1836,7 +1836,7 @@ void snoop_inline_pio_send(struct hfi1_devdata *dd, struct pio_buf *pbuf, s_packet = allocate_snoop_packet(packet_len, 0, md_len); - if (unlikely(s_packet == NULL)) { + if (unlikely(!s_packet)) { dd_dev_warn_ratelimited(dd, "Unable to allocate snoop/capture packet\n"); goto inline_pio_out; } From 9d2b75f696d9a3988e0aab00fca8f931ece35d9c Mon Sep 17 00:00:00 2001 From: Ira Weiny Date: Wed, 2 Dec 2015 00:43:31 -0500 Subject: [PATCH 718/843] staging/rdma/hfi1: diag.c add missing braces Else statements should continue using braces even if there is only 1 line in the block. Found by checkpatch --strict Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/diag.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rdma/hfi1/diag.c b/drivers/staging/rdma/hfi1/diag.c index f687ddfe264d..ed9cfccc860b 100644 --- a/drivers/staging/rdma/hfi1/diag.c +++ b/drivers/staging/rdma/hfi1/diag.c @@ -954,12 +954,14 @@ static ssize_t hfi1_snoop_read(struct file *fp, char __user *data, ret = -EFAULT; else ret = packet->total_len; - } else + } else { ret = -EINVAL; + } kfree(packet); - } else + } else { spin_unlock_irqrestore(&dd->hfi1_snoop.snoop_lock, flags); + } return ret; } From c0d4c2582fc20bff48e7287997f1cf7201f191d2 Mon Sep 17 00:00:00 2001 From: Ira Weiny Date: Wed, 2 Dec 2015 00:43:32 -0500 Subject: [PATCH 719/843] staging/rdma/hfi1: diag.c correct sizeof parameter sizeof should use the variable rather than the struct definition to ensure that type changes are properly accounted for. Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/diag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rdma/hfi1/diag.c b/drivers/staging/rdma/hfi1/diag.c index ed9cfccc860b..70a2614db771 100644 --- a/drivers/staging/rdma/hfi1/diag.c +++ b/drivers/staging/rdma/hfi1/diag.c @@ -1482,7 +1482,7 @@ static struct snoop_packet *allocate_snoop_packet(u32 hdr_len, { struct snoop_packet *packet; - packet = kzalloc(sizeof(struct snoop_packet) + hdr_len + data_len + packet = kzalloc(sizeof(*packet) + hdr_len + data_len + md_len, GFP_ATOMIC | __GFP_NOWARN); if (likely(packet)) From ae1724dffcbcbf0f38320e4295367ff4ea8f513c Mon Sep 17 00:00:00 2001 From: Ira Weiny Date: Wed, 2 Dec 2015 00:43:33 -0500 Subject: [PATCH 720/843] staging/rdma/hfi1: Fix camel case variables physState, linkState, and devState should be phys_state, link_state, and dev_state Signed-off-by: Dennis Dalessandro Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/diag.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/rdma/hfi1/diag.c b/drivers/staging/rdma/hfi1/diag.c index 70a2614db771..75b4bf48d800 100644 --- a/drivers/staging/rdma/hfi1/diag.c +++ b/drivers/staging/rdma/hfi1/diag.c @@ -972,9 +972,9 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) void *filter_value = NULL; long ret = 0; int value = 0; - u8 physState = 0; - u8 linkState = 0; - u16 devState = 0; + u8 phys_state = 0; + u8 link_state = 0; + u16 dev_state = 0; unsigned long flags = 0; unsigned long *argp = NULL; struct hfi1_packet_filter_command filter_cmd = {0}; @@ -1038,31 +1038,31 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) } /* What we want to transition to */ - physState = (value >> 4) & 0xF; - linkState = value & 0xF; + phys_state = (value >> 4) & 0xF; + link_state = value & 0xF; snoop_dbg("Setting link state 0x%x", value); - switch (linkState) { + switch (link_state) { case IB_PORT_NOP: - if (physState == 0) + if (phys_state == 0) break; /* fall through */ case IB_PORT_DOWN: - switch (physState) { + switch (phys_state) { case 0: - devState = HLS_DN_DOWNDEF; + dev_state = HLS_DN_DOWNDEF; break; case 2: - devState = HLS_DN_POLL; + dev_state = HLS_DN_POLL; break; case 3: - devState = HLS_DN_DISABLE; + dev_state = HLS_DN_DISABLE; break; default: ret = -EINVAL; goto done; } - ret = set_link_state(ppd, devState); + ret = set_link_state(ppd, dev_state); break; case IB_PORT_ARMED: ret = set_link_state(ppd, HLS_UP_ARMED); From 845e30e62b19e2db68d36828bf9c540a5e390efe Mon Sep 17 00:00:00 2001 From: Ira Weiny Date: Wed, 2 Dec 2015 00:43:34 -0500 Subject: [PATCH 721/843] staging/rdma/hfi1: Return early from hfi1_ioctl parameter errors Rather than have a switch in a large else clause make the parameter checks return immediately. Signed-off-by: Dennis Dalessandro Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/diag.c | 372 +++++++++++++++---------------- 1 file changed, 185 insertions(+), 187 deletions(-) diff --git a/drivers/staging/rdma/hfi1/diag.c b/drivers/staging/rdma/hfi1/diag.c index 75b4bf48d800..205fc837d9c0 100644 --- a/drivers/staging/rdma/hfi1/diag.c +++ b/drivers/staging/rdma/hfi1/diag.c @@ -987,17 +987,15 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) if (!dd) return -ENODEV; - spin_lock_irqsave(&dd->hfi1_snoop.snoop_lock, flags); - mode_flag = dd->hfi1_snoop.mode_flag; if (((_IOC_DIR(cmd) & _IOC_READ) && !access_ok(VERIFY_WRITE, (void __user *)arg, _IOC_SIZE(cmd))) || ((_IOC_DIR(cmd) & _IOC_WRITE) && !access_ok(VERIFY_READ, (void __user *)arg, _IOC_SIZE(cmd)))) { - ret = -EFAULT; + return -EFAULT; } else if (!capable(CAP_SYS_ADMIN)) { - ret = -EPERM; + return -EPERM; } else if ((mode_flag & HFI1_PORT_CAPTURE_MODE) && (cmd != HFI1_SNOOP_IOCCLEARQUEUE) && (cmd != HFI1_SNOOP_IOCCLEARFILTER) && @@ -1008,208 +1006,208 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) * 3.Set capture filter * Other are invalid. */ + return -EINVAL; + } + + spin_lock_irqsave(&dd->hfi1_snoop.snoop_lock, flags); + + switch (cmd) { + case HFI1_SNOOP_IOCSETLINKSTATE: + snoop_dbg("HFI1_SNOOP_IOCSETLINKSTATE is not valid"); ret = -EINVAL; - } else { - switch (cmd) { - case HFI1_SNOOP_IOCSETLINKSTATE: - snoop_dbg("HFI1_SNOOP_IOCSETLINKSTATE is not valid"); + break; + + case HFI1_SNOOP_IOCSETLINKSTATE_EXTRA: + memset(&link_info, 0, sizeof(link_info)); + + if (copy_from_user(&link_info, + (struct hfi1_link_info __user *)arg, + sizeof(link_info))) + ret = -EFAULT; + + value = link_info.port_state; + index = link_info.port_number; + if (index > dd->num_pports - 1) { ret = -EINVAL; break; + } - case HFI1_SNOOP_IOCSETLINKSTATE_EXTRA: - memset(&link_info, 0, sizeof(link_info)); + ppd = &dd->pport[index]; + if (!ppd) { + ret = -EINVAL; + break; + } - if (copy_from_user(&link_info, - (struct hfi1_link_info __user *)arg, - sizeof(link_info))) - ret = -EFAULT; + /* What we want to transition to */ + phys_state = (value >> 4) & 0xF; + link_state = value & 0xF; + snoop_dbg("Setting link state 0x%x", value); - value = link_info.port_state; - index = link_info.port_number; - if (index > dd->num_pports - 1) { - ret = -EINVAL; + switch (link_state) { + case IB_PORT_NOP: + if (phys_state == 0) break; - } - - ppd = &dd->pport[index]; - if (!ppd) { - ret = -EINVAL; + /* fall through */ + case IB_PORT_DOWN: + switch (phys_state) { + case 0: + dev_state = HLS_DN_DOWNDEF; break; - } - - /* What we want to transition to */ - phys_state = (value >> 4) & 0xF; - link_state = value & 0xF; - snoop_dbg("Setting link state 0x%x", value); - - switch (link_state) { - case IB_PORT_NOP: - if (phys_state == 0) - break; - /* fall through */ - case IB_PORT_DOWN: - switch (phys_state) { - case 0: - dev_state = HLS_DN_DOWNDEF; - break; - case 2: - dev_state = HLS_DN_POLL; - break; - case 3: - dev_state = HLS_DN_DISABLE; - break; - default: - ret = -EINVAL; - goto done; - } - ret = set_link_state(ppd, dev_state); + case 2: + dev_state = HLS_DN_POLL; break; - case IB_PORT_ARMED: - ret = set_link_state(ppd, HLS_UP_ARMED); - if (!ret) - send_idle_sma(dd, SMA_IDLE_ARM); - break; - case IB_PORT_ACTIVE: - ret = set_link_state(ppd, HLS_UP_ACTIVE); - if (!ret) - send_idle_sma(dd, SMA_IDLE_ACTIVE); + case 3: + dev_state = HLS_DN_DISABLE; break; default: ret = -EINVAL; - break; - } - - if (ret) - break; - /* fall through */ - case HFI1_SNOOP_IOCGETLINKSTATE: - case HFI1_SNOOP_IOCGETLINKSTATE_EXTRA: - if (cmd == HFI1_SNOOP_IOCGETLINKSTATE_EXTRA) { - memset(&link_info, 0, sizeof(link_info)); - if (copy_from_user(&link_info, - (struct hfi1_link_info __user *)arg, - sizeof(link_info))) - ret = -EFAULT; - index = link_info.port_number; - } else { - ret = __get_user(index, (int __user *) arg); - if (ret != 0) - break; - } - - if (index > dd->num_pports - 1) { - ret = -EINVAL; - break; - } - - ppd = &dd->pport[index]; - if (!ppd) { - ret = -EINVAL; - break; - } - value = hfi1_ibphys_portstate(ppd); - value <<= 4; - value |= driver_lstate(ppd); - - snoop_dbg("Link port | Link State: %d", value); - - if ((cmd == HFI1_SNOOP_IOCGETLINKSTATE_EXTRA) || - (cmd == HFI1_SNOOP_IOCSETLINKSTATE_EXTRA)) { - link_info.port_state = value; - link_info.node_guid = cpu_to_be64(ppd->guid); - link_info.link_speed_active = - ppd->link_speed_active; - link_info.link_width_active = - ppd->link_width_active; - if (copy_to_user( - (struct hfi1_link_info __user *)arg, - &link_info, sizeof(link_info))) - ret = -EFAULT; - } else { - ret = __put_user(value, (int __user *)arg); + goto done; } + ret = set_link_state(ppd, dev_state); break; - - case HFI1_SNOOP_IOCCLEARQUEUE: - snoop_dbg("Clearing snoop queue"); - drain_snoop_list(&dd->hfi1_snoop.queue); + case IB_PORT_ARMED: + ret = set_link_state(ppd, HLS_UP_ARMED); + if (!ret) + send_idle_sma(dd, SMA_IDLE_ARM); break; - - case HFI1_SNOOP_IOCCLEARFILTER: - snoop_dbg("Clearing filter"); - if (dd->hfi1_snoop.filter_callback) { - /* Drain packets first */ - drain_snoop_list(&dd->hfi1_snoop.queue); - dd->hfi1_snoop.filter_callback = NULL; - } - kfree(dd->hfi1_snoop.filter_value); - dd->hfi1_snoop.filter_value = NULL; - break; - - case HFI1_SNOOP_IOCSETFILTER: - snoop_dbg("Setting filter"); - /* just copy command structure */ - argp = (unsigned long *)arg; - if (copy_from_user(&filter_cmd, (void __user *)argp, - sizeof(filter_cmd))) { - ret = -EFAULT; - break; - } - if (filter_cmd.opcode >= HFI1_MAX_FILTERS) { - pr_alert("Invalid opcode in request\n"); - ret = -EINVAL; - break; - } - - snoop_dbg("Opcode %d Len %d Ptr %p", - filter_cmd.opcode, filter_cmd.length, - filter_cmd.value_ptr); - - filter_value = kcalloc(filter_cmd.length, sizeof(u8), - GFP_KERNEL); - if (!filter_value) { - pr_alert("Not enough memory\n"); - ret = -ENOMEM; - break; - } - /* copy remaining data from userspace */ - if (copy_from_user((u8 *)filter_value, - (void __user *)filter_cmd.value_ptr, - filter_cmd.length)) { - kfree(filter_value); - ret = -EFAULT; - break; - } - /* Drain packets first */ - drain_snoop_list(&dd->hfi1_snoop.queue); - dd->hfi1_snoop.filter_callback = - hfi1_filters[filter_cmd.opcode].filter; - /* just in case we see back to back sets */ - kfree(dd->hfi1_snoop.filter_value); - dd->hfi1_snoop.filter_value = filter_value; - - break; - case HFI1_SNOOP_IOCGETVERSION: - value = SNOOP_CAPTURE_VERSION; - snoop_dbg("Getting version: %d", value); - ret = __put_user(value, (int __user *)arg); - break; - case HFI1_SNOOP_IOCSET_OPTS: - snoop_flags = 0; - ret = __get_user(value, (int __user *) arg); - if (ret != 0) - break; - - snoop_dbg("Setting snoop option %d", value); - if (value & SNOOP_DROP_SEND) - snoop_flags |= SNOOP_DROP_SEND; - if (value & SNOOP_USE_METADATA) - snoop_flags |= SNOOP_USE_METADATA; + case IB_PORT_ACTIVE: + ret = set_link_state(ppd, HLS_UP_ACTIVE); + if (!ret) + send_idle_sma(dd, SMA_IDLE_ACTIVE); break; default: - ret = -ENOTTY; + ret = -EINVAL; break; } + + if (ret) + break; + /* fall through */ + case HFI1_SNOOP_IOCGETLINKSTATE: + case HFI1_SNOOP_IOCGETLINKSTATE_EXTRA: + if (cmd == HFI1_SNOOP_IOCGETLINKSTATE_EXTRA) { + memset(&link_info, 0, sizeof(link_info)); + if (copy_from_user(&link_info, + (struct hfi1_link_info __user *)arg, + sizeof(link_info))) + ret = -EFAULT; + index = link_info.port_number; + } else { + ret = __get_user(index, (int __user *)arg); + if (ret != 0) + break; + } + + if (index > dd->num_pports - 1) { + ret = -EINVAL; + break; + } + + ppd = &dd->pport[index]; + if (!ppd) { + ret = -EINVAL; + break; + } + value = hfi1_ibphys_portstate(ppd); + value <<= 4; + value |= driver_lstate(ppd); + + snoop_dbg("Link port | Link State: %d", value); + + if ((cmd == HFI1_SNOOP_IOCGETLINKSTATE_EXTRA) || + (cmd == HFI1_SNOOP_IOCSETLINKSTATE_EXTRA)) { + link_info.port_state = value; + link_info.node_guid = cpu_to_be64(ppd->guid); + link_info.link_speed_active = + ppd->link_speed_active; + link_info.link_width_active = + ppd->link_width_active; + if (copy_to_user((struct hfi1_link_info __user *)arg, + &link_info, sizeof(link_info))) + ret = -EFAULT; + } else { + ret = __put_user(value, (int __user *)arg); + } + break; + + case HFI1_SNOOP_IOCCLEARQUEUE: + snoop_dbg("Clearing snoop queue"); + drain_snoop_list(&dd->hfi1_snoop.queue); + break; + + case HFI1_SNOOP_IOCCLEARFILTER: + snoop_dbg("Clearing filter"); + if (dd->hfi1_snoop.filter_callback) { + /* Drain packets first */ + drain_snoop_list(&dd->hfi1_snoop.queue); + dd->hfi1_snoop.filter_callback = NULL; + } + kfree(dd->hfi1_snoop.filter_value); + dd->hfi1_snoop.filter_value = NULL; + break; + + case HFI1_SNOOP_IOCSETFILTER: + snoop_dbg("Setting filter"); + /* just copy command structure */ + argp = (unsigned long *)arg; + if (copy_from_user(&filter_cmd, (void __user *)argp, + sizeof(filter_cmd))) { + ret = -EFAULT; + break; + } + if (filter_cmd.opcode >= HFI1_MAX_FILTERS) { + pr_alert("Invalid opcode in request\n"); + ret = -EINVAL; + break; + } + + snoop_dbg("Opcode %d Len %d Ptr %p", + filter_cmd.opcode, filter_cmd.length, + filter_cmd.value_ptr); + + filter_value = kcalloc(filter_cmd.length, sizeof(u8), + GFP_KERNEL); + if (!filter_value) { + ret = -ENOMEM; + break; + } + /* copy remaining data from userspace */ + if (copy_from_user((u8 *)filter_value, + (void __user *)filter_cmd.value_ptr, + filter_cmd.length)) { + kfree(filter_value); + ret = -EFAULT; + break; + } + /* Drain packets first */ + drain_snoop_list(&dd->hfi1_snoop.queue); + dd->hfi1_snoop.filter_callback = + hfi1_filters[filter_cmd.opcode].filter; + /* just in case we see back to back sets */ + kfree(dd->hfi1_snoop.filter_value); + dd->hfi1_snoop.filter_value = filter_value; + + break; + case HFI1_SNOOP_IOCGETVERSION: + value = SNOOP_CAPTURE_VERSION; + snoop_dbg("Getting version: %d", value); + ret = __put_user(value, (int __user *)arg); + break; + case HFI1_SNOOP_IOCSET_OPTS: + snoop_flags = 0; + ret = __get_user(value, (int __user *)arg); + if (ret != 0) + break; + + snoop_dbg("Setting snoop option %d", value); + if (value & SNOOP_DROP_SEND) + snoop_flags |= SNOOP_DROP_SEND; + if (value & SNOOP_USE_METADATA) + snoop_flags |= SNOOP_USE_METADATA; + break; + default: + ret = -ENOTTY; + break; } done: spin_unlock_irqrestore(&dd->hfi1_snoop.snoop_lock, flags); From d8e499ffe4090ad1e53700a2d0f00599ac69727e Mon Sep 17 00:00:00 2001 From: Ira Weiny Date: Wed, 2 Dec 2015 00:43:35 -0500 Subject: [PATCH 722/843] staging/rdma/hfi1: hfi1_ioctl remove setlink state Set link state is not supported remove from the switch statement and allow the default to return -ENOTTY Signed-off-by: Dennis Dalessandro Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/diag.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/rdma/hfi1/diag.c b/drivers/staging/rdma/hfi1/diag.c index 205fc837d9c0..d82a712b29ef 100644 --- a/drivers/staging/rdma/hfi1/diag.c +++ b/drivers/staging/rdma/hfi1/diag.c @@ -1012,11 +1012,6 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) spin_lock_irqsave(&dd->hfi1_snoop.snoop_lock, flags); switch (cmd) { - case HFI1_SNOOP_IOCSETLINKSTATE: - snoop_dbg("HFI1_SNOOP_IOCSETLINKSTATE is not valid"); - ret = -EINVAL; - break; - case HFI1_SNOOP_IOCSETLINKSTATE_EXTRA: memset(&link_info, 0, sizeof(link_info)); From f1811cf632bd00947c3a2f7e538148c99d794daf Mon Sep 17 00:00:00 2001 From: Ira Weiny Date: Wed, 2 Dec 2015 00:43:36 -0500 Subject: [PATCH 723/843] staging/rdma/hfi1: Further clean up hfi1_ioctl parameter checks Final clean up of the if/then/else clause for the parameter checks of hfi1_ioctl Signed-off-by: Dennis Dalessandro Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/diag.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rdma/hfi1/diag.c b/drivers/staging/rdma/hfi1/diag.c index d82a712b29ef..ccc5aeccb44d 100644 --- a/drivers/staging/rdma/hfi1/diag.c +++ b/drivers/staging/rdma/hfi1/diag.c @@ -982,24 +982,28 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) struct hfi1_pportdata *ppd = NULL; unsigned int index; struct hfi1_link_info link_info; + int read_cmd, write_cmd, read_ok, write_ok; dd = hfi1_dd_from_sc_inode(fp->f_inode); if (!dd) return -ENODEV; mode_flag = dd->hfi1_snoop.mode_flag; + read_cmd = _IOC_DIR(cmd) & _IOC_READ; + write_cmd = _IOC_DIR(cmd) & _IOC_WRITE; + write_ok = access_ok(VERIFY_WRITE, (void __user *)arg, _IOC_SIZE(cmd)); + read_ok = access_ok(VERIFY_READ, (void __user *)arg, _IOC_SIZE(cmd)); - if (((_IOC_DIR(cmd) & _IOC_READ) - && !access_ok(VERIFY_WRITE, (void __user *)arg, _IOC_SIZE(cmd))) - || ((_IOC_DIR(cmd) & _IOC_WRITE) - && !access_ok(VERIFY_READ, (void __user *)arg, _IOC_SIZE(cmd)))) { + if ((read_cmd && !write_ok) || (write_cmd && !read_ok)) return -EFAULT; - } else if (!capable(CAP_SYS_ADMIN)) { + + if (!capable(CAP_SYS_ADMIN)) return -EPERM; - } else if ((mode_flag & HFI1_PORT_CAPTURE_MODE) && - (cmd != HFI1_SNOOP_IOCCLEARQUEUE) && - (cmd != HFI1_SNOOP_IOCCLEARFILTER) && - (cmd != HFI1_SNOOP_IOCSETFILTER)) { + + if ((mode_flag & HFI1_PORT_CAPTURE_MODE) && + (cmd != HFI1_SNOOP_IOCCLEARQUEUE) && + (cmd != HFI1_SNOOP_IOCCLEARFILTER) && + (cmd != HFI1_SNOOP_IOCSETFILTER)) /* Capture devices are allowed only 3 operations * 1.Clear capture queue * 2.Clear capture filter @@ -1007,7 +1011,6 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) * Other are invalid. */ return -EINVAL; - } spin_lock_irqsave(&dd->hfi1_snoop.snoop_lock, flags); From 33ab349037db079aec7d60608fe4fb1114be6b91 Mon Sep 17 00:00:00 2001 From: Dennis Dalessandro Date: Wed, 2 Dec 2015 00:43:37 -0500 Subject: [PATCH 724/843] staging/rdma/hfi1: Reduce snoop locking scope in IOCTL handler. This patch avoids issues while calling into copy from/to user while holding the lock by only taking the lock when it is absolutely required. The only commands which require the snoop lock are: *Set Filter *Clear Filter *Clear Queue Reviewed-by: Mike Marciniszyn Signed-off-by: Dennis Dalessandro Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/diag.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rdma/hfi1/diag.c b/drivers/staging/rdma/hfi1/diag.c index ccc5aeccb44d..b0b7e28ebfc2 100644 --- a/drivers/staging/rdma/hfi1/diag.c +++ b/drivers/staging/rdma/hfi1/diag.c @@ -1012,8 +1012,6 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) */ return -EINVAL; - spin_lock_irqsave(&dd->hfi1_snoop.snoop_lock, flags); - switch (cmd) { case HFI1_SNOOP_IOCSETLINKSTATE_EXTRA: memset(&link_info, 0, sizeof(link_info)); @@ -1130,11 +1128,14 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) case HFI1_SNOOP_IOCCLEARQUEUE: snoop_dbg("Clearing snoop queue"); + spin_lock_irqsave(&dd->hfi1_snoop.snoop_lock, flags); drain_snoop_list(&dd->hfi1_snoop.queue); + spin_unlock_irqrestore(&dd->hfi1_snoop.snoop_lock, flags); break; case HFI1_SNOOP_IOCCLEARFILTER: snoop_dbg("Clearing filter"); + spin_lock_irqsave(&dd->hfi1_snoop.snoop_lock, flags); if (dd->hfi1_snoop.filter_callback) { /* Drain packets first */ drain_snoop_list(&dd->hfi1_snoop.queue); @@ -1142,6 +1143,7 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) } kfree(dd->hfi1_snoop.filter_value); dd->hfi1_snoop.filter_value = NULL; + spin_unlock_irqrestore(&dd->hfi1_snoop.snoop_lock, flags); break; case HFI1_SNOOP_IOCSETFILTER: @@ -1178,13 +1180,14 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) break; } /* Drain packets first */ + spin_lock_irqsave(&dd->hfi1_snoop.snoop_lock, flags); drain_snoop_list(&dd->hfi1_snoop.queue); dd->hfi1_snoop.filter_callback = hfi1_filters[filter_cmd.opcode].filter; /* just in case we see back to back sets */ kfree(dd->hfi1_snoop.filter_value); dd->hfi1_snoop.filter_value = filter_value; - + spin_unlock_irqrestore(&dd->hfi1_snoop.snoop_lock, flags); break; case HFI1_SNOOP_IOCGETVERSION: value = SNOOP_CAPTURE_VERSION; @@ -1208,7 +1211,6 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) break; } done: - spin_unlock_irqrestore(&dd->hfi1_snoop.snoop_lock, flags); return ret; } From 2d1900f131f015ff335c53b655edfb4e10e57ee7 Mon Sep 17 00:00:00 2001 From: Dennis Dalessandro Date: Wed, 2 Dec 2015 00:43:38 -0500 Subject: [PATCH 725/843] staging/rdma/hfi1: Return immediately on error Now that the spinlock is not taken throughout hfi1_ioctl it is safe to return early rather than setting a variable and falling through the switch. Reviewed-by: Mike Marciniszyn Signed-off-by: Dennis Dalessandro Signed-off-by: Ira Weiny Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/diag.c | 62 +++++++++++++------------------- 1 file changed, 24 insertions(+), 38 deletions(-) diff --git a/drivers/staging/rdma/hfi1/diag.c b/drivers/staging/rdma/hfi1/diag.c index b0b7e28ebfc2..0c8831705664 100644 --- a/drivers/staging/rdma/hfi1/diag.c +++ b/drivers/staging/rdma/hfi1/diag.c @@ -1019,20 +1019,16 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) if (copy_from_user(&link_info, (struct hfi1_link_info __user *)arg, sizeof(link_info))) - ret = -EFAULT; + return -EFAULT; value = link_info.port_state; index = link_info.port_number; - if (index > dd->num_pports - 1) { - ret = -EINVAL; - break; - } + if (index > dd->num_pports - 1) + return -EINVAL; ppd = &dd->pport[index]; - if (!ppd) { - ret = -EINVAL; - break; - } + if (!ppd) + return -EINVAL; /* What we want to transition to */ phys_state = (value >> 4) & 0xF; @@ -1056,8 +1052,7 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) dev_state = HLS_DN_DISABLE; break; default: - ret = -EINVAL; - goto done; + return -EINVAL; } ret = set_link_state(ppd, dev_state); break; @@ -1072,8 +1067,7 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) send_idle_sma(dd, SMA_IDLE_ACTIVE); break; default: - ret = -EINVAL; - break; + return -EINVAL; } if (ret) @@ -1086,7 +1080,7 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) if (copy_from_user(&link_info, (struct hfi1_link_info __user *)arg, sizeof(link_info))) - ret = -EFAULT; + return -EFAULT; index = link_info.port_number; } else { ret = __get_user(index, (int __user *)arg); @@ -1094,16 +1088,13 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) break; } - if (index > dd->num_pports - 1) { - ret = -EINVAL; - break; - } + if (index > dd->num_pports - 1) + return -EINVAL; ppd = &dd->pport[index]; - if (!ppd) { - ret = -EINVAL; - break; - } + if (!ppd) + return -EINVAL; + value = hfi1_ibphys_portstate(ppd); value <<= 4; value |= driver_lstate(ppd); @@ -1120,7 +1111,7 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) ppd->link_width_active; if (copy_to_user((struct hfi1_link_info __user *)arg, &link_info, sizeof(link_info))) - ret = -EFAULT; + return -EFAULT; } else { ret = __put_user(value, (int __user *)arg); } @@ -1151,14 +1142,12 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) /* just copy command structure */ argp = (unsigned long *)arg; if (copy_from_user(&filter_cmd, (void __user *)argp, - sizeof(filter_cmd))) { - ret = -EFAULT; - break; - } + sizeof(filter_cmd))) + return -EFAULT; + if (filter_cmd.opcode >= HFI1_MAX_FILTERS) { pr_alert("Invalid opcode in request\n"); - ret = -EINVAL; - break; + return -EINVAL; } snoop_dbg("Opcode %d Len %d Ptr %p", @@ -1167,17 +1156,15 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) filter_value = kcalloc(filter_cmd.length, sizeof(u8), GFP_KERNEL); - if (!filter_value) { - ret = -ENOMEM; - break; - } + if (!filter_value) + return -ENOMEM; + /* copy remaining data from userspace */ if (copy_from_user((u8 *)filter_value, (void __user *)filter_cmd.value_ptr, filter_cmd.length)) { kfree(filter_value); - ret = -EFAULT; - break; + return -EFAULT; } /* Drain packets first */ spin_lock_irqsave(&dd->hfi1_snoop.snoop_lock, flags); @@ -1207,10 +1194,9 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) snoop_flags |= SNOOP_USE_METADATA; break; default: - ret = -ENOTTY; - break; + return -ENOTTY; } -done: + return ret; } From 483119a760639858ce2369a314d1bd93a3db3062 Mon Sep 17 00:00:00 2001 From: Mitko Haralanov Date: Tue, 8 Dec 2015 17:10:10 -0500 Subject: [PATCH 726/843] staging/rdma/hfi1: Unconditionally clean-up SDMA queues There is no need to cleck if the packet queue is allocated when cleaning up a user context. The hfi1_user_sdma_free_queues() function already does all the required checks. Reviewed-by: Ira Weiny Signed-off-by: Mitko Haralanov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/file_ops.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/rdma/hfi1/file_ops.c b/drivers/staging/rdma/hfi1/file_ops.c index 874305f0a925..1bdc073fa881 100644 --- a/drivers/staging/rdma/hfi1/file_ops.c +++ b/drivers/staging/rdma/hfi1/file_ops.c @@ -731,8 +731,7 @@ static int hfi1_file_close(struct inode *inode, struct file *fp) flush_wc(); /* drain user sdma queue */ - if (fdata->pq) - hfi1_user_sdma_free_queues(fdata); + hfi1_user_sdma_free_queues(fdata); /* * Clear any left over, unhandled events so the next process that From def8228452f87d05bd43ac21aeaf894ca081bca4 Mon Sep 17 00:00:00 2001 From: Mitko Haralanov Date: Tue, 8 Dec 2015 17:10:09 -0500 Subject: [PATCH 727/843] staging/rdma/hfi1: Convert to use get_user_pages_fast Convert hfi1_get_user_pages() to use get_user_pages_fast(), which is much fatster. The mm semaphore is still taken to update the pinned page count but is for a much shorter amount of time. Reviewed-by: Ira Weiny Signed-off-by: Mitko Haralanov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/file_ops.c | 8 +- drivers/staging/rdma/hfi1/hfi.h | 4 +- drivers/staging/rdma/hfi1/user_pages.c | 101 +++++++------------------ 3 files changed, 34 insertions(+), 79 deletions(-) diff --git a/drivers/staging/rdma/hfi1/file_ops.c b/drivers/staging/rdma/hfi1/file_ops.c index 1bdc073fa881..d57d549052c8 100644 --- a/drivers/staging/rdma/hfi1/file_ops.c +++ b/drivers/staging/rdma/hfi1/file_ops.c @@ -1663,8 +1663,8 @@ static int exp_tid_setup(struct file *fp, struct hfi1_tid_info *tinfo) * Now that we know how many free RcvArray entries we have, * we can pin that many user pages. */ - ret = hfi1_get_user_pages(vaddr + (mapped * PAGE_SIZE), - pinned, pages); + ret = hfi1_acquire_user_pages(vaddr + (mapped * PAGE_SIZE), + pinned, true, pages); if (ret) { /* * We can't continue because the pages array won't be @@ -1833,7 +1833,7 @@ static int exp_tid_free(struct file *fp, struct hfi1_tid_info *tinfo) } } flush_wc(); - hfi1_release_user_pages(pshadow, pcount); + hfi1_release_user_pages(pshadow, pcount, true); clear_bit(bitidx, &uctxt->tidusemap[idx]); map &= ~(1ULL<physshadow[tid] = 0; uctxt->tid_pg_list[tid] = NULL; pci_unmap_page(dd->pcidev, phys, PAGE_SIZE, PCI_DMA_FROMDEVICE); - hfi1_release_user_pages(&p, 1); + hfi1_release_user_pages(&p, 1, true); } } diff --git a/drivers/staging/rdma/hfi1/hfi.h b/drivers/staging/rdma/hfi1/hfi.h index 7f8cafa841b5..7aea874b3dfc 100644 --- a/drivers/staging/rdma/hfi1/hfi.h +++ b/drivers/staging/rdma/hfi1/hfi.h @@ -1587,8 +1587,8 @@ void hfi1_set_led_override(struct hfi1_pportdata *ppd, unsigned int val); */ #define DEFAULT_RCVHDR_ENTSIZE 32 -int hfi1_get_user_pages(unsigned long, size_t, struct page **); -void hfi1_release_user_pages(struct page **, size_t); +int hfi1_acquire_user_pages(unsigned long, size_t, bool, struct page **); +void hfi1_release_user_pages(struct page **, size_t, bool); static inline void clear_rcvhdrtail(const struct hfi1_ctxtdata *rcd) { diff --git a/drivers/staging/rdma/hfi1/user_pages.c b/drivers/staging/rdma/hfi1/user_pages.c index 9071afbd7bf4..692de658f0dc 100644 --- a/drivers/staging/rdma/hfi1/user_pages.c +++ b/drivers/staging/rdma/hfi1/user_pages.c @@ -49,59 +49,11 @@ */ #include +#include #include #include "hfi.h" -static void __hfi1_release_user_pages(struct page **p, size_t num_pages, - int dirty) -{ - size_t i; - - for (i = 0; i < num_pages; i++) { - if (dirty) - set_page_dirty_lock(p[i]); - put_page(p[i]); - } -} - -/* - * Call with current->mm->mmap_sem held. - */ -static int __hfi1_get_user_pages(unsigned long start_page, size_t num_pages, - struct page **p) -{ - unsigned long lock_limit; - size_t got; - int ret; - - lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT; - - if (num_pages > lock_limit && !capable(CAP_IPC_LOCK)) { - ret = -ENOMEM; - goto bail; - } - - for (got = 0; got < num_pages; got += ret) { - ret = get_user_pages(current, current->mm, - start_page + got * PAGE_SIZE, - num_pages - got, 1, 1, - p + got, NULL); - if (ret < 0) - goto bail_release; - } - - current->mm->pinned_vm += num_pages; - - ret = 0; - goto bail; - -bail_release: - __hfi1_release_user_pages(p, got, 0); -bail: - return ret; -} - /** * hfi1_map_page - a safety wrapper around pci_map_page() * @@ -116,41 +68,44 @@ dma_addr_t hfi1_map_page(struct pci_dev *hwdev, struct page *page, return phys; } -/** - * hfi1_get_user_pages - lock user pages into memory - * @start_page: the start page - * @num_pages: the number of pages - * @p: the output page structures - * - * This function takes a given start page (page aligned user virtual - * address) and pins it and the following specified number of pages. For - * now, num_pages is always 1, but that will probably change at some point - * (because caller is doing expected sends on a single virtually contiguous - * buffer, so we can do all pages at once). - */ -int hfi1_get_user_pages(unsigned long start_page, size_t num_pages, - struct page **p) +int hfi1_acquire_user_pages(unsigned long vaddr, size_t npages, bool writable, + struct page **pages) { + unsigned long pinned, lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT; + bool can_lock = capable(CAP_IPC_LOCK); int ret; + down_read(¤t->mm->mmap_sem); + pinned = current->mm->pinned_vm; + up_read(¤t->mm->mmap_sem); + + if (pinned + npages > lock_limit && !can_lock) + return -ENOMEM; + + ret = get_user_pages_fast(vaddr, npages, writable, pages); + if (ret < 0) + return ret; + down_write(¤t->mm->mmap_sem); - - ret = __hfi1_get_user_pages(start_page, num_pages, p); - + current->mm->pinned_vm += ret; up_write(¤t->mm->mmap_sem); return ret; } -void hfi1_release_user_pages(struct page **p, size_t num_pages) +void hfi1_release_user_pages(struct page **p, size_t npages, bool dirty) { - if (current->mm) /* during close after signal, mm can be NULL */ + size_t i; + + for (i = 0; i < npages; i++) { + if (dirty) + set_page_dirty_lock(p[i]); + put_page(p[i]); + } + + if (current->mm) { /* during close after signal, mm can be NULL */ down_write(¤t->mm->mmap_sem); - - __hfi1_release_user_pages(p, num_pages, 1); - - if (current->mm) { - current->mm->pinned_vm -= num_pages; + current->mm->pinned_vm -= npages; up_write(¤t->mm->mmap_sem); } } From a0d406934a460b2b8dac8cf15996ec8591e33e2e Mon Sep 17 00:00:00 2001 From: Mitko Haralanov Date: Tue, 8 Dec 2015 17:10:13 -0500 Subject: [PATCH 728/843] staging/rdma/hfi1: Add page lock limit check for SDMA requests The driver pins pages on behalf of user processes in two separate instances - when the process has submitted a SDMA transfer and when the process programs an expected receive buffer. When pinning pages, the driver is required to observe the locked page limit set by the system administrator and refuse to lock more pages than allowed. Such a check was done for expected receives but was missing from the SDMA transfer code path. This commit adds the missing check for SDMA transfers. As of this commit, user SDMA or expected receive requests will be rejected if the number of pages required to be pinned will exceed the set limit. Due to the fact that the driver needs to take the MM semaphore in order to update the locked page count (which can sleep), this cannot be done by the callback function as it [the callback] is executed in interrupt context. Therefore, it is necessary to put all the completed SDMA tx requests onto a separate list (txcmp) and offload the actual clean-up and unpinning work to a workqueue. Reviewed-by: Dennis Dalessandro Reviewed-by: Ira Weiny Signed-off-by: Mitko Haralanov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/user_sdma.c | 276 ++++++++++++++++---------- drivers/staging/rdma/hfi1/user_sdma.h | 2 + 2 files changed, 169 insertions(+), 109 deletions(-) diff --git a/drivers/staging/rdma/hfi1/user_sdma.c b/drivers/staging/rdma/hfi1/user_sdma.c index 41408f82afe8..55fe02ef37cb 100644 --- a/drivers/staging/rdma/hfi1/user_sdma.c +++ b/drivers/staging/rdma/hfi1/user_sdma.c @@ -213,12 +213,6 @@ struct user_sdma_request { * to 0. */ u8 omfactor; - /* - * pointer to the user's task_struct. We are going to - * get a reference to it so we can process io vectors - * at a later time. - */ - struct task_struct *user_proc; /* * pointer to the user's mm_struct. We are going to * get a reference to it so it doesn't get freed @@ -245,9 +239,13 @@ struct user_sdma_request { u16 tididx; u32 sent; u64 seqnum; - spinlock_t list_lock; struct list_head txps; + spinlock_t txcmp_lock; /* protect txcmp list */ + struct list_head txcmp; unsigned long flags; + /* status of the last txreq completed */ + int status; + struct work_struct worker; }; /* @@ -260,6 +258,7 @@ struct user_sdma_txreq { /* Packet header for the txreq */ struct hfi1_pkt_header hdr; struct sdma_txreq txreq; + struct list_head list; struct user_sdma_request *req; struct { struct user_sdma_iovec *vec; @@ -282,10 +281,12 @@ struct user_sdma_txreq { static int user_sdma_send_pkts(struct user_sdma_request *, unsigned); static int num_user_pages(const struct iovec *); static void user_sdma_txreq_cb(struct sdma_txreq *, int, int); +static void user_sdma_delayed_completion(struct work_struct *); static void user_sdma_free_request(struct user_sdma_request *); static int pin_vector_pages(struct user_sdma_request *, struct user_sdma_iovec *); -static void unpin_vector_pages(struct user_sdma_iovec *); +static void unpin_vector_pages(struct user_sdma_request *, + struct user_sdma_iovec *); static int check_header_template(struct user_sdma_request *, struct hfi1_pkt_header *, u32, u32); static int set_txreq_header(struct user_sdma_request *, @@ -391,6 +392,7 @@ int hfi1_user_sdma_alloc_queues(struct hfi1_ctxtdata *uctxt, struct file *fp) pq->n_max_reqs = hfi1_sdma_comp_ring_size; pq->state = SDMA_PKT_Q_INACTIVE; atomic_set(&pq->n_reqs, 0); + init_waitqueue_head(&pq->wait); iowait_init(&pq->busy, 0, NULL, defer_packet_queue, activate_packet_queue); @@ -451,26 +453,16 @@ int hfi1_user_sdma_free_queues(struct hfi1_filedata *fd) uctxt->ctxt, fd->subctxt); pq = fd->pq; if (pq) { - u16 i, j; - spin_lock_irqsave(&uctxt->sdma_qlock, flags); if (!list_empty(&pq->list)) list_del_init(&pq->list); spin_unlock_irqrestore(&uctxt->sdma_qlock, flags); iowait_sdma_drain(&pq->busy); - if (pq->reqs) { - for (i = 0, j = 0; i < atomic_read(&pq->n_reqs) && - j < pq->n_max_reqs; j++) { - struct user_sdma_request *req = &pq->reqs[j]; - - if (test_bit(SDMA_REQ_IN_USE, &req->flags)) { - set_comp_state(req, ERROR, -ECOMM); - user_sdma_free_request(req); - i++; - } - } - kfree(pq->reqs); - } + /* Wait until all requests have been freed. */ + wait_event_interruptible( + pq->wait, + (ACCESS_ONCE(pq->state) == SDMA_PKT_Q_INACTIVE)); + kfree(pq->reqs); kmem_cache_destroy(pq->txreq_cache); kfree(pq); fd->pq = NULL; @@ -544,8 +536,12 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec, req->data_iovs = req_iovcnt(info.ctrl) - 1; req->pq = pq; req->cq = cq; + req->status = -1; INIT_LIST_HEAD(&req->txps); - spin_lock_init(&req->list_lock); + INIT_LIST_HEAD(&req->txcmp); + INIT_WORK(&req->worker, user_sdma_delayed_completion); + + spin_lock_init(&req->txcmp_lock); memcpy(&req->info, &info, sizeof(info)); if (req_opcode(info.ctrl) == EXPECTED) @@ -685,18 +681,16 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec, sent = user_sdma_send_pkts(req, pcount); if (unlikely(sent < 0)) { if (sent != -EBUSY) { - ret = sent; - goto send_err; + req->status = sent; + set_comp_state(req, ERROR, req->status); + return sent; } else sent = 0; } atomic_inc(&pq->n_reqs); + xchg(&pq->state, SDMA_PKT_Q_ACTIVE); if (sent < req->info.npkts) { - /* Take the references to the user's task and mm_struct */ - get_task_struct(current); - req->user_proc = current; - /* * This is a somewhat blocking send implementation. * The driver will block the caller until all packets of the @@ -706,8 +700,10 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec, while (!test_bit(SDMA_REQ_SEND_DONE, &req->flags)) { ret = user_sdma_send_pkts(req, pcount); if (ret < 0) { - if (ret != -EBUSY) - goto send_err; + if (ret != -EBUSY) { + req->status = ret; + return ret; + } wait_event_interruptible_timeout( pq->busy.wait_dma, (pq->state == SDMA_PKT_Q_ACTIVE), @@ -717,14 +713,10 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec, } } - ret = 0; *count += idx; - goto done; -send_err: - set_comp_state(req, ERROR, ret); + return 0; free_req: user_sdma_free_request(req); -done: return ret; } @@ -825,6 +817,7 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) tx->req = req; tx->busycount = 0; tx->idx = -1; + INIT_LIST_HEAD(&tx->list); memset(tx->iovecs, 0, sizeof(tx->iovecs)); if (req->seqnum == req->info.npkts - 1) @@ -949,9 +942,8 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) if (ret) { int i; - dd_dev_err(pq->dd, - "SDMA txreq add page failed %d\n", - ret); + SDMA_DBG(req, "SDMA txreq add page failed %d\n", + ret); /* Mark all assigned vectors as complete so they * are unpinned in the callback. */ for (i = tx->idx; i >= 0; i--) { @@ -1045,52 +1037,58 @@ static inline int num_user_pages(const struct iovec *iov) static int pin_vector_pages(struct user_sdma_request *req, struct user_sdma_iovec *iovec) { - int ret = 0; - unsigned pinned; + int pinned, npages; - iovec->npages = num_user_pages(&iovec->iov); - iovec->pages = kcalloc(iovec->npages, sizeof(*iovec->pages), - GFP_KERNEL); + npages = num_user_pages(&iovec->iov); + iovec->pages = kcalloc(npages, sizeof(*iovec->pages), GFP_KERNEL); if (!iovec->pages) { SDMA_DBG(req, "Failed page array alloc"); - ret = -ENOMEM; - goto done; + return -ENOMEM; } - /* If called by the kernel thread, use the user's mm */ - if (current->flags & PF_KTHREAD) - use_mm(req->user_proc->mm); - pinned = get_user_pages_fast( - (unsigned long)iovec->iov.iov_base, - iovec->npages, 0, iovec->pages); - /* If called by the kernel thread, unuse the user's mm */ - if (current->flags & PF_KTHREAD) - unuse_mm(req->user_proc->mm); - if (pinned != iovec->npages) { - SDMA_DBG(req, "Failed to pin pages (%u/%u)", pinned, - iovec->npages); - ret = -EFAULT; - goto pfree; + + /* + * Get a reference to the process's mm so we can use it when + * unpinning the io vectors. + */ + req->pq->user_mm = get_task_mm(current); + + pinned = hfi1_acquire_user_pages((unsigned long)iovec->iov.iov_base, + npages, 0, iovec->pages); + + if (pinned < 0) + return pinned; + + iovec->npages = pinned; + if (pinned != npages) { + SDMA_DBG(req, "Failed to pin pages (%d/%u)", pinned, npages); + unpin_vector_pages(req, iovec); + return -EFAULT; } - goto done; -pfree: - unpin_vector_pages(iovec); -done: - return ret; + return 0; } -static void unpin_vector_pages(struct user_sdma_iovec *iovec) +static void unpin_vector_pages(struct user_sdma_request *req, + struct user_sdma_iovec *iovec) { - unsigned i; + /* + * Unpinning is done through the workqueue so use the + * process's mm if we have a reference to it. + */ + if ((current->flags & PF_KTHREAD) && req->pq->user_mm) + use_mm(req->pq->user_mm); - if (ACCESS_ONCE(iovec->offset) != iovec->iov.iov_len) { - hfi1_cdbg(SDMA, - "the complete vector has not been sent yet %llu %zu", - iovec->offset, iovec->iov.iov_len); - return; + hfi1_release_user_pages(iovec->pages, iovec->npages, 0); + + /* + * Unuse the user's mm (see above) and release the + * reference to it. + */ + if (req->pq->user_mm) { + if (current->flags & PF_KTHREAD) + unuse_mm(req->pq->user_mm); + mmput(req->pq->user_mm); } - for (i = 0; i < iovec->npages; i++) - if (iovec->pages[i]) - put_page(iovec->pages[i]); + kfree(iovec->pages); iovec->pages = NULL; iovec->npages = 0; @@ -1358,54 +1356,116 @@ static int set_txreq_header_ahg(struct user_sdma_request *req, return diff; } +/* + * SDMA tx request completion callback. Called when the SDMA progress + * state machine gets notification that the SDMA descriptors for this + * tx request have been processed by the DMA engine. Called in + * interrupt context. + */ static void user_sdma_txreq_cb(struct sdma_txreq *txreq, int status, int drain) { struct user_sdma_txreq *tx = container_of(txreq, struct user_sdma_txreq, txreq); - struct user_sdma_request *req = tx->req; - struct hfi1_user_sdma_pkt_q *pq = req ? req->pq : NULL; - u64 tx_seqnum; + struct user_sdma_request *req; + bool defer; + int i; - if (unlikely(!req || !pq)) + if (!tx->req) return; - /* If we have any io vectors associated with this txreq, - * check whether they need to be 'freed'. */ - if (tx->idx != -1) { - int i; + req = tx->req; + /* + * If this is the callback for the last packet of the request, + * queue up the request for clean up. + */ + defer = (tx->seqnum == req->info.npkts - 1); - for (i = tx->idx; i >= 0; i--) { - if (tx->iovecs[i].flags & TXREQ_FLAGS_IOVEC_LAST_PKT) - unpin_vector_pages(tx->iovecs[i].vec); + /* + * If we have any io vectors associated with this txreq, + * check whether they need to be 'freed'. We can't free them + * here because the unpin function needs to be able to sleep. + */ + for (i = tx->idx; i >= 0; i--) { + if (tx->iovecs[i].flags & TXREQ_FLAGS_IOVEC_LAST_PKT) { + defer = true; + break; } } - tx_seqnum = tx->seqnum; - kmem_cache_free(pq->txreq_cache, tx); - + req->status = status; if (status != SDMA_TXREQ_S_OK) { - dd_dev_err(pq->dd, "SDMA completion with error %d", status); - set_comp_state(req, ERROR, status); + SDMA_DBG(req, "SDMA completion with error %d", + status); set_bit(SDMA_REQ_HAS_ERROR, &req->flags); - /* Do not free the request until the sender loop has ack'ed - * the error and we've seen all txreqs. */ - if (tx_seqnum == ACCESS_ONCE(req->seqnum) && - test_bit(SDMA_REQ_DONE_ERROR, &req->flags)) { - atomic_dec(&pq->n_reqs); - user_sdma_free_request(req); - } + defer = true; + } + + /* + * Defer the clean up of the iovectors and the request until later + * so it can be done outside of interrupt context. + */ + if (defer) { + spin_lock(&req->txcmp_lock); + list_add_tail(&tx->list, &req->txcmp); + spin_unlock(&req->txcmp_lock); + schedule_work(&req->worker); } else { - if (tx_seqnum == req->info.npkts - 1) { - /* We've sent and completed all packets in this - * request. Signal completion to the user */ - atomic_dec(&pq->n_reqs); - set_comp_state(req, COMPLETE, 0); - user_sdma_free_request(req); + kmem_cache_free(req->pq->txreq_cache, tx); + } +} + +static void user_sdma_delayed_completion(struct work_struct *work) +{ + struct user_sdma_request *req = + container_of(work, struct user_sdma_request, worker); + struct hfi1_user_sdma_pkt_q *pq = req->pq; + struct user_sdma_txreq *tx = NULL; + unsigned long flags; + u64 seqnum; + int i; + + while (1) { + spin_lock_irqsave(&req->txcmp_lock, flags); + if (!list_empty(&req->txcmp)) { + tx = list_first_entry(&req->txcmp, + struct user_sdma_txreq, list); + list_del(&tx->list); + } + spin_unlock_irqrestore(&req->txcmp_lock, flags); + if (!tx) + break; + + for (i = tx->idx; i >= 0; i--) + if (tx->iovecs[i].flags & TXREQ_FLAGS_IOVEC_LAST_PKT) + unpin_vector_pages(req, tx->iovecs[i].vec); + + seqnum = tx->seqnum; + kmem_cache_free(pq->txreq_cache, tx); + tx = NULL; + + if (req->status != SDMA_TXREQ_S_OK) { + if (seqnum == ACCESS_ONCE(req->seqnum) && + test_bit(SDMA_REQ_DONE_ERROR, &req->flags)) { + atomic_dec(&pq->n_reqs); + set_comp_state(req, ERROR, req->status); + user_sdma_free_request(req); + break; + } + } else { + if (seqnum == req->info.npkts - 1) { + atomic_dec(&pq->n_reqs); + set_comp_state(req, COMPLETE, 0); + user_sdma_free_request(req); + break; + } } } - if (!atomic_read(&pq->n_reqs)) + + if (!atomic_read(&pq->n_reqs)) { xchg(&pq->state, SDMA_PKT_Q_INACTIVE); + wake_up(&pq->wait); + } } static void user_sdma_free_request(struct user_sdma_request *req) @@ -1426,10 +1486,8 @@ static void user_sdma_free_request(struct user_sdma_request *req) for (i = 0; i < req->data_iovs; i++) if (req->iovs[i].npages && req->iovs[i].pages) - unpin_vector_pages(&req->iovs[i]); + unpin_vector_pages(req, &req->iovs[i]); } - if (req->user_proc) - put_task_struct(req->user_proc); kfree(req->tids); clear_bit(SDMA_REQ_IN_USE, &req->flags); } diff --git a/drivers/staging/rdma/hfi1/user_sdma.h b/drivers/staging/rdma/hfi1/user_sdma.h index 0046ffa774fe..0afa28508a8a 100644 --- a/drivers/staging/rdma/hfi1/user_sdma.h +++ b/drivers/staging/rdma/hfi1/user_sdma.h @@ -68,6 +68,8 @@ struct hfi1_user_sdma_pkt_q { struct user_sdma_request *reqs; struct iowait busy; unsigned state; + wait_queue_head_t wait; + struct mm_struct *user_mm; }; struct hfi1_user_sdma_comp_q { From faa98b862011a1ad92e66633220371fa3b799fc4 Mon Sep 17 00:00:00 2001 From: Mitko Haralanov Date: Tue, 8 Dec 2015 17:10:11 -0500 Subject: [PATCH 729/843] staging/rdma/hfi1: Clean-up unnecessary goto statements Clean-up unnecessary goto statements based on feedback from the mailing list on previous patch submissions. Reviewed-by: Ira Weiny Signed-off-by: Mitko Haralanov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/user_sdma.c | 37 ++++++++++----------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/drivers/staging/rdma/hfi1/user_sdma.c b/drivers/staging/rdma/hfi1/user_sdma.c index 55fe02ef37cb..d03c810b6206 100644 --- a/drivers/staging/rdma/hfi1/user_sdma.c +++ b/drivers/staging/rdma/hfi1/user_sdma.c @@ -497,15 +497,13 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec, "[%u:%u:%u] First vector not big enough for header %lu/%lu", dd->unit, uctxt->ctxt, fd->subctxt, iovec[idx].iov_len, sizeof(info) + sizeof(req->hdr)); - ret = -EINVAL; - goto done; + return -EINVAL; } ret = copy_from_user(&info, iovec[idx].iov_base, sizeof(info)); if (ret) { hfi1_cdbg(SDMA, "[%u:%u:%u] Failed to copy info QW (%d)", dd->unit, uctxt->ctxt, fd->subctxt, ret); - ret = -EFAULT; - goto done; + return -EFAULT; } trace_hfi1_sdma_user_reqinfo(dd, uctxt->ctxt, fd->subctxt, (u16 *)&info); @@ -513,15 +511,13 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec, hfi1_cdbg(SDMA, "[%u:%u:%u] Entry %u is in QUEUED state", dd->unit, uctxt->ctxt, fd->subctxt, info.comp_idx); - ret = -EBADSLT; - goto done; + return -EBADSLT; } if (!info.fragsize) { hfi1_cdbg(SDMA, "[%u:%u:%u:%u] Request does not specify fragsize", dd->unit, uctxt->ctxt, fd->subctxt, info.comp_idx); - ret = -EINVAL; - goto done; + return -EINVAL; } /* * We've done all the safety checks that we can up to this point, @@ -550,8 +546,7 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec, if (!info.npkts || req->data_iovs > MAX_VECTORS_PER_REQ) { SDMA_DBG(req, "Too many vectors (%u/%u)", req->data_iovs, MAX_VECTORS_PER_REQ); - ret = -EINVAL; - goto done; + return -EINVAL; } /* Copy the header from the user buffer */ ret = copy_from_user(&req->hdr, iovec[idx].iov_base + sizeof(info), @@ -774,10 +769,8 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) struct hfi1_user_sdma_pkt_q *pq = NULL; struct user_sdma_iovec *iovec = NULL; - if (!req->pq) { - ret = -EINVAL; - goto done; - } + if (!req->pq) + return -EINVAL; pq = req->pq; @@ -787,7 +780,7 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) if (unlikely(req->seqnum == req->info.npkts)) { if (!list_empty(&req->txps)) goto dosend; - goto done; + return ret; } if (!maxpkts || maxpkts > req->info.npkts - req->seqnum) @@ -804,15 +797,13 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) */ if (test_bit(SDMA_REQ_HAS_ERROR, &req->flags)) { set_bit(SDMA_REQ_DONE_ERROR, &req->flags); - ret = -EFAULT; - goto done; + return -EFAULT; } tx = kmem_cache_alloc(pq->txreq_cache, GFP_KERNEL); - if (!tx) { - ret = -ENOMEM; - goto done; - } + if (!tx) + return -ENOMEM; + tx->flags = 0; tx->req = req; tx->busycount = 0; @@ -1013,12 +1004,12 @@ dosend: if (test_bit(SDMA_REQ_HAVE_AHG, &req->flags)) sdma_ahg_free(req->sde, req->ahg_idx); } - goto done; + return ret; + free_txreq: sdma_txclean(pq->dd, &tx->txreq); free_tx: kmem_cache_free(pq->txreq_cache, tx); -done: return ret; } From 6a5464f2248594bcf92bd05beb341650f9e0f357 Mon Sep 17 00:00:00 2001 From: Mitko Haralanov Date: Tue, 8 Dec 2015 17:10:12 -0500 Subject: [PATCH 730/843] staging/rdma/hfi1: Detect SDMA transmission error early It is possible for an SDMA transmission error to happen during the processing of an user SDMA transfer. In that case it is better to detect it early and abort any further attempts to send more packets. Reviewed-by: Ira Weiny Signed-off-by: Mitko Haralanov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/user_sdma.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/staging/rdma/hfi1/user_sdma.c b/drivers/staging/rdma/hfi1/user_sdma.c index d03c810b6206..d3de771a0770 100644 --- a/drivers/staging/rdma/hfi1/user_sdma.c +++ b/drivers/staging/rdma/hfi1/user_sdma.c @@ -774,6 +774,12 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) pq = req->pq; + /* If tx completion has reported an error, we are done. */ + if (test_bit(SDMA_REQ_HAS_ERROR, &req->flags)) { + set_bit(SDMA_REQ_DONE_ERROR, &req->flags); + return -EFAULT; + } + /* * Check if we might have sent the entire request already */ From e607a2213a962d2ff7ca77f6a30e72096f0b9341 Mon Sep 17 00:00:00 2001 From: Mike Marciniszyn Date: Thu, 3 Dec 2015 14:34:18 -0500 Subject: [PATCH 731/843] staging/rdma/hfi1: fix pio progress routine race with allocator The allocation code assumes that the shadow ring cannot be overrun because the credits will limit the allocation. Unfortuately, the progress mechanism in sc_release_update() updates the free count prior to processing the shadow ring, allowing the shadow ring to be overrun by an allocation. Reviewed-by: Mark Debbage Signed-off-by: Mike Marciniszyn Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/pio.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rdma/hfi1/pio.c b/drivers/staging/rdma/hfi1/pio.c index eab58c12d915..8e10857d5b7d 100644 --- a/drivers/staging/rdma/hfi1/pio.c +++ b/drivers/staging/rdma/hfi1/pio.c @@ -1565,6 +1565,7 @@ void sc_release_update(struct send_context *sc) u64 hw_free; u32 head, tail; unsigned long old_free; + unsigned long free; unsigned long extra; unsigned long flags; int code; @@ -1579,7 +1580,7 @@ void sc_release_update(struct send_context *sc) extra = (((hw_free & CR_COUNTER_SMASK) >> CR_COUNTER_SHIFT) - (old_free & CR_COUNTER_MASK)) & CR_COUNTER_MASK; - sc->free = old_free + extra; + free = old_free + extra; trace_hfi1_piofree(sc, extra); /* call sent buffer callbacks */ @@ -1589,7 +1590,7 @@ void sc_release_update(struct send_context *sc) while (head != tail) { pbuf = &sc->sr[tail].pbuf; - if (sent_before(sc->free, pbuf->sent_at)) { + if (sent_before(free, pbuf->sent_at)) { /* not sent yet */ break; } @@ -1603,8 +1604,10 @@ void sc_release_update(struct send_context *sc) if (tail >= sc->sr_size) tail = 0; } - /* update tail, in case we moved it */ sc->sr_tail = tail; + /* make sure tail is updated before free */ + smp_wmb(); + sc->free = free; spin_unlock_irqrestore(&sc->release_lock, flags); sc_piobufavail(sc); } From a5a9e8ccab4d24c7d9e1da8222f373688745ca6a Mon Sep 17 00:00:00 2001 From: Mike Marciniszyn Date: Thu, 3 Dec 2015 16:41:05 -0500 Subject: [PATCH 732/843] staging/rdma/hfi1: fix sdma build failures to always clean up There are holes in the sdma build support routines that do not clean any partially built sdma descriptors after mapping or allocate failures. This patch corrects these issues. Reviewed-by: Dennis Dalessandro Signed-off-by: Mike Marciniszyn Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/sdma.c | 10 ++++++---- drivers/staging/rdma/hfi1/sdma.h | 7 +++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rdma/hfi1/sdma.c b/drivers/staging/rdma/hfi1/sdma.c index 0710e2ab767c..9a15f1f32b45 100644 --- a/drivers/staging/rdma/hfi1/sdma.c +++ b/drivers/staging/rdma/hfi1/sdma.c @@ -2731,22 +2731,21 @@ static int _extend_sdma_tx_descs(struct hfi1_devdata *dd, struct sdma_txreq *tx) tx->coalesce_buf = kmalloc(tx->tlen + sizeof(u32), GFP_ATOMIC); if (!tx->coalesce_buf) - return -ENOMEM; - + goto enomem; tx->coalesce_idx = 0; } return 0; } if (unlikely(tx->num_desc == MAX_DESC)) - return -ENOMEM; + goto enomem; tx->descp = kmalloc_array( MAX_DESC, sizeof(struct sdma_desc), GFP_ATOMIC); if (!tx->descp) - return -ENOMEM; + goto enomem; /* reserve last descriptor for coalescing */ tx->desc_limit = MAX_DESC - 1; @@ -2754,6 +2753,9 @@ static int _extend_sdma_tx_descs(struct hfi1_devdata *dd, struct sdma_txreq *tx) for (i = 0; i < tx->num_desc; i++) tx->descp[i] = tx->descs[i]; return 0; +enomem: + sdma_txclean(dd, tx); + return -ENOMEM; } /* diff --git a/drivers/staging/rdma/hfi1/sdma.h b/drivers/staging/rdma/hfi1/sdma.h index 85701eed1585..da89e6458162 100644 --- a/drivers/staging/rdma/hfi1/sdma.h +++ b/drivers/staging/rdma/hfi1/sdma.h @@ -774,10 +774,13 @@ static inline int _sdma_txadd_daddr( tx->tlen -= len; /* special cases for last */ if (!tx->tlen) { - if (tx->packet_len & (sizeof(u32) - 1)) + if (tx->packet_len & (sizeof(u32) - 1)) { rval = _pad_sdma_tx_descs(dd, tx); - else + if (rval) + return rval; + } else { _sdma_close_tx(dd, tx); + } } tx->num_desc++; return rval; From a054374f15428cbc1d9cb9cba17ce870eaa7d60f Mon Sep 17 00:00:00 2001 From: Mike Marciniszyn Date: Mon, 7 Dec 2015 15:39:22 -0500 Subject: [PATCH 733/843] staging/rdma/hfi1: convert buffers allocated atomic to per cpu Profiling has shown the the atomic is a performance issue for the pio hot path. If multiple cpus allocated an sc's buffer, the cacheline containing the atomic will bounce from L0 to L0. Convert the atomic to a percpu variable. Reviewed-by: Jubin John Signed-off-by: Mike Marciniszyn Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/pio.c | 40 ++++++++++++++++++++++++---- drivers/staging/rdma/hfi1/pio.h | 2 +- drivers/staging/rdma/hfi1/pio_copy.c | 6 +++-- 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rdma/hfi1/pio.c b/drivers/staging/rdma/hfi1/pio.c index 8e10857d5b7d..b51a4416312b 100644 --- a/drivers/staging/rdma/hfi1/pio.c +++ b/drivers/staging/rdma/hfi1/pio.c @@ -660,6 +660,24 @@ void set_pio_integrity(struct send_context *sc) write_kctxt_csr(dd, hw_context, SC(CHECK_ENABLE), reg); } +static u32 get_buffers_allocated(struct send_context *sc) +{ + int cpu; + u32 ret = 0; + + for_each_possible_cpu(cpu) + ret += *per_cpu_ptr(sc->buffers_allocated, cpu); + return ret; +} + +static void reset_buffers_allocated(struct send_context *sc) +{ + int cpu; + + for_each_possible_cpu(cpu) + (*per_cpu_ptr(sc->buffers_allocated, cpu)) = 0; +} + /* * Allocate a NUMA relative send context structure of the given type along * with a HW context. @@ -668,7 +686,7 @@ struct send_context *sc_alloc(struct hfi1_devdata *dd, int type, uint hdrqentsize, int numa) { struct send_context_info *sci; - struct send_context *sc; + struct send_context *sc = NULL; dma_addr_t pa; unsigned long flags; u64 reg; @@ -686,10 +704,20 @@ struct send_context *sc_alloc(struct hfi1_devdata *dd, int type, if (!sc) return NULL; + sc->buffers_allocated = alloc_percpu(u32); + if (!sc->buffers_allocated) { + kfree(sc); + dd_dev_err(dd, + "Cannot allocate buffers_allocated per cpu counters\n" + ); + return NULL; + } + spin_lock_irqsave(&dd->sc_lock, flags); ret = sc_hw_alloc(dd, type, &sw_index, &hw_context); if (ret) { spin_unlock_irqrestore(&dd->sc_lock, flags); + free_percpu(sc->buffers_allocated); kfree(sc); return NULL; } @@ -705,7 +733,6 @@ struct send_context *sc_alloc(struct hfi1_devdata *dd, int type, spin_lock_init(&sc->credit_ctrl_lock); INIT_LIST_HEAD(&sc->piowait); INIT_WORK(&sc->halt_work, sc_halted); - atomic_set(&sc->buffers_allocated, 0); init_waitqueue_head(&sc->halt_wait); /* grouping is always single context for now */ @@ -866,6 +893,7 @@ void sc_free(struct send_context *sc) spin_unlock_irqrestore(&dd->sc_lock, flags); kfree(sc->sr); + free_percpu(sc->buffers_allocated); kfree(sc); } @@ -1029,7 +1057,7 @@ int sc_restart(struct send_context *sc) /* kernel context */ loop = 0; while (1) { - count = atomic_read(&sc->buffers_allocated); + count = get_buffers_allocated(sc); if (count == 0) break; if (loop > 100) { @@ -1197,7 +1225,8 @@ int sc_enable(struct send_context *sc) sc->sr_head = 0; sc->sr_tail = 0; sc->flags = 0; - atomic_set(&sc->buffers_allocated, 0); + /* the alloc lock insures no fast path allocation */ + reset_buffers_allocated(sc); /* * Clear all per-context errors. Some of these will be set when @@ -1373,7 +1402,8 @@ retry: /* there is enough room */ - atomic_inc(&sc->buffers_allocated); + preempt_disable(); + this_cpu_inc(*sc->buffers_allocated); /* read this once */ head = sc->sr_head; diff --git a/drivers/staging/rdma/hfi1/pio.h b/drivers/staging/rdma/hfi1/pio.h index 0bb885ca3cfb..53d3e0a79375 100644 --- a/drivers/staging/rdma/hfi1/pio.h +++ b/drivers/staging/rdma/hfi1/pio.h @@ -130,7 +130,7 @@ struct send_context { spinlock_t credit_ctrl_lock ____cacheline_aligned_in_smp; u64 credit_ctrl; /* cache for credit control */ u32 credit_intr_count; /* count of credit intr users */ - atomic_t buffers_allocated; /* count of buffers allocated */ + u32 __percpu *buffers_allocated;/* count of buffers allocated */ wait_queue_head_t halt_wait; /* wait until kernel sees interrupt */ }; diff --git a/drivers/staging/rdma/hfi1/pio_copy.c b/drivers/staging/rdma/hfi1/pio_copy.c index 8972bbc02038..ebb0bafc68cb 100644 --- a/drivers/staging/rdma/hfi1/pio_copy.c +++ b/drivers/staging/rdma/hfi1/pio_copy.c @@ -160,7 +160,8 @@ void pio_copy(struct hfi1_devdata *dd, struct pio_buf *pbuf, u64 pbc, } /* finished with this buffer */ - atomic_dec(&pbuf->sc->buffers_allocated); + this_cpu_dec(*pbuf->sc->buffers_allocated); + preempt_enable(); } /* USE_SHIFTS is faster in user-space tests on a Xeon X5570 @ 2.93GHz */ @@ -854,5 +855,6 @@ void seg_pio_copy_end(struct pio_buf *pbuf) } /* finished with this buffer */ - atomic_dec(&pbuf->sc->buffers_allocated); + this_cpu_dec(*pbuf->sc->buffers_allocated); + preempt_enable(); } From 7438370a5150d6090957ab3e461d5b3a31f2181a Mon Sep 17 00:00:00 2001 From: Yash Shah Date: Tue, 8 Dec 2015 10:24:17 +0000 Subject: [PATCH 734/843] Staging: rdma:Delete unnecessary NULL check before calling function "kmem_cache_destroy" The kmem_cache_destroy() function tests whether its argument is NULL and then returns immediately. Thus the NULL check before calling this function is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Yash Shah Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/ehca/ehca_av.c | 3 +-- drivers/staging/rdma/ehca/ehca_cq.c | 3 +-- drivers/staging/rdma/ehca/ehca_main.c | 3 +-- drivers/staging/rdma/ehca/ehca_mrmw.c | 6 ++---- drivers/staging/rdma/ehca/ehca_pd.c | 3 +-- drivers/staging/rdma/ehca/ehca_qp.c | 3 +-- 6 files changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/staging/rdma/ehca/ehca_av.c b/drivers/staging/rdma/ehca/ehca_av.c index fd7b6d044ec1..94e088c2d989 100644 --- a/drivers/staging/rdma/ehca/ehca_av.c +++ b/drivers/staging/rdma/ehca/ehca_av.c @@ -275,6 +275,5 @@ int ehca_init_av_cache(void) void ehca_cleanup_av_cache(void) { - if (av_cache) - kmem_cache_destroy(av_cache); + kmem_cache_destroy(av_cache); } diff --git a/drivers/staging/rdma/ehca/ehca_cq.c b/drivers/staging/rdma/ehca/ehca_cq.c index ea1b5c1203b4..1aa7931fe860 100644 --- a/drivers/staging/rdma/ehca/ehca_cq.c +++ b/drivers/staging/rdma/ehca/ehca_cq.c @@ -393,6 +393,5 @@ int ehca_init_cq_cache(void) void ehca_cleanup_cq_cache(void) { - if (cq_cache) - kmem_cache_destroy(cq_cache); + kmem_cache_destroy(cq_cache); } diff --git a/drivers/staging/rdma/ehca/ehca_main.c b/drivers/staging/rdma/ehca/ehca_main.c index 8246418cd4e0..860b974e9faa 100644 --- a/drivers/staging/rdma/ehca/ehca_main.c +++ b/drivers/staging/rdma/ehca/ehca_main.c @@ -245,8 +245,7 @@ static void ehca_destroy_slab_caches(void) ehca_cleanup_cq_cache(); ehca_cleanup_pd_cache(); #ifdef CONFIG_PPC_64K_PAGES - if (ctblk_cache) - kmem_cache_destroy(ctblk_cache); + kmem_cache_destroy(ctblk_cache); #endif } diff --git a/drivers/staging/rdma/ehca/ehca_mrmw.c b/drivers/staging/rdma/ehca/ehca_mrmw.c index f914b30999f8..553e883a5718 100644 --- a/drivers/staging/rdma/ehca/ehca_mrmw.c +++ b/drivers/staging/rdma/ehca/ehca_mrmw.c @@ -2251,10 +2251,8 @@ int ehca_init_mrmw_cache(void) void ehca_cleanup_mrmw_cache(void) { - if (mr_cache) - kmem_cache_destroy(mr_cache); - if (mw_cache) - kmem_cache_destroy(mw_cache); + kmem_cache_destroy(mr_cache); + kmem_cache_destroy(mw_cache); } static inline int ehca_init_top_bmap(struct ehca_top_bmap *ehca_top_bmap, diff --git a/drivers/staging/rdma/ehca/ehca_pd.c b/drivers/staging/rdma/ehca/ehca_pd.c index 351577a6670a..2a8aae411941 100644 --- a/drivers/staging/rdma/ehca/ehca_pd.c +++ b/drivers/staging/rdma/ehca/ehca_pd.c @@ -119,6 +119,5 @@ int ehca_init_pd_cache(void) void ehca_cleanup_pd_cache(void) { - if (pd_cache) - kmem_cache_destroy(pd_cache); + kmem_cache_destroy(pd_cache); } diff --git a/drivers/staging/rdma/ehca/ehca_qp.c b/drivers/staging/rdma/ehca/ehca_qp.c index 2e89356c46fa..896c01f810f6 100644 --- a/drivers/staging/rdma/ehca/ehca_qp.c +++ b/drivers/staging/rdma/ehca/ehca_qp.c @@ -2252,6 +2252,5 @@ int ehca_init_qp_cache(void) void ehca_cleanup_qp_cache(void) { - if (qp_cache) - kmem_cache_destroy(qp_cache); + kmem_cache_destroy(qp_cache); } From 71a1d624f97acbf2dea889c5c5d8c59b3afc2526 Mon Sep 17 00:00:00 2001 From: Jubin John Date: Thu, 10 Dec 2015 09:59:34 -0500 Subject: [PATCH 735/843] staging/rdma/hfi1: add definitions for OPA traps These new definitions will be used by follow-on patches for formating and sending OPA traps. Reviewed-by: Ira Weiny Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/mad.h | 114 ++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) diff --git a/drivers/staging/rdma/hfi1/mad.h b/drivers/staging/rdma/hfi1/mad.h index 47457501c044..f0317750e2fc 100644 --- a/drivers/staging/rdma/hfi1/mad.h +++ b/drivers/staging/rdma/hfi1/mad.h @@ -60,7 +60,121 @@ #endif #include "opa_compat.h" +/* + * OPA Traps + */ +#define OPA_TRAP_GID_NOW_IN_SERVICE cpu_to_be16(64) +#define OPA_TRAP_GID_OUT_OF_SERVICE cpu_to_be16(65) +#define OPA_TRAP_ADD_MULTICAST_GROUP cpu_to_be16(66) +#define OPA_TRAL_DEL_MULTICAST_GROUP cpu_to_be16(67) +#define OPA_TRAP_UNPATH cpu_to_be16(68) +#define OPA_TRAP_REPATH cpu_to_be16(69) +#define OPA_TRAP_PORT_CHANGE_STATE cpu_to_be16(128) +#define OPA_TRAP_LINK_INTEGRITY cpu_to_be16(129) +#define OPA_TRAP_EXCESSIVE_BUFFER_OVERRUN cpu_to_be16(130) +#define OPA_TRAP_FLOW_WATCHDOG cpu_to_be16(131) +#define OPA_TRAP_CHANGE_CAPABILITY cpu_to_be16(144) +#define OPA_TRAP_CHANGE_SYSGUID cpu_to_be16(145) +#define OPA_TRAP_BAD_M_KEY cpu_to_be16(256) +#define OPA_TRAP_BAD_P_KEY cpu_to_be16(257) +#define OPA_TRAP_BAD_Q_KEY cpu_to_be16(258) +#define OPA_TRAP_SWITCH_BAD_PKEY cpu_to_be16(259) +#define OPA_SMA_TRAP_DATA_LINK_WIDTH cpu_to_be16(2048) +/* + * Generic trap/notice other local changes flags (trap 144). + */ +#define OPA_NOTICE_TRAP_LWDE_CHG 0x08 /* Link Width Downgrade Enable + * changed + */ +#define OPA_NOTICE_TRAP_LSE_CHG 0x04 /* Link Speed Enable changed */ +#define OPA_NOTICE_TRAP_LWE_CHG 0x02 /* Link Width Enable changed */ +#define OPA_NOTICE_TRAP_NODE_DESC_CHG 0x01 + +struct opa_mad_notice_attr { + u8 generic_type; + u8 prod_type_msb; + __be16 prod_type_lsb; + __be16 trap_num; + __be16 toggle_count; + __be32 issuer_lid; + __be32 reserved1; + union ib_gid issuer_gid; + + union { + struct { + u8 details[64]; + } raw_data; + + struct { + union ib_gid gid; + } __packed ntc_64_65_66_67; + + struct { + __be32 lid; + } __packed ntc_128; + + struct { + __be32 lid; /* where violation happened */ + u8 port_num; /* where violation happened */ + } __packed ntc_129_130_131; + + struct { + __be32 lid; /* LID where change occurred */ + __be32 new_cap_mask; /* new capability mask */ + __be16 reserved2; + __be16 cap_mask; + __be16 change_flags; /* low 4 bits only */ + } __packed ntc_144; + + struct { + __be64 new_sys_guid; + __be32 lid; /* lid where sys guid changed */ + } __packed ntc_145; + + struct { + __be32 lid; + __be32 dr_slid; + u8 method; + u8 dr_trunc_hop; + __be16 attr_id; + __be32 attr_mod; + __be64 mkey; + u8 dr_rtn_path[30]; + } __packed ntc_256; + + struct { + __be32 lid1; + __be32 lid2; + __be32 key; + u8 sl; /* SL: high 5 bits */ + u8 reserved3[3]; + union ib_gid gid1; + union ib_gid gid2; + __be32 qp1; /* high 8 bits reserved */ + __be32 qp2; /* high 8 bits reserved */ + } __packed ntc_257_258; + + struct { + __be16 flags; /* low 8 bits reserved */ + __be16 pkey; + __be32 lid1; + __be32 lid2; + u8 sl; /* SL: high 5 bits */ + u8 reserved4[3]; + union ib_gid gid1; + union ib_gid gid2; + __be32 qp1; /* high 8 bits reserved */ + __be32 qp2; /* high 8 bits reserved */ + } __packed ntc_259; + + struct { + __be32 lid; + } __packed ntc_2048; + + }; + u8 class_data[0]; +}; #define IB_VLARB_LOWPRI_0_31 1 #define IB_VLARB_LOWPRI_32_63 2 From 5cd24119d437910d15c510218dcd32f57355a3d3 Mon Sep 17 00:00:00 2001 From: "Erik E. Kahn" Date: Thu, 10 Dec 2015 09:59:40 -0500 Subject: [PATCH 736/843] staging/rdma/hfi1: HFI now sends OPA Traps instead of IBTA send_trap() was still using old ib_smp instead of opa_smp for formatting and sending traps. Reviewed-by: Arthur Kepner Reviewed-by: Ira Weiny Reviewed-by: Dennis Dalessandro Signed-off-by: Jubin John Signed-off-by: Erik E. Kahn Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/mad.c | 121 +++++++++++++++--------------- drivers/staging/rdma/hfi1/ruc.c | 10 ++- drivers/staging/rdma/hfi1/ud.c | 21 +++--- drivers/staging/rdma/hfi1/verbs.h | 2 +- 4 files changed, 79 insertions(+), 75 deletions(-) diff --git a/drivers/staging/rdma/hfi1/mad.c b/drivers/staging/rdma/hfi1/mad.c index a785664371d0..4f5dbd14b5de 100644 --- a/drivers/staging/rdma/hfi1/mad.c +++ b/drivers/staging/rdma/hfi1/mad.c @@ -84,7 +84,7 @@ static void send_trap(struct hfi1_ibport *ibp, void *data, unsigned len) { struct ib_mad_send_buf *send_buf; struct ib_mad_agent *agent; - struct ib_smp *smp; + struct opa_smp *smp; int ret; unsigned long flags; unsigned long timeout; @@ -117,15 +117,15 @@ static void send_trap(struct hfi1_ibport *ibp, void *data, unsigned len) return; smp = send_buf->mad; - smp->base_version = IB_MGMT_BASE_VERSION; + smp->base_version = OPA_MGMT_BASE_VERSION; smp->mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED; - smp->class_version = 1; + smp->class_version = OPA_SMI_CLASS_VERSION; smp->method = IB_MGMT_METHOD_TRAP; ibp->tid++; smp->tid = cpu_to_be64(ibp->tid); smp->attr_id = IB_SMP_ATTR_NOTICE; /* o14-1: smp->mkey = 0; */ - memcpy(smp->data, data, len); + memcpy(smp->route.lid.data, data, len); spin_lock_irqsave(&ibp->lock, flags); if (!ibp->sm_ah) { @@ -164,11 +164,16 @@ static void send_trap(struct hfi1_ibport *ibp, void *data, unsigned len) * Send a bad [PQ]_Key trap (ch. 14.3.8). */ void hfi1_bad_pqkey(struct hfi1_ibport *ibp, __be16 trap_num, u32 key, u32 sl, - u32 qp1, u32 qp2, __be16 lid1, __be16 lid2) + u32 qp1, u32 qp2, u16 lid1, u16 lid2) { - struct ib_mad_notice_attr data; + struct opa_mad_notice_attr data; + u32 lid = ppd_from_ibp(ibp)->lid; + u32 _lid1 = lid1; + u32 _lid2 = lid2; - if (trap_num == IB_NOTICE_TRAP_BAD_PKEY) + memset(&data, 0, sizeof(data)); + + if (trap_num == OPA_TRAP_BAD_P_KEY) ibp->pkey_violations++; else ibp->qkey_violations++; @@ -176,17 +181,15 @@ void hfi1_bad_pqkey(struct hfi1_ibport *ibp, __be16 trap_num, u32 key, u32 sl, /* Send violation trap */ data.generic_type = IB_NOTICE_TYPE_SECURITY; - data.prod_type_msb = 0; data.prod_type_lsb = IB_NOTICE_PROD_CA; data.trap_num = trap_num; - data.issuer_lid = cpu_to_be16(ppd_from_ibp(ibp)->lid); - data.toggle_count = 0; - memset(&data.details, 0, sizeof(data.details)); - data.details.ntc_257_258.lid1 = lid1; - data.details.ntc_257_258.lid2 = lid2; - data.details.ntc_257_258.key = cpu_to_be32(key); - data.details.ntc_257_258.sl_qp1 = cpu_to_be32((sl << 28) | qp1); - data.details.ntc_257_258.qp2 = cpu_to_be32(qp2); + data.issuer_lid = cpu_to_be32(lid); + data.ntc_257_258.lid1 = cpu_to_be32(_lid1); + data.ntc_257_258.lid2 = cpu_to_be32(_lid2); + data.ntc_257_258.key = cpu_to_be32(key); + data.ntc_257_258.sl = sl << 3; + data.ntc_257_258.qp1 = cpu_to_be32(qp1); + data.ntc_257_258.qp2 = cpu_to_be32(qp2); send_trap(ibp, &data, sizeof(data)); } @@ -197,32 +200,30 @@ void hfi1_bad_pqkey(struct hfi1_ibport *ibp, __be16 trap_num, u32 key, u32 sl, static void bad_mkey(struct hfi1_ibport *ibp, struct ib_mad_hdr *mad, __be64 mkey, __be32 dr_slid, u8 return_path[], u8 hop_cnt) { - struct ib_mad_notice_attr data; + struct opa_mad_notice_attr data; + u32 lid = ppd_from_ibp(ibp)->lid; + memset(&data, 0, sizeof(data)); /* Send violation trap */ data.generic_type = IB_NOTICE_TYPE_SECURITY; - data.prod_type_msb = 0; data.prod_type_lsb = IB_NOTICE_PROD_CA; - data.trap_num = IB_NOTICE_TRAP_BAD_MKEY; - data.issuer_lid = cpu_to_be16(ppd_from_ibp(ibp)->lid); - data.toggle_count = 0; - memset(&data.details, 0, sizeof(data.details)); - data.details.ntc_256.lid = data.issuer_lid; - data.details.ntc_256.method = mad->method; - data.details.ntc_256.attr_id = mad->attr_id; - data.details.ntc_256.attr_mod = mad->attr_mod; - data.details.ntc_256.mkey = mkey; + data.trap_num = OPA_TRAP_BAD_M_KEY; + data.issuer_lid = cpu_to_be32(lid); + data.ntc_256.lid = data.issuer_lid; + data.ntc_256.method = mad->method; + data.ntc_256.attr_id = mad->attr_id; + data.ntc_256.attr_mod = mad->attr_mod; + data.ntc_256.mkey = mkey; if (mad->mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) { - - data.details.ntc_256.dr_slid = (__force __be16)dr_slid; - data.details.ntc_256.dr_trunc_hop = IB_NOTICE_TRAP_DR_NOTICE; - if (hop_cnt > ARRAY_SIZE(data.details.ntc_256.dr_rtn_path)) { - data.details.ntc_256.dr_trunc_hop |= + data.ntc_256.dr_slid = dr_slid; + data.ntc_256.dr_trunc_hop = IB_NOTICE_TRAP_DR_NOTICE; + if (hop_cnt > ARRAY_SIZE(data.ntc_256.dr_rtn_path)) { + data.ntc_256.dr_trunc_hop |= IB_NOTICE_TRAP_DR_TRUNC; - hop_cnt = ARRAY_SIZE(data.details.ntc_256.dr_rtn_path); + hop_cnt = ARRAY_SIZE(data.ntc_256.dr_rtn_path); } - data.details.ntc_256.dr_trunc_hop |= hop_cnt; - memcpy(data.details.ntc_256.dr_rtn_path, return_path, + data.ntc_256.dr_trunc_hop |= hop_cnt; + memcpy(data.ntc_256.dr_rtn_path, return_path, hop_cnt); } @@ -234,17 +235,17 @@ static void bad_mkey(struct hfi1_ibport *ibp, struct ib_mad_hdr *mad, */ void hfi1_cap_mask_chg(struct hfi1_ibport *ibp) { - struct ib_mad_notice_attr data; + struct opa_mad_notice_attr data; + u32 lid = ppd_from_ibp(ibp)->lid; + + memset(&data, 0, sizeof(data)); data.generic_type = IB_NOTICE_TYPE_INFO; - data.prod_type_msb = 0; data.prod_type_lsb = IB_NOTICE_PROD_CA; - data.trap_num = IB_NOTICE_TRAP_CAP_MASK_CHG; - data.issuer_lid = cpu_to_be16(ppd_from_ibp(ibp)->lid); - data.toggle_count = 0; - memset(&data.details, 0, sizeof(data.details)); - data.details.ntc_144.lid = data.issuer_lid; - data.details.ntc_144.new_cap_mask = cpu_to_be32(ibp->port_cap_flags); + data.trap_num = OPA_TRAP_CHANGE_CAPABILITY; + data.issuer_lid = cpu_to_be32(lid); + data.ntc_144.lid = data.issuer_lid; + data.ntc_144.new_cap_mask = cpu_to_be32(ibp->port_cap_flags); send_trap(ibp, &data, sizeof(data)); } @@ -254,17 +255,17 @@ void hfi1_cap_mask_chg(struct hfi1_ibport *ibp) */ void hfi1_sys_guid_chg(struct hfi1_ibport *ibp) { - struct ib_mad_notice_attr data; + struct opa_mad_notice_attr data; + u32 lid = ppd_from_ibp(ibp)->lid; + + memset(&data, 0, sizeof(data)); data.generic_type = IB_NOTICE_TYPE_INFO; - data.prod_type_msb = 0; data.prod_type_lsb = IB_NOTICE_PROD_CA; - data.trap_num = IB_NOTICE_TRAP_SYS_GUID_CHG; - data.issuer_lid = cpu_to_be16(ppd_from_ibp(ibp)->lid); - data.toggle_count = 0; - memset(&data.details, 0, sizeof(data.details)); - data.details.ntc_145.lid = data.issuer_lid; - data.details.ntc_145.new_sys_guid = ib_hfi1_sys_image_guid; + data.trap_num = OPA_TRAP_CHANGE_SYSGUID; + data.issuer_lid = cpu_to_be32(lid); + data.ntc_145.new_sys_guid = ib_hfi1_sys_image_guid; + data.ntc_145.lid = data.issuer_lid; send_trap(ibp, &data, sizeof(data)); } @@ -274,18 +275,18 @@ void hfi1_sys_guid_chg(struct hfi1_ibport *ibp) */ void hfi1_node_desc_chg(struct hfi1_ibport *ibp) { - struct ib_mad_notice_attr data; + struct opa_mad_notice_attr data; + u32 lid = ppd_from_ibp(ibp)->lid; + + memset(&data, 0, sizeof(data)); data.generic_type = IB_NOTICE_TYPE_INFO; - data.prod_type_msb = 0; data.prod_type_lsb = IB_NOTICE_PROD_CA; - data.trap_num = IB_NOTICE_TRAP_CAP_MASK_CHG; - data.issuer_lid = cpu_to_be16(ppd_from_ibp(ibp)->lid); - data.toggle_count = 0; - memset(&data.details, 0, sizeof(data.details)); - data.details.ntc_144.lid = data.issuer_lid; - data.details.ntc_144.local_changes = 1; - data.details.ntc_144.change_flags = IB_NOTICE_TRAP_NODE_DESC_CHG; + data.trap_num = OPA_TRAP_CHANGE_CAPABILITY; + data.issuer_lid = cpu_to_be32(lid); + data.ntc_144.lid = data.issuer_lid; + data.ntc_144.change_flags = + cpu_to_be16(OPA_NOTICE_TRAP_NODE_DESC_CHG); send_trap(ibp, &data, sizeof(data)); } diff --git a/drivers/staging/rdma/hfi1/ruc.c b/drivers/staging/rdma/hfi1/ruc.c index 317bf6ff46a8..4a91975b68d7 100644 --- a/drivers/staging/rdma/hfi1/ruc.c +++ b/drivers/staging/rdma/hfi1/ruc.c @@ -288,11 +288,12 @@ int hfi1_ruc_check_hdr(struct hfi1_ibport *ibp, struct hfi1_ib_header *hdr, } if (unlikely(rcv_pkey_check(ppd_from_ibp(ibp), (u16)bth0, sc5, be16_to_cpu(hdr->lrh[3])))) { - hfi1_bad_pqkey(ibp, IB_NOTICE_TRAP_BAD_PKEY, + hfi1_bad_pqkey(ibp, OPA_TRAP_BAD_P_KEY, (u16)bth0, (be16_to_cpu(hdr->lrh[0]) >> 4) & 0xF, 0, qp->ibqp.qp_num, - hdr->lrh[3], hdr->lrh[1]); + be16_to_cpu(hdr->lrh[3]), + be16_to_cpu(hdr->lrh[1])); goto err; } /* Validate the SLID. See Ch. 9.6.1.5 and 17.2.8 */ @@ -320,11 +321,12 @@ int hfi1_ruc_check_hdr(struct hfi1_ibport *ibp, struct hfi1_ib_header *hdr, } if (unlikely(rcv_pkey_check(ppd_from_ibp(ibp), (u16)bth0, sc5, be16_to_cpu(hdr->lrh[3])))) { - hfi1_bad_pqkey(ibp, IB_NOTICE_TRAP_BAD_PKEY, + hfi1_bad_pqkey(ibp, OPA_TRAP_BAD_P_KEY, (u16)bth0, (be16_to_cpu(hdr->lrh[0]) >> 4) & 0xF, 0, qp->ibqp.qp_num, - hdr->lrh[3], hdr->lrh[1]); + be16_to_cpu(hdr->lrh[3]), + be16_to_cpu(hdr->lrh[1])); goto err; } /* Validate the SLID. See Ch. 9.6.1.5 */ diff --git a/drivers/staging/rdma/hfi1/ud.c b/drivers/staging/rdma/hfi1/ud.c index 54ff1f5416d4..bd1b402c1e14 100644 --- a/drivers/staging/rdma/hfi1/ud.c +++ b/drivers/staging/rdma/hfi1/ud.c @@ -111,11 +111,10 @@ static void ud_loopback(struct hfi1_qp *sqp, struct hfi1_swqe *swqe) ((1 << ppd->lmc) - 1)); if (unlikely(ingress_pkey_check(ppd, pkey, sc5, qp->s_pkey_index, slid))) { - hfi1_bad_pqkey(ibp, IB_NOTICE_TRAP_BAD_PKEY, pkey, + hfi1_bad_pqkey(ibp, OPA_TRAP_BAD_P_KEY, pkey, ah_attr->sl, sqp->ibqp.qp_num, qp->ibqp.qp_num, - cpu_to_be16(slid), - cpu_to_be16(ah_attr->dlid)); + slid, ah_attr->dlid); goto drop; } } @@ -135,11 +134,11 @@ static void ud_loopback(struct hfi1_qp *sqp, struct hfi1_swqe *swqe) lid = ppd->lid | (ah_attr->src_path_bits & ((1 << ppd->lmc) - 1)); - hfi1_bad_pqkey(ibp, IB_NOTICE_TRAP_BAD_QKEY, qkey, + hfi1_bad_pqkey(ibp, OPA_TRAP_BAD_Q_KEY, qkey, ah_attr->sl, sqp->ibqp.qp_num, qp->ibqp.qp_num, - cpu_to_be16(lid), - cpu_to_be16(ah_attr->dlid)); + lid, + ah_attr->dlid); goto drop; } } @@ -737,12 +736,13 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) * for invalid pkeys is optional according to * IB spec (release 1.3, section 10.9.4) */ - hfi1_bad_pqkey(ibp, IB_NOTICE_TRAP_BAD_PKEY, + hfi1_bad_pqkey(ibp, OPA_TRAP_BAD_P_KEY, pkey, (be16_to_cpu(hdr->lrh[0]) >> 4) & 0xF, src_qp, qp->ibqp.qp_num, - hdr->lrh[3], hdr->lrh[1]); + be16_to_cpu(hdr->lrh[3]), + be16_to_cpu(hdr->lrh[1])); return; } } else { @@ -753,10 +753,11 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) } if (unlikely(qkey != qp->qkey)) { - hfi1_bad_pqkey(ibp, IB_NOTICE_TRAP_BAD_QKEY, qkey, + hfi1_bad_pqkey(ibp, OPA_TRAP_BAD_Q_KEY, qkey, (be16_to_cpu(hdr->lrh[0]) >> 4) & 0xF, src_qp, qp->ibqp.qp_num, - hdr->lrh[3], hdr->lrh[1]); + be16_to_cpu(hdr->lrh[3]), + be16_to_cpu(hdr->lrh[1])); return; } /* Drop invalid MAD packets (see 13.5.3.1). */ diff --git a/drivers/staging/rdma/hfi1/verbs.h b/drivers/staging/rdma/hfi1/verbs.h index 7e27531c430a..72106e5362b9 100644 --- a/drivers/staging/rdma/hfi1/verbs.h +++ b/drivers/staging/rdma/hfi1/verbs.h @@ -861,7 +861,7 @@ static inline int hfi1_send_ok(struct hfi1_qp *qp) * This must be called with s_lock held. */ void hfi1_bad_pqkey(struct hfi1_ibport *ibp, __be16 trap_num, u32 key, u32 sl, - u32 qp1, u32 qp2, __be16 lid1, __be16 lid2); + u32 qp1, u32 qp2, u16 lid1, u16 lid2); void hfi1_cap_mask_chg(struct hfi1_ibport *ibp); void hfi1_sys_guid_chg(struct hfi1_ibport *ibp); void hfi1_node_desc_chg(struct hfi1_ibport *ibp); From 859bcad9c2c5487dd74d4cfbdcbdd6c63a0ca955 Mon Sep 17 00:00:00 2001 From: Easwar Hariharan Date: Thu, 10 Dec 2015 11:13:38 -0500 Subject: [PATCH 737/843] staging/rdma/hfi1: Fix a possible null pointer dereference A code inspection pointed out that kmalloc_array may return NULL and memset doesn't check the input pointer for NULL, resulting in a possible NULL dereference. This patch fixes this. Reviewed-by: Mike Marciniszyn Signed-off-by: Easwar Hariharan Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/chip.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index d88945a80250..371f13fec68d 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -13358,6 +13358,8 @@ static void init_qos(struct hfi1_devdata *dd, u32 first_ctxt) if (num_vls * qpns_per_vl > dd->chip_rcv_contexts) goto bail; rsmmap = kmalloc_array(NUM_MAP_REGS, sizeof(u64), GFP_KERNEL); + if (!rsmmap) + goto bail; memset(rsmmap, rxcontext, NUM_MAP_REGS * sizeof(u64)); /* init the local copy of the table */ for (i = 0, ctxt = first_ctxt; i < num_vls; i++) { From 07859def5de0d909334a2e45e5e428f393e8cc9e Mon Sep 17 00:00:00 2001 From: Sebastian Sanchez Date: Thu, 10 Dec 2015 16:02:49 -0500 Subject: [PATCH 738/843] staging/rdma/hfi1: Fix for module parameter hdrq_entsize when it's 0 If driver is loaded with parameter hdrq_entsize=0, then there's a NULL dereference when the driver gets unloaded. This causes a kernel Oops and prevents the module from being unloaded. This patch fixes this issue by making sure -EINVAL gets returned when hdrq_entsize=0. Reviewed-by: Chegondi, Harish Reviewed-by: Haralanov, Mitko Signed-off-by: Sebastian Sanchez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/init.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/rdma/hfi1/init.c b/drivers/staging/rdma/hfi1/init.c index 2d52f91c03dc..467ff26bcab0 100644 --- a/drivers/staging/rdma/hfi1/init.c +++ b/drivers/staging/rdma/hfi1/init.c @@ -1351,6 +1351,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) if (!encode_rcv_header_entry_size(hfi1_hdrq_entsize)) { hfi1_early_err(&pdev->dev, "Invalid HdrQ Entry size %u\n", hfi1_hdrq_entsize); + ret = -EINVAL; goto bail; } From 2ce6bf2292742e0a4e71f08717ce314ce6332151 Mon Sep 17 00:00:00 2001 From: Sebastian Sanchez Date: Fri, 11 Dec 2015 08:44:48 -0500 Subject: [PATCH 739/843] staging/rdma/hfi1: Change num_rcv_contexts to num_user_contexts and its meaning num_rcv_contexts sets the number of user contexts, both receive and send. Renaming it to num_user_contexts makes sense to reflect its true meaning. When num_rcv_contexts is 0, the default behavior is the number of CPU cores instead of 0 contexts. This commit changes the variable num_rcv_contexts to num_user_contexts, and it also makes any negative value for this variable default to the number of CPU cores, so if num_user_contexts is set >= 0, the value will number of contexts. Reviewed-by: Mike Marciniszyn Signed-off-by: Sebastian Sanchez Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/chip.c | 9 +++------ drivers/staging/rdma/hfi1/hfi.h | 2 +- drivers/staging/rdma/hfi1/init.c | 6 +++--- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index 371f13fec68d..ec4bac00dbda 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -12426,7 +12426,6 @@ fail: static int set_up_context_variables(struct hfi1_devdata *dd) { int num_kernel_contexts; - int num_user_contexts; int total_contexts; int ret; unsigned ngroups; @@ -12463,12 +12462,10 @@ static int set_up_context_variables(struct hfi1_devdata *dd) } /* * User contexts: (to be fixed later) - * - set to num_rcv_contexts if non-zero - * - default to 1 user context per CPU + * - default to 1 user context per CPU if num_user_contexts is + * negative */ - if (num_rcv_contexts) - num_user_contexts = num_rcv_contexts; - else + if (num_user_contexts < 0) num_user_contexts = num_online_cpus(); total_contexts = num_kernel_contexts + num_user_contexts; diff --git a/drivers/staging/rdma/hfi1/hfi.h b/drivers/staging/rdma/hfi1/hfi.h index 7aea874b3dfc..2611bb2e764d 100644 --- a/drivers/staging/rdma/hfi1/hfi.h +++ b/drivers/staging/rdma/hfi1/hfi.h @@ -1665,7 +1665,7 @@ void update_sge(struct hfi1_sge_state *ss, u32 length); extern unsigned int hfi1_max_mtu; extern unsigned int hfi1_cu; extern unsigned int user_credit_return_threshold; -extern uint num_rcv_contexts; +extern int num_user_contexts; extern unsigned n_krcvqs; extern u8 krcvqs[]; extern int krcvqsset; diff --git a/drivers/staging/rdma/hfi1/init.c b/drivers/staging/rdma/hfi1/init.c index 467ff26bcab0..7ad9eb182514 100644 --- a/drivers/staging/rdma/hfi1/init.c +++ b/drivers/staging/rdma/hfi1/init.c @@ -82,10 +82,10 @@ * Number of user receive contexts we are configured to use (to allow for more * pio buffers per ctxt, etc.) Zero means use one user context per CPU. */ -uint num_rcv_contexts; -module_param_named(num_rcv_contexts, num_rcv_contexts, uint, S_IRUGO); +int num_user_contexts = -1; +module_param_named(num_user_contexts, num_user_contexts, uint, S_IRUGO); MODULE_PARM_DESC( - num_rcv_contexts, "Set max number of user receive contexts to use"); + num_user_contexts, "Set max number of user contexts to use"); u8 krcvqs[RXE_NUM_DATA_VL]; int krcvqsset; From bff14bb66c583376ff8c5dd6294796f6fc3c1dde Mon Sep 17 00:00:00 2001 From: Dean Luick Date: Thu, 17 Dec 2015 19:24:13 -0500 Subject: [PATCH 740/843] staging/rdma/hfi1: Remove incorrect link credit check Remove an invalid sanity check that compares the local link credits with the peer link credits. The two have no dependency on each other. Reviewed-by: Dennis Dalessandro Signed-off-by: Dean Luick Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/chip.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index ec4bac00dbda..bbe5ad85cec0 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -10496,8 +10496,7 @@ static int set_buffer_control(struct hfi1_devdata *dd, new_bc->vl[i].shared = 0; } new_total += be16_to_cpu(new_bc->overall_shared_limit); - if (new_total > (u32)dd->link_credits) - return -EINVAL; + /* fetch the current values */ get_buffer_control(dd, &cur_bc, &cur_total); From ecb95a027b94a99c3c0fc255c55dd9be6e404ae0 Mon Sep 17 00:00:00 2001 From: Jubin John Date: Thu, 17 Dec 2015 19:24:14 -0500 Subject: [PATCH 741/843] staging/rdma/hfi1: Fix module parameter spelling Fix the spelling of user_credit_return_threshold, it was incorrectly spelled as user_credit_return_theshold causing two module parameters, one with typo, to be shown in modinfo Reviewed-by: Ira Weiny Reviewed-by: Mike Marciniszyn Signed-off-by: Jubin John Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rdma/hfi1/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rdma/hfi1/init.c b/drivers/staging/rdma/hfi1/init.c index 7ad9eb182514..4dd8051aba7e 100644 --- a/drivers/staging/rdma/hfi1/init.c +++ b/drivers/staging/rdma/hfi1/init.c @@ -113,7 +113,7 @@ MODULE_PARM_DESC(hdrq_entsize, "Size of header queue entries: 2 - 8B, 16 - 64B ( unsigned int user_credit_return_threshold = 33; /* default is 33% */ module_param(user_credit_return_threshold, uint, S_IRUGO); -MODULE_PARM_DESC(user_credit_return_theshold, "Credit return threshold for user send contexts, return when unreturned credits passes this many blocks (in percent of allocated blocks, 0 is off)"); +MODULE_PARM_DESC(user_credit_return_threshold, "Credit return threshold for user send contexts, return when unreturned credits passes this many blocks (in percent of allocated blocks, 0 is off)"); static inline u64 encode_rcv_header_entry_size(u16); From 464e5947d119ba02b308859861e1644d90d19191 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Sat, 7 Nov 2015 13:32:07 +0530 Subject: [PATCH 742/843] Staging: lustre: rw: Remove wrapper stride_page_count Remove the function stride_page_count() and replace its calls with the function stride_pg_count() that it wraps. Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/rw.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/rw.c b/drivers/staging/lustre/lustre/llite/rw.c index f79193fa2fb7..8184d9d1da52 100644 --- a/drivers/staging/lustre/lustre/llite/rw.c +++ b/drivers/staging/lustre/lustre/llite/rw.c @@ -880,14 +880,6 @@ static void ras_update_stride_detector(struct ll_readahead_state *ras, return; } -static unsigned long -stride_page_count(struct ll_readahead_state *ras, unsigned long len) -{ - return stride_pg_count(ras->ras_stride_offset, ras->ras_stride_length, - ras->ras_stride_pages, ras->ras_stride_offset, - len); -} - /* Stride Read-ahead window will be increased inc_len according to * stride I/O pattern */ static void ras_stride_increase_window(struct ll_readahead_state *ras, @@ -921,7 +913,9 @@ static void ras_stride_increase_window(struct ll_readahead_state *ras, window_len += step * ras->ras_stride_length + left; - if (stride_page_count(ras, window_len) <= ra->ra_max_pages_per_file) + if (stride_pg_count(ras->ras_stride_offset, ras->ras_stride_length, + ras->ras_stride_pages, ras->ras_stride_offset, + window_len) <= ra->ra_max_pages_per_file) ras->ras_window_len = window_len; RAS_CDEBUG(ras); From 8cdce48509a73cc45a79937237614ddc6e2181e2 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Sat, 7 Nov 2015 15:14:24 +0530 Subject: [PATCH 743/843] Staging: lustre: lustre_mds: Remove unused md_should_create md_should_create has been defined in header file but not used. Thus remove it. Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/include/lustre_mds.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_mds.h b/drivers/staging/lustre/lustre/include/lustre_mds.h index a16eb8b61178..95d27ddecfb3 100644 --- a/drivers/staging/lustre/lustre/include/lustre_mds.h +++ b/drivers/staging/lustre/lustre/include/lustre_mds.h @@ -62,12 +62,6 @@ struct mds_group_info { #define MDD_OBD_NAME "mdd_obd" #define MDD_OBD_UUID "mdd_obd_uuid" -static inline int md_should_create(__u64 flags) -{ - return !(flags & MDS_OPEN_DELAY_CREATE || - !(flags & FMODE_WRITE)); -} - /* these are local flags, used only on the client, private */ #define M_CHECK_STALE 0200000000 From b0d14255a1db03572d325a2d4897856f3b6f552f Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Sat, 7 Nov 2015 15:20:21 +0530 Subject: [PATCH 744/843] Staging: lustre: statahead: Remove ll_sa_entry_unhashed wrapper Remove the function ll_sa_entry_unhashed() and replace all its calls with the function list_empty() that it wrapped. Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/statahead.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c index 18f5f2b7e902..8085557ff67e 100644 --- a/drivers/staging/lustre/lustre/llite/statahead.c +++ b/drivers/staging/lustre/lustre/llite/statahead.c @@ -87,11 +87,6 @@ struct ll_sa_entry { static unsigned int sai_generation; static DEFINE_SPINLOCK(sai_generation_lock); -static inline int ll_sa_entry_unhashed(struct ll_sa_entry *entry) -{ - return list_empty(&entry->se_hash); -} - /* * The entry only can be released by the caller, it is necessary to hold lock. */ @@ -331,7 +326,7 @@ static void ll_sa_entry_put(struct ll_statahead_info *sai, LASSERT(list_empty(&entry->se_link)); LASSERT(list_empty(&entry->se_list)); - LASSERT(ll_sa_entry_unhashed(entry)); + LASSERT(list_empty(&entry->se_hash)); ll_sa_entry_cleanup(sai, entry); iput(entry->se_inode); @@ -346,7 +341,7 @@ do_sa_entry_fini(struct ll_statahead_info *sai, struct ll_sa_entry *entry) { struct ll_inode_info *lli = ll_i2info(sai->sai_inode); - LASSERT(!ll_sa_entry_unhashed(entry)); + LASSERT(!list_empty(&entry->se_hash)); LASSERT(!list_empty(&entry->se_link)); ll_sa_entry_unhash(sai, entry); From 13ce3246573a6c9b785516c957f09108bf325b32 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Sat, 7 Nov 2015 15:20:59 +0530 Subject: [PATCH 745/843] Staging: lustre: statahead: Remove sa_first_received_entry wrapper Remove the function sa_first_received_entry() and replace all its calls with the function list_entry() that it wraps. Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/statahead.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c index 8085557ff67e..d80ca9319c9f 100644 --- a/drivers/staging/lustre/lustre/llite/statahead.c +++ b/drivers/staging/lustre/lustre/llite/statahead.c @@ -133,13 +133,6 @@ static inline int agl_should_run(struct ll_statahead_info *sai, return (inode != NULL && S_ISREG(inode->i_mode) && sai->sai_agl_valid); } -static inline struct ll_sa_entry * -sa_first_received_entry(struct ll_statahead_info *sai) -{ - return list_entry(sai->sai_entries_received.next, - struct ll_sa_entry, se_list); -} - static inline struct ll_inode_info * agl_first_entry(struct ll_statahead_info *sai) { @@ -620,7 +613,8 @@ static void ll_post_statahead(struct ll_statahead_info *sai) spin_unlock(&lli->lli_sa_lock); return; } - entry = sa_first_received_entry(sai); + entry = list_entry(sai->sai_entries_received.next, + struct ll_sa_entry, se_list); atomic_inc(&entry->se_refcount); list_del_init(&entry->se_list); spin_unlock(&lli->lli_sa_lock); From 6c3d0ea63e69527eb3b1c8117462f96cff0e4b48 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Sat, 7 Nov 2015 15:21:39 +0530 Subject: [PATCH 746/843] Staging: lustre: statahead: Remove agl_first_entry wrapper Remove the wrapper function agl_first_entry() and replace its calls with the function list_entry() that it wraps. Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/llite/statahead.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c index d80ca9319c9f..fbc34afa5c73 100644 --- a/drivers/staging/lustre/lustre/llite/statahead.c +++ b/drivers/staging/lustre/lustre/llite/statahead.c @@ -133,13 +133,6 @@ static inline int agl_should_run(struct ll_statahead_info *sai, return (inode != NULL && S_ISREG(inode->i_mode) && sai->sai_agl_valid); } -static inline struct ll_inode_info * -agl_first_entry(struct ll_statahead_info *sai) -{ - return list_entry(sai->sai_entries_agl.next, - struct ll_inode_info, lli_agl_list); -} - static inline int sa_sent_full(struct ll_statahead_info *sai) { return atomic_read(&sai->sai_cache_count) >= sai->sai_max; @@ -973,7 +966,8 @@ static int ll_agl_thread(void *arg) /* The statahead thread maybe help to process AGL entries, * so check whether list empty again. */ if (!agl_list_empty(sai)) { - clli = agl_first_entry(sai); + clli = list_entry(sai->sai_entries_agl.next, + struct ll_inode_info, lli_agl_list); list_del_init(&clli->lli_agl_list); spin_unlock(&plli->lli_agl_lock); ll_agl_trigger(&clli->lli_vfs_inode, sai); @@ -985,7 +979,8 @@ static int ll_agl_thread(void *arg) spin_lock(&plli->lli_agl_lock); sai->sai_agl_valid = 0; while (!agl_list_empty(sai)) { - clli = agl_first_entry(sai); + clli = list_entry(sai->sai_entries_agl.next, + struct ll_inode_info, lli_agl_list); list_del_init(&clli->lli_agl_list); spin_unlock(&plli->lli_agl_lock); clli->lli_agl_index = 0; @@ -1146,7 +1141,8 @@ interpret_it: if (sa_sent_full(sai)) { spin_lock(&plli->lli_agl_lock); while (!agl_list_empty(sai)) { - clli = agl_first_entry(sai); + clli = list_entry(sai->sai_entries_agl.next, + struct ll_inode_info, lli_agl_list); list_del_init(&clli->lli_agl_list); spin_unlock(&plli->lli_agl_lock); ll_agl_trigger(&clli->lli_vfs_inode, @@ -1204,7 +1200,8 @@ do_it: spin_lock(&plli->lli_agl_lock); while (!agl_list_empty(sai) && thread_is_running(thread)) { - clli = agl_first_entry(sai); + clli = list_entry(sai->sai_entries_agl.next, + struct ll_inode_info, lli_agl_list); list_del_init(&clli->lli_agl_list); spin_unlock(&plli->lli_agl_lock); ll_agl_trigger(&clli->lli_vfs_inode, sai); From 615f9a68b9735d1690b9ada3d7d60f864b3161e5 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Sat, 7 Nov 2015 15:22:18 +0530 Subject: [PATCH 747/843] Staging: lustre: statahead: Remove sa_received_empty wrapper Remove the wrapper sa_received_empty() and replace its calls with the function it wrapped. Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/llite/statahead.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c index fbc34afa5c73..3a1d2943121b 100644 --- a/drivers/staging/lustre/lustre/llite/statahead.c +++ b/drivers/staging/lustre/lustre/llite/statahead.c @@ -518,7 +518,7 @@ static void ll_sai_put(struct ll_statahead_info *sai) do_sa_entry_fini(sai, entry); LASSERT(list_empty(&sai->sai_entries)); - LASSERT(sa_received_empty(sai)); + LASSERT(list_empty(&sai->sai_entries_received)); LASSERT(list_empty(&sai->sai_entries_stated)); LASSERT(atomic_read(&sai->sai_cache_count) == 0); @@ -602,7 +602,7 @@ static void ll_post_statahead(struct ll_statahead_info *sai) int rc = 0; spin_lock(&lli->lli_sa_lock); - if (unlikely(sa_received_empty(sai))) { + if (unlikely(list_empty(&sai->sai_entries_received))) { spin_unlock(&lli->lli_sa_lock); return; } @@ -738,7 +738,7 @@ static int ll_statahead_interpret(struct ptlrpc_request *req, * for readpage and other tries to enqueue lock on child * with parent's lock held, for example: unlink. */ entry->se_handle = handle; - wakeup = sa_received_empty(sai); + wakeup = list_empty(&sai->sai_entries_received); list_add_tail(&entry->se_list, &sai->sai_entries_received); } @@ -1120,13 +1120,13 @@ static int ll_statahead_thread(void *arg) keep_it: l_wait_event(thread->t_ctl_waitq, !sa_sent_full(sai) || - !sa_received_empty(sai) || + !list_empty(&sai->sai_entries_received) || !agl_list_empty(sai) || !thread_is_running(thread), &lwi); interpret_it: - while (!sa_received_empty(sai)) + while (!list_empty(&sai->sai_entries_received)) ll_post_statahead(sai); if (unlikely(!thread_is_running(thread))) { @@ -1148,7 +1148,7 @@ interpret_it: ll_agl_trigger(&clli->lli_vfs_inode, sai); - if (!sa_received_empty(sai)) + if (!list_empty(&sai->sai_entries_received)) goto interpret_it; if (unlikely( @@ -1179,12 +1179,12 @@ do_it: ll_release_page(page, 0); while (1) { l_wait_event(thread->t_ctl_waitq, - !sa_received_empty(sai) || + !list_empty(&sai->sai_entries_received) || sai->sai_sent == sai->sai_replied || !thread_is_running(thread), &lwi); - while (!sa_received_empty(sai)) + while (!list_empty(&sai->sai_entries_received)) ll_post_statahead(sai); if (unlikely(!thread_is_running(thread))) { @@ -1193,7 +1193,7 @@ do_it: } if (sai->sai_sent == sai->sai_replied && - sa_received_empty(sai)) + list_empty(&sai->sai_entries_received)) break; } @@ -1246,12 +1246,12 @@ out: } ll_dir_chain_fini(&chain); spin_lock(&plli->lli_sa_lock); - if (!sa_received_empty(sai)) { + if (!list_empty(&sai->sai_entries_received)) { thread_set_flags(thread, SVC_STOPPING); spin_unlock(&plli->lli_sa_lock); /* To release the resources held by received entries. */ - while (!sa_received_empty(sai)) + while (!list_empty(&sai->sai_entries_received)) ll_post_statahead(sai); spin_lock(&plli->lli_sa_lock); From 24a85e887b4e44e39425f1d8e0a9e56b690b80b1 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Sat, 7 Nov 2015 15:23:11 +0530 Subject: [PATCH 748/843] Staging: lustre: statahead: Remove agl_list_empty wrapper Remove the function agl_list_empty() and replace its calls with the function it wrapped. Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/statahead.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c index 3a1d2943121b..caee0a6f8b84 100644 --- a/drivers/staging/lustre/lustre/llite/statahead.c +++ b/drivers/staging/lustre/lustre/llite/statahead.c @@ -428,7 +428,7 @@ static void ll_agl_add(struct ll_statahead_info *sai, igrab(inode); spin_lock(&parent->lli_agl_lock); - if (agl_list_empty(sai)) + if (list_empty(&sai->sai_entries_agl)) added = 1; list_add_tail(&child->lli_agl_list, &sai->sai_entries_agl); spin_unlock(&parent->lli_agl_lock); @@ -522,7 +522,7 @@ static void ll_sai_put(struct ll_statahead_info *sai) LASSERT(list_empty(&sai->sai_entries_stated)); LASSERT(atomic_read(&sai->sai_cache_count) == 0); - LASSERT(agl_list_empty(sai)); + LASSERT(list_empty(&sai->sai_entries_agl)); iput(inode); kfree(sai); @@ -955,7 +955,7 @@ static int ll_agl_thread(void *arg) while (1) { l_wait_event(thread->t_ctl_waitq, - !agl_list_empty(sai) || + !list_empty(&sai->sai_entries_agl) || !thread_is_running(thread), &lwi); @@ -965,7 +965,7 @@ static int ll_agl_thread(void *arg) spin_lock(&plli->lli_agl_lock); /* The statahead thread maybe help to process AGL entries, * so check whether list empty again. */ - if (!agl_list_empty(sai)) { + if (!list_empty(&sai->sai_entries_agl)) { clli = list_entry(sai->sai_entries_agl.next, struct ll_inode_info, lli_agl_list); list_del_init(&clli->lli_agl_list); @@ -978,7 +978,7 @@ static int ll_agl_thread(void *arg) spin_lock(&plli->lli_agl_lock); sai->sai_agl_valid = 0; - while (!agl_list_empty(sai)) { + while (!list_empty(&sai->sai_entries_agl)) { clli = list_entry(sai->sai_entries_agl.next, struct ll_inode_info, lli_agl_list); list_del_init(&clli->lli_agl_list); @@ -1121,7 +1121,7 @@ keep_it: l_wait_event(thread->t_ctl_waitq, !sa_sent_full(sai) || !list_empty(&sai->sai_entries_received) || - !agl_list_empty(sai) || + !list_empty(&sai->sai_entries_agl) || !thread_is_running(thread), &lwi); @@ -1140,7 +1140,7 @@ interpret_it: * to process the AGL entries. */ if (sa_sent_full(sai)) { spin_lock(&plli->lli_agl_lock); - while (!agl_list_empty(sai)) { + while (!list_empty(&sai->sai_entries_agl)) { clli = list_entry(sai->sai_entries_agl.next, struct ll_inode_info, lli_agl_list); list_del_init(&clli->lli_agl_list); @@ -1198,7 +1198,7 @@ do_it: } spin_lock(&plli->lli_agl_lock); - while (!agl_list_empty(sai) && + while (!list_empty(&sai->sai_entries_agl) && thread_is_running(thread)) { clli = list_entry(sai->sai_entries_agl.next, struct ll_inode_info, lli_agl_list); From d11f8cc4bb7ff4ee8cc89d2799cdda206da0f434 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Sun, 8 Nov 2015 14:47:10 +0530 Subject: [PATCH 749/843] staging: lustre: workitem: Remove cfs_wi_sched_lock wrapper Remove the wrapper function cfs_wi_sched_lock() and replace all its calls with the function it wrapped. Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/libcfs/workitem.c | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/workitem.c b/drivers/staging/lustre/lustre/libcfs/workitem.c index b57acbfb061b..e8bac9b2b6f1 100644 --- a/drivers/staging/lustre/lustre/libcfs/workitem.c +++ b/drivers/staging/lustre/lustre/libcfs/workitem.c @@ -86,12 +86,6 @@ static struct cfs_workitem_data { int wi_stopping; } cfs_wi_data; -static inline void -cfs_wi_sched_lock(struct cfs_wi_sched *sched) -{ - spin_lock(&sched->ws_lock); -} - static inline void cfs_wi_sched_unlock(struct cfs_wi_sched *sched) { @@ -101,7 +95,7 @@ cfs_wi_sched_unlock(struct cfs_wi_sched *sched) static inline int cfs_wi_sched_cansleep(struct cfs_wi_sched *sched) { - cfs_wi_sched_lock(sched); + spin_lock(&sched->ws_lock); if (sched->ws_stopping) { cfs_wi_sched_unlock(sched); return 0; @@ -125,7 +119,7 @@ cfs_wi_exit(struct cfs_wi_sched *sched, cfs_workitem_t *wi) LASSERT(!in_interrupt()); /* because we use plain spinlock */ LASSERT(!sched->ws_stopping); - cfs_wi_sched_lock(sched); + spin_lock(&sched->ws_lock); LASSERT(wi->wi_running); if (wi->wi_scheduled) { /* cancel pending schedules */ @@ -161,7 +155,7 @@ cfs_wi_deschedule(struct cfs_wi_sched *sched, cfs_workitem_t *wi) * means the workitem will not be scheduled and will not have * any race with wi_action. */ - cfs_wi_sched_lock(sched); + spin_lock(&sched->ws_lock); rc = !(wi->wi_running); @@ -195,7 +189,7 @@ cfs_wi_schedule(struct cfs_wi_sched *sched, cfs_workitem_t *wi) LASSERT(!in_interrupt()); /* because we use plain spinlock */ LASSERT(!sched->ws_stopping); - cfs_wi_sched_lock(sched); + spin_lock(&sched->ws_lock); if (!wi->wi_scheduled) { LASSERT (list_empty(&wi->wi_list)); @@ -237,7 +231,7 @@ cfs_wi_scheduler (void *arg) spin_unlock(&cfs_wi_data.wi_glock); - cfs_wi_sched_lock(sched); + spin_lock(&sched->ws_lock); while (!sched->ws_stopping) { int nloops = 0; @@ -263,7 +257,7 @@ cfs_wi_scheduler (void *arg) rc = (*wi->wi_action) (wi); - cfs_wi_sched_lock(sched); + spin_lock(&sched->ws_lock); if (rc != 0) /* WI should be dead, even be freed! */ continue; @@ -282,14 +276,14 @@ cfs_wi_scheduler (void *arg) /* don't sleep because some workitems still * expect me to come back soon */ cond_resched(); - cfs_wi_sched_lock(sched); + spin_lock(&sched->ws_lock); continue; } cfs_wi_sched_unlock(sched); rc = wait_event_interruptible_exclusive(sched->ws_waitq, !cfs_wi_sched_cansleep(sched)); - cfs_wi_sched_lock(sched); + spin_lock(&sched->ws_lock); } cfs_wi_sched_unlock(sched); From 8eefa1c028f5b16f33ce1b3c7bbabdf74efc63b1 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Sun, 8 Nov 2015 14:47:34 +0530 Subject: [PATCH 750/843] staging: lustre: workitem: Remove cfs_wi_sched_unlock wrapper Remove the wrapper function cfs_wi_sched_unlock() and replace all its calls with the function it wrapped. Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/lustre/libcfs/workitem.c | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/workitem.c b/drivers/staging/lustre/lustre/libcfs/workitem.c index e8bac9b2b6f1..60bb88a00b41 100644 --- a/drivers/staging/lustre/lustre/libcfs/workitem.c +++ b/drivers/staging/lustre/lustre/libcfs/workitem.c @@ -86,26 +86,20 @@ static struct cfs_workitem_data { int wi_stopping; } cfs_wi_data; -static inline void -cfs_wi_sched_unlock(struct cfs_wi_sched *sched) -{ - spin_unlock(&sched->ws_lock); -} - static inline int cfs_wi_sched_cansleep(struct cfs_wi_sched *sched) { spin_lock(&sched->ws_lock); if (sched->ws_stopping) { - cfs_wi_sched_unlock(sched); + spin_unlock(&sched->ws_lock); return 0; } if (!list_empty(&sched->ws_runq)) { - cfs_wi_sched_unlock(sched); + spin_unlock(&sched->ws_lock); return 0; } - cfs_wi_sched_unlock(sched); + spin_unlock(&sched->ws_lock); return 1; } @@ -133,7 +127,7 @@ cfs_wi_exit(struct cfs_wi_sched *sched, cfs_workitem_t *wi) LASSERT(list_empty(&wi->wi_list)); wi->wi_scheduled = 1; /* LBUG future schedule attempts */ - cfs_wi_sched_unlock(sched); + spin_unlock(&sched->ws_lock); return; } @@ -171,7 +165,7 @@ cfs_wi_deschedule(struct cfs_wi_sched *sched, cfs_workitem_t *wi) LASSERT (list_empty(&wi->wi_list)); - cfs_wi_sched_unlock(sched); + spin_unlock(&sched->ws_lock); return rc; } EXPORT_SYMBOL(cfs_wi_deschedule); @@ -205,7 +199,7 @@ cfs_wi_schedule(struct cfs_wi_sched *sched, cfs_workitem_t *wi) } LASSERT (!list_empty(&wi->wi_list)); - cfs_wi_sched_unlock(sched); + spin_unlock(&sched->ws_lock); return; } EXPORT_SYMBOL(cfs_wi_schedule); @@ -252,7 +246,7 @@ cfs_wi_scheduler (void *arg) wi->wi_running = 1; wi->wi_scheduled = 0; - cfs_wi_sched_unlock(sched); + spin_unlock(&sched->ws_lock); nloops++; rc = (*wi->wi_action) (wi); @@ -272,7 +266,7 @@ cfs_wi_scheduler (void *arg) } if (!list_empty(&sched->ws_runq)) { - cfs_wi_sched_unlock(sched); + spin_unlock(&sched->ws_lock); /* don't sleep because some workitems still * expect me to come back soon */ cond_resched(); @@ -280,13 +274,13 @@ cfs_wi_scheduler (void *arg) continue; } - cfs_wi_sched_unlock(sched); + spin_unlock(&sched->ws_lock); rc = wait_event_interruptible_exclusive(sched->ws_waitq, !cfs_wi_sched_cansleep(sched)); spin_lock(&sched->ws_lock); } - cfs_wi_sched_unlock(sched); + spin_unlock(&sched->ws_lock); spin_lock(&cfs_wi_data.wi_glock); sched->ws_nthreads--; From dd40ca4629faa656148803fbfded4c804a25a21b Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Sun, 8 Nov 2015 22:22:58 +0530 Subject: [PATCH 751/843] staging: lustre: mdc_request: Remove mdc_kuc_reregister wrapper Remove the wrapper function mdc_kuc_reregister() and replace its call with the function it wrapped. Also, comment has been added for clarity. Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/mdc/mdc_request.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 294c05084b97..e172be1bc1c6 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -2037,17 +2037,6 @@ static int mdc_hsm_ct_reregister(__u32 data, void *cb_arg) return ((rc != 0) && (rc != -EEXIST)) ? rc : 0; } -/** - * Re-establish all kuc contexts with MDT - * after MDT shutdown/recovery. - */ -static int mdc_kuc_reregister(struct obd_import *imp) -{ - /* re-register HSM agents */ - return libcfs_kkuc_group_foreach(KUC_GRP_HSM, mdc_hsm_ct_reregister, - (void *)imp); -} - static int mdc_set_info_async(const struct lu_env *env, struct obd_export *exp, u32 keylen, void *key, @@ -2210,7 +2199,10 @@ static int mdc_import_event(struct obd_device *obd, struct obd_import *imp, rc = obd_notify_observer(obd, obd, OBD_NOTIFY_ACTIVE, NULL); /* redo the kuc registration after reconnecting */ if (rc == 0) - rc = mdc_kuc_reregister(imp); + /* re-register HSM agents */ + rc = libcfs_kkuc_group_foreach(KUC_GRP_HSM, + mdc_hsm_ct_reregister, + (void *)imp); break; case IMP_EVENT_OCD: rc = obd_notify_observer(obd, obd, OBD_NOTIFY_OCD, NULL); From 524576d174c2b3321671fa87bcd6eac24f001485 Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Sun, 8 Nov 2015 14:17:06 -0500 Subject: [PATCH 752/843] staging: lustre: remove hsm_nl proc file Remove the file /proc/fs/lustre/mdc/*/hsm_nl which was introduced "for testing purposes." Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2489 Reviewed-on: http://review.whamcloud.com/6656 Reviewed-by: jacques-Charles Lafoucriere Reviewed-by: Aurelien Degremont Reviewed-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/mdc/lproc_mdc.c | 77 ------------------- 1 file changed, 77 deletions(-) diff --git a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c index 1c95f87a0e2a..84e586223588 100644 --- a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c +++ b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c @@ -82,82 +82,6 @@ static ssize_t max_rpcs_in_flight_store(struct kobject *kobj, } LUSTRE_RW_ATTR(max_rpcs_in_flight); -static int mdc_kuc_open(struct inode *inode, struct file *file) -{ - return single_open(file, NULL, inode->i_private); -} - -/* temporary for testing */ -static ssize_t mdc_kuc_write(struct file *file, - const char __user *buffer, - size_t count, loff_t *off) -{ - struct obd_device *obd = - ((struct seq_file *)file->private_data)->private; - struct kuc_hdr *lh; - struct hsm_action_list *hal; - struct hsm_action_item *hai; - int len; - int fd, rc; - - rc = lprocfs_write_helper(buffer, count, &fd); - if (rc) - return rc; - - if (fd < 0) - return -ERANGE; - CWARN("message to fd %d\n", fd); - - len = sizeof(*lh) + sizeof(*hal) + MTI_NAME_MAXLEN + - /* for mockup below */ 2 * cfs_size_round(sizeof(*hai)); - - lh = kzalloc(len, GFP_NOFS); - if (!lh) - return -ENOMEM; - - lh->kuc_magic = KUC_MAGIC; - lh->kuc_transport = KUC_TRANSPORT_HSM; - lh->kuc_msgtype = HMT_ACTION_LIST; - lh->kuc_msglen = len; - - hal = (struct hsm_action_list *)(lh + 1); - hal->hal_version = HAL_VERSION; - hal->hal_archive_id = 1; - hal->hal_flags = 0; - obd_uuid2fsname(hal->hal_fsname, obd->obd_name, MTI_NAME_MAXLEN); - - /* mock up an action list */ - hal->hal_count = 2; - hai = hai_zero(hal); - hai->hai_action = HSMA_ARCHIVE; - hai->hai_fid.f_oid = 5; - hai->hai_len = sizeof(*hai); - hai = hai_next(hai); - hai->hai_action = HSMA_RESTORE; - hai->hai_fid.f_oid = 10; - hai->hai_len = sizeof(*hai); - - /* This works for either broadcast or unicast to a single fd */ - if (fd == 0) { - rc = libcfs_kkuc_group_put(KUC_GRP_HSM, lh); - } else { - struct file *fp = fget(fd); - - rc = libcfs_kkuc_msg_put(fp, lh); - fput(fp); - } - kfree(lh); - if (rc < 0) - return rc; - return count; -} - -static struct file_operations mdc_kuc_fops = { - .open = mdc_kuc_open, - .write = mdc_kuc_write, - .release = single_release, -}; - LPROC_SEQ_FOPS_WR_ONLY(mdc, ping); LPROC_SEQ_FOPS_RO_TYPE(mdc, connect_flags); @@ -196,7 +120,6 @@ static struct lprocfs_vars lprocfs_mdc_obd_vars[] = { { "timeouts", &mdc_timeouts_fops, NULL, 0 }, { "import", &mdc_import_fops, NULL, 0 }, { "state", &mdc_state_fops, NULL, 0 }, - { "hsm_nl", &mdc_kuc_fops, NULL, 0200 }, { "pinger_recov", &mdc_pinger_recov_fops, NULL, 0 }, { NULL } }; From 82224549f33a2cf983edb82692311ccee805a21b Mon Sep 17 00:00:00 2001 From: frank zago Date: Sun, 8 Nov 2015 18:09:36 -0500 Subject: [PATCH 753/843] staging: lustre: remove unnecessary EXPORT_SYMBOL for lnet layer A lot of symbols don't need to be exported at all because they are only used in the module they belong to. Signed-off-by: frank zago Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5829 Reviewed-on: http://review.whamcloud.com/13320 Reviewed-by: James Simmons Reviewed-by: Isaac Huang Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/lnet/api-ni.c | 3 --- drivers/staging/lustre/lnet/lnet/lib-move.c | 1 - drivers/staging/lustre/lnet/selftest/conctl.c | 2 -- 3 files changed, 6 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index 284150f53f7d..9f78dc8d7a26 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -354,7 +354,6 @@ lnet_counters_reset(void) lnet_net_unlock(LNET_LOCK_EX); } -EXPORT_SYMBOL(lnet_counters_reset); static char * lnet_res_type2str(int type) @@ -1153,7 +1152,6 @@ lnet_init(void) lnet_register_lnd(&the_lolnd); return 0; } -EXPORT_SYMBOL(lnet_init); /** * Finalize LNet library. @@ -1177,7 +1175,6 @@ lnet_fini(void) the_lnet.ln_init = 0; } -EXPORT_SYMBOL(lnet_fini); /** * Set LNet PID and start LNet interfaces, routing, and forwarding. diff --git a/drivers/staging/lustre/lnet/lnet/lib-move.c b/drivers/staging/lustre/lnet/lnet/lib-move.c index 5631f60a39bc..03a721e1bb3d 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-move.c +++ b/drivers/staging/lustre/lnet/lnet/lib-move.c @@ -1645,7 +1645,6 @@ lnet_msgtyp2str(int type) return ""; } } -EXPORT_SYMBOL(lnet_msgtyp2str); void lnet_print_hdr(lnet_hdr_t *hdr) diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index 556c837cf62c..a534665403e5 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -925,5 +925,3 @@ out: return rc; } - -EXPORT_SYMBOL(lstcon_ioctl_entry); From 1dc563a682597b21f39e2ef9c0a87698935ad4fb Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Sun, 8 Nov 2015 18:09:37 -0500 Subject: [PATCH 754/843] staging: lustre: update Intel copyright messages 2015 Update copyright messages in files modified by Intel employees in 2015 by non-trivial patches. Exclude patches that are only deleting code, renaming functions, or adding or removing whitespace. Signed-off-by: Andreas Dilger Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7243 Reviewed-on: http://review.whamcloud.com/16758 Reviewed-by: James Nunez Reviewed-by: James Simmons Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/include/linux/libcfs/libcfs.h | 2 +- drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h | 3 ++- drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h | 2 +- drivers/staging/lustre/include/linux/lnet/lib-lnet.h | 2 +- drivers/staging/lustre/include/linux/lnet/lib-types.h | 2 +- drivers/staging/lustre/include/linux/lnet/nidstr.h | 2 +- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 +- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 2 +- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 2 +- drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c | 2 +- drivers/staging/lustre/lnet/lnet/acceptor.c | 2 +- drivers/staging/lustre/lnet/lnet/api-ni.c | 2 +- drivers/staging/lustre/lnet/lnet/config.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-move.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-ptl.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-socket.c | 2 +- drivers/staging/lustre/lnet/lnet/module.c | 2 +- drivers/staging/lustre/lnet/lnet/router.c | 2 +- drivers/staging/lustre/lnet/selftest/brw_test.c | 2 +- drivers/staging/lustre/lnet/selftest/rpc.c | 2 +- drivers/staging/lustre/lustre/fid/fid_request.c | 2 +- drivers/staging/lustre/lustre/fid/lproc_fid.c | 2 +- drivers/staging/lustre/lustre/fld/fld_internal.h | 2 +- drivers/staging/lustre/lustre/fld/fld_request.c | 2 +- drivers/staging/lustre/lustre/fld/lproc_fld.c | 2 +- drivers/staging/lustre/lustre/include/cl_object.h | 2 +- drivers/staging/lustre/lustre/include/lprocfs_status.h | 2 +- drivers/staging/lustre/lustre/include/lu_object.h | 2 +- drivers/staging/lustre/lustre/include/lustre/ll_fiemap.h | 2 ++ drivers/staging/lustre/lustre/include/lustre/lustre_idl.h | 2 +- drivers/staging/lustre/lustre/include/lustre/lustre_user.h | 2 +- drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 +- drivers/staging/lustre/lustre/include/lustre_export.h | 2 +- drivers/staging/lustre/lustre/include/lustre_fid.h | 2 +- drivers/staging/lustre/lustre/include/lustre_fld.h | 2 +- drivers/staging/lustre/lustre/include/lustre_ha.h | 2 +- drivers/staging/lustre/lustre/include/lustre_log.h | 2 +- drivers/staging/lustre/lustre/include/lustre_net.h | 2 +- drivers/staging/lustre/lustre/include/lustre_param.h | 2 +- drivers/staging/lustre/lustre/include/lustre_req_layout.h | 2 +- drivers/staging/lustre/lustre/include/obd.h | 2 +- drivers/staging/lustre/lustre/include/obd_class.h | 2 +- drivers/staging/lustre/lustre/include/obd_support.h | 2 +- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 2 +- drivers/staging/lustre/lustre/libcfs/fail.c | 2 +- drivers/staging/lustre/lustre/libcfs/libcfs_lock.c | 2 +- drivers/staging/lustre/lustre/libcfs/libcfs_string.c | 2 +- drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c | 3 ++- drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c | 2 +- drivers/staging/lustre/lustre/libcfs/module.c | 2 +- drivers/staging/lustre/lustre/llite/dcache.c | 2 +- drivers/staging/lustre/lustre/llite/dir.c | 2 +- drivers/staging/lustre/lustre/llite/file.c | 2 +- drivers/staging/lustre/lustre/llite/llite_internal.h | 2 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 2 +- drivers/staging/lustre/lustre/llite/llite_mmap.c | 2 +- drivers/staging/lustre/lustre/llite/lproc_llite.c | 2 +- drivers/staging/lustre/lustre/llite/namei.c | 2 +- drivers/staging/lustre/lustre/llite/rw.c | 2 +- drivers/staging/lustre/lustre/llite/statahead.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_dev.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_internal.h | 2 ++ drivers/staging/lustre/lustre/llite/vvp_io.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_lock.c | 2 ++ drivers/staging/lustre/lustre/llite/vvp_object.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_page.c | 2 +- drivers/staging/lustre/lustre/llite/xattr.c | 2 +- drivers/staging/lustre/lustre/llite/xattr_cache.c | 2 ++ drivers/staging/lustre/lustre/lmv/lmv_intent.c | 2 +- drivers/staging/lustre/lustre/lmv/lmv_internal.h | 2 +- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 2 +- drivers/staging/lustre/lustre/lov/lov_cl_internal.h | 2 +- drivers/staging/lustre/lustre/lov/lov_dev.c | 2 +- drivers/staging/lustre/lustre/lov/lov_ea.c | 2 +- drivers/staging/lustre/lustre/lov/lov_internal.h | 2 +- drivers/staging/lustre/lustre/lov/lov_io.c | 2 +- drivers/staging/lustre/lustre/lov/lov_merge.c | 2 +- drivers/staging/lustre/lustre/lov/lov_obd.c | 2 +- drivers/staging/lustre/lustre/lov/lov_object.c | 2 +- drivers/staging/lustre/lustre/lov/lov_offset.c | 2 +- drivers/staging/lustre/lustre/lov/lov_pack.c | 2 +- drivers/staging/lustre/lustre/lov/lov_page.c | 2 +- drivers/staging/lustre/lustre/lov/lov_request.c | 2 +- drivers/staging/lustre/lustre/lov/lovsub_dev.c | 2 ++ drivers/staging/lustre/lustre/lov/lovsub_object.c | 2 +- drivers/staging/lustre/lustre/lov/lproc_lov.c | 2 +- drivers/staging/lustre/lustre/mdc/lproc_mdc.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_internal.h | 2 +- drivers/staging/lustre/lustre/mdc/mdc_lib.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_reint.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 2 +- drivers/staging/lustre/lustre/mgc/mgc_request.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_io.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_object.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_page.c | 2 +- drivers/staging/lustre/lustre/obdclass/class_obd.c | 2 +- drivers/staging/lustre/lustre/obdclass/genops.c | 2 +- drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c | 2 +- drivers/staging/lustre/lustre/obdclass/llog.c | 2 +- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 2 +- drivers/staging/lustre/lustre/obdclass/llog_internal.h | 2 +- drivers/staging/lustre/lustre/obdclass/llog_obd.c | 2 +- drivers/staging/lustre/lustre/obdclass/llog_swab.c | 2 +- drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 2 +- drivers/staging/lustre/lustre/obdclass/lu_object.c | 2 +- drivers/staging/lustre/lustre/obdclass/obd_config.c | 2 +- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 2 +- drivers/staging/lustre/lustre/obdecho/echo_client.c | 2 +- drivers/staging/lustre/lustre/osc/lproc_osc.c | 2 +- drivers/staging/lustre/lustre/osc/osc_cache.c | 2 +- drivers/staging/lustre/lustre/osc/osc_cl_internal.h | 2 +- drivers/staging/lustre/lustre/osc/osc_dev.c | 2 +- drivers/staging/lustre/lustre/osc/osc_internal.h | 2 +- drivers/staging/lustre/lustre/osc/osc_io.c | 2 +- drivers/staging/lustre/lustre/osc/osc_lock.c | 2 +- drivers/staging/lustre/lustre/osc/osc_object.c | 2 +- drivers/staging/lustre/lustre/osc/osc_page.c | 2 +- drivers/staging/lustre/lustre/osc/osc_quota.c | 2 +- drivers/staging/lustre/lustre/osc/osc_request.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/client.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/events.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/import.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/layout.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/llog_client.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/pers.c | 2 ++ drivers/staging/lustre/lustre/ptlrpc/pinger.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 2 +- drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/recover.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/sec_config.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/sec_plain.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/service.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 2 +- 144 files changed, 152 insertions(+), 138 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h index 4d74e8af5088..049f6a9a638b 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h index 787867847483..1530b0458a61 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h @@ -22,7 +22,8 @@ */ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, Intel Corporation. + * + * Copyright (c) 2012, 2015 Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h index f14db92346ba..c3f2332fa043 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015 Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index b61d5045a566..b67a6607bb3b 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -23,7 +23,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012 - 2015, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index d792c4adb0ca..3bb9468e0b9d 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -23,7 +23,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012 - 2015, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/include/linux/lnet/nidstr.h b/drivers/staging/lustre/include/linux/lnet/nidstr.h index 46ad9147ad2a..4fc9ddce829d 100644 --- a/drivers/staging/lustre/include/linux/lnet/nidstr.h +++ b/drivers/staging/lustre/include/linux/lnet/nidstr.h @@ -23,7 +23,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011 - 2015, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ #ifndef _LNET_NIDSTRINGS_H #define _LNET_NIDSTRINGS_H diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index de0f85f8a2f9..72af486b65df 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h index 263db37de7c8..025faa9f86b3 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c index 260750354a41..c7b9ccb13f1c 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index ebde0369edc8..05aa90ea597a 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c index 92ca1dd64076..fed57d90028d 100644 --- a/drivers/staging/lustre/lnet/lnet/acceptor.c +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index 9f78dc8d7a26..362282fa00bf 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lnet/lnet/config.c b/drivers/staging/lustre/lnet/lnet/config.c index 5390ee9963ab..284a3c271bc6 100644 --- a/drivers/staging/lustre/lnet/lnet/config.c +++ b/drivers/staging/lustre/lnet/lnet/config.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lnet/lnet/lib-move.c b/drivers/staging/lustre/lnet/lnet/lib-move.c index 03a721e1bb3d..fb8f7be043ec 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-move.c +++ b/drivers/staging/lustre/lnet/lnet/lib-move.c @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lnet/lnet/lib-ptl.c b/drivers/staging/lustre/lnet/lnet/lib-ptl.c index b4f573ab62cc..bd7b071b2873 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-ptl.c +++ b/drivers/staging/lustre/lnet/lnet/lib-ptl.c @@ -21,7 +21,7 @@ * GPL HEADER END */ /* - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index 6f7ef4c737cd..589ecc84d1b8 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -23,7 +23,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, 2015 Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lnet/lnet/module.c b/drivers/staging/lustre/lnet/lnet/module.c index ac2fdf05a5fd..c93c00752a4c 100644 --- a/drivers/staging/lustre/lnet/lnet/module.c +++ b/drivers/staging/lustre/lnet/lnet/module.c @@ -27,7 +27,7 @@ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c index 4ea651c6db3a..f5faa414d250 100644 --- a/drivers/staging/lustre/lnet/lnet/router.c +++ b/drivers/staging/lustre/lnet/lnet/router.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. * * This file is part of Portals * http://sourceforge.net/projects/sandiaportals/ diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c b/drivers/staging/lustre/lnet/selftest/brw_test.c index 0f262267e01e..1f04cc1fc31c 100644 --- a/drivers/staging/lustre/lnet/selftest/brw_test.c +++ b/drivers/staging/lustre/lnet/selftest/brw_test.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c index 86de68033f85..2acf6ec717be 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.c +++ b/drivers/staging/lustre/lnet/selftest/rpc.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c index fe7c39afd1d9..ff8f38dc10ce 100644 --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2013, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/fid/lproc_fid.c b/drivers/staging/lustre/lustre/fid/lproc_fid.c index ce90c1c54a63..39f2aa32e984 100644 --- a/drivers/staging/lustre/lustre/fid/lproc_fid.c +++ b/drivers/staging/lustre/lustre/fid/lproc_fid.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/fld/fld_internal.h b/drivers/staging/lustre/lustre/fld/fld_internal.h index 959b8e6bba95..12eb1647b4bf 100644 --- a/drivers/staging/lustre/lustre/fld/fld_internal.h +++ b/drivers/staging/lustre/lustre/fld/fld_internal.h @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, 2013, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c index 469df685f392..d92c01b74865 100644 --- a/drivers/staging/lustre/lustre/fld/fld_request.c +++ b/drivers/staging/lustre/lustre/fld/fld_request.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2013, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/fld/lproc_fld.c b/drivers/staging/lustre/lustre/fld/lproc_fld.c index 603f56e6095b..41ceaa8198a7 100644 --- a/drivers/staging/lustre/lustre/fld/lproc_fld.c +++ b/drivers/staging/lustre/lustre/fld/lproc_fld.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, 2013, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h index 73564f8e3884..1e7391ac81cc 100644 --- a/drivers/staging/lustre/lustre/include/cl_object.h +++ b/drivers/staging/lustre/lustre/include/cl_object.h @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h index f18c0c75ef1e..0ac8e0edcc48 100644 --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h index fa78689748a9..1d79341a495d 100644 --- a/drivers/staging/lustre/lustre/include/lu_object.h +++ b/drivers/staging/lustre/lustre/include/lu_object.h @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/include/lustre/ll_fiemap.h b/drivers/staging/lustre/lustre/include/lustre/ll_fiemap.h index 06ce8c9ae9ad..09088f40ba88 100644 --- a/drivers/staging/lustre/lustre/include/lustre/ll_fiemap.h +++ b/drivers/staging/lustre/lustre/include/lustre/ll_fiemap.h @@ -26,6 +26,8 @@ /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2014, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index 0b721c65c2a3..b064b5821e3f 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h index 80f8ec529424..2b4dd656d5f5 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2010, 2012, Intel Corporation. + * Copyright (c) 2010, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 138479a9edc1..9b319f1df025 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2010, 2012, Intel Corporation. + * Copyright (c) 2010, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/include/lustre_export.h b/drivers/staging/lustre/lustre/include/lustre_export.h index 1daf4c572415..311e5aa9b0db 100644 --- a/drivers/staging/lustre/lustre/include/lustre_export.h +++ b/drivers/staging/lustre/lustre/include/lustre_export.h @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/include/lustre_fid.h b/drivers/staging/lustre/lustre/include/lustre_fid.h index 47c3f3750240..9b1a9c695113 100644 --- a/drivers/staging/lustre/lustre/include/lustre_fid.h +++ b/drivers/staging/lustre/lustre/include/lustre_fid.h @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/include/lustre_fld.h b/drivers/staging/lustre/lustre/include/lustre_fld.h index d8b3db9cdeba..551162624974 100644 --- a/drivers/staging/lustre/lustre/include/lustre_fld.h +++ b/drivers/staging/lustre/lustre/include/lustre_fld.h @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2013, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/include/lustre_ha.h b/drivers/staging/lustre/lustre/include/lustre_ha.h index 49dfbb14f381..5488a698dabd 100644 --- a/drivers/staging/lustre/lustre/include/lustre_ha.h +++ b/drivers/staging/lustre/lustre/include/lustre_ha.h @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/include/lustre_log.h b/drivers/staging/lustre/lustre/include/lustre_log.h index 1de0c4d6f7f7..53af4cd1adcc 100644 --- a/drivers/staging/lustre/lustre/include/lustre_log.h +++ b/drivers/staging/lustre/lustre/include/lustre_log.h @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 0127f45ca0c3..d834ddd8183b 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2010, 2012, Intel Corporation. + * Copyright (c) 2010, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/include/lustre_param.h b/drivers/staging/lustre/lustre/include/lustre_param.h index 8f6c0b26cfab..383fe6febe4b 100644 --- a/drivers/staging/lustre/lustre/include/lustre_param.h +++ b/drivers/staging/lustre/lustre/include/lustre_param.h @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/include/lustre_req_layout.h b/drivers/staging/lustre/lustre/include/lustre_req_layout.h index df292f6d4a85..46a662f89322 100644 --- a/drivers/staging/lustre/lustre/include/lustre_req_layout.h +++ b/drivers/staging/lustre/lustre/include/lustre_req_layout.h @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 5c90b59cf0db..bcbe61301713 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index 0b7e90ac7818..97d80397503c 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h index a22a5308fb48..d031437c0528 100644 --- a/drivers/staging/lustre/lustre/include/obd_support.h +++ b/drivers/staging/lustre/lustre/include/obd_support.h @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c index 12c7f0e669d4..34dde7dede74 100644 --- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c +++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h index db3c9b7af7d5..849cc98df7dd 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c index ccce1e503120..3c8d4413d976 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2010, 2012, Intel Corporation. + * Copyright (c) 2010, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 7f8c70056ffd..cf9ec0cfe247 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2010, 2012, Intel Corporation. + * Copyright (c) 2010, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c index ca115119501a..79aeb2bf6c8e 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2010, 2012, Intel Corporation. + * Copyright (c) 2010, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c index e59b2864180f..3d7c137d223a 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2010, 2012, Intel Corporation. + * Copyright (c) 2010, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index fdf81b87aad7..b9eb37762434 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2010, 2012, Intel Corporation. + * Copyright (c) 2010, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index b55a4f0eb1d5..0ae610015b7c 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2010, 2012, Intel Corporation. + * Copyright (c) 2010, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/libcfs/fail.c b/drivers/staging/lustre/lustre/libcfs/fail.c index ea059b012a66..27831432d69a 100644 --- a/drivers/staging/lustre/lustre/libcfs/fail.c +++ b/drivers/staging/lustre/lustre/libcfs/fail.c @@ -26,7 +26,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_lock.c b/drivers/staging/lustre/lustre/libcfs/libcfs_lock.c index 94bc00785000..15782d9e6aa9 100644 --- a/drivers/staging/lustre/lustre/libcfs/libcfs_lock.c +++ b/drivers/staging/lustre/lustre/libcfs/libcfs_lock.c @@ -21,7 +21,7 @@ * GPL HEADER END */ /* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015 Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c index d40be5396769..205a3ed435a8 100644 --- a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c +++ b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015 Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c index 58a4034be1b8..e52afe35e7ea 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c @@ -22,7 +22,8 @@ */ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, Intel Corporation. + * + * Copyright (c) 2012, 2015 Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c index c74c80915dca..68515d9130c1 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c index 75247e920994..329d78ce272d 100644 --- a/drivers/staging/lustre/lustre/libcfs/module.c +++ b/drivers/staging/lustre/lustre/libcfs/module.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015 Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/llite/dcache.c b/drivers/staging/lustre/lustre/llite/dcache.c index 80cba0448499..3d6745e63fe3 100644 --- a/drivers/staging/lustre/lustre/llite/dcache.c +++ b/drivers/staging/lustre/lustre/llite/dcache.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 5c2ef92809e6..7b355319079c 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 02f27593013e..baffd5281af3 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 157c32840e06..eb8d6a7520fd 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 4a8c759fef42..1db93af62bad 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/llite/llite_mmap.c b/drivers/staging/lustre/lustre/llite/llite_mmap.c index 7df978371c9a..bbae95c9feed 100644 --- a/drivers/staging/lustre/lustre/llite/llite_mmap.c +++ b/drivers/staging/lustre/lustre/llite/llite_mmap.c @@ -27,7 +27,7 @@ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c index 190fc44114e1..f134ad9d23f0 100644 --- a/drivers/staging/lustre/lustre/llite/lproc_llite.c +++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 2ca22001a534..14370b97fe5c 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/llite/rw.c b/drivers/staging/lustre/lustre/llite/rw.c index 8184d9d1da52..95cdb0c58b04 100644 --- a/drivers/staging/lustre/lustre/llite/rw.c +++ b/drivers/staging/lustre/lustre/llite/rw.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c index caee0a6f8b84..88ffd8e3abdb 100644 --- a/drivers/staging/lustre/lustre/llite/statahead.c +++ b/drivers/staging/lustre/lustre/llite/statahead.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/llite/vvp_dev.c b/drivers/staging/lustre/lustre/llite/vvp_dev.c index d16d6cfce81a..fdca4ec0555d 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_dev.c +++ b/drivers/staging/lustre/lustre/llite/vvp_dev.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/llite/vvp_internal.h b/drivers/staging/lustre/lustre/llite/vvp_internal.h index b5a6661d47d5..2e39533a45f8 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_internal.h +++ b/drivers/staging/lustre/lustre/llite/vvp_internal.h @@ -26,6 +26,8 @@ /* * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2013, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c index 37773c181729..346b8a19dacd 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_io.c +++ b/drivers/staging/lustre/lustre/llite/vvp_io.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/llite/vvp_lock.c b/drivers/staging/lustre/lustre/llite/vvp_lock.c index f7b1144aadee..ff0948043c7a 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_lock.c +++ b/drivers/staging/lustre/lustre/llite/vvp_lock.c @@ -26,6 +26,8 @@ /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2014, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/llite/vvp_object.c b/drivers/staging/lustre/lustre/llite/vvp_object.c index e13afb7e8dca..c82714ea898e 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_object.c +++ b/drivers/staging/lustre/lustre/llite/vvp_object.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/llite/vvp_page.c b/drivers/staging/lustre/lustre/llite/vvp_page.c index 92f60c350f35..99c0d7aee921 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_page.c +++ b/drivers/staging/lustre/lustre/llite/vvp_page.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index 4b7eb33f7d01..92f579e51cf2 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/llite/xattr_cache.c b/drivers/staging/lustre/lustre/llite/xattr_cache.c index e1e599ceb173..d1402762a0b2 100644 --- a/drivers/staging/lustre/lustre/llite/xattr_cache.c +++ b/drivers/staging/lustre/lustre/llite/xattr_cache.c @@ -1,6 +1,8 @@ /* * Copyright 2012 Xyratex Technology Limited * + * Copyright (c) 2013, 2015, Intel Corporation. + * * Author: Andrew Perepechko * */ diff --git a/drivers/staging/lustre/lustre/lmv/lmv_intent.c b/drivers/staging/lustre/lustre/lmv/lmv_intent.c index 3c585aea5bb8..66de27f1d289 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_intent.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_intent.c @@ -27,7 +27,7 @@ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/lmv/lmv_internal.h b/drivers/staging/lustre/lustre/lmv/lmv_internal.h index 467cfb3e7fca..eb8e673cbc3f 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_internal.h +++ b/drivers/staging/lustre/lustre/lmv/lmv_internal.h @@ -27,7 +27,7 @@ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index a4de9a3fd847..bbafe0a710d8 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -27,7 +27,7 @@ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h index 1c0fe65243e1..66a2492c1cc3 100644 --- a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015 Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/lov/lov_dev.c b/drivers/staging/lustre/lustre/lov/lov_dev.c index 2e8b566458f6..3733fdc88c8c 100644 --- a/drivers/staging/lustre/lustre/lov/lov_dev.c +++ b/drivers/staging/lustre/lustre/lov/lov_dev.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/lov/lov_ea.c b/drivers/staging/lustre/lustre/lov/lov_ea.c index 34c1346f0dc7..b3c9c85aab9d 100644 --- a/drivers/staging/lustre/lustre/lov/lov_ea.c +++ b/drivers/staging/lustre/lustre/lov/lov_ea.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index b8028735e568..2d00bad58e35 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index 5e6228b9ca01..93fe69eb2560 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/lov/lov_merge.c b/drivers/staging/lustre/lustre/lov/lov_merge.c index dd1cf3d2d039..97115bec7cca 100644 --- a/drivers/staging/lustre/lustre/lov/lov_merge.c +++ b/drivers/staging/lustre/lustre/lov/lov_merge.c @@ -27,7 +27,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index b52609aead4c..6c2bdfe9cdcf 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index c7ff817bb6fb..3b79ebc8eccf 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/lov/lov_offset.c b/drivers/staging/lustre/lustre/lov/lov_offset.c index 9c8c77c05a8a..aa520aa76e09 100644 --- a/drivers/staging/lustre/lustre/lov/lov_offset.c +++ b/drivers/staging/lustre/lustre/lov/lov_offset.c @@ -27,7 +27,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index 2fb1e974cc70..198523139b3b 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/lov/lov_page.c b/drivers/staging/lustre/lustre/lov/lov_page.c index 463cadbd9d40..037ae91b74e7 100644 --- a/drivers/staging/lustre/lustre/lov/lov_page.c +++ b/drivers/staging/lustre/lustre/lov/lov_page.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c index bb1a03fef60d..42deda71f577 100644 --- a/drivers/staging/lustre/lustre/lov/lov_request.c +++ b/drivers/staging/lustre/lustre/lov/lov_request.c @@ -27,7 +27,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/lov/lovsub_dev.c b/drivers/staging/lustre/lustre/lov/lovsub_dev.c index 8bc04c8d3d60..f1795c3e2db5 100644 --- a/drivers/staging/lustre/lustre/lov/lovsub_dev.c +++ b/drivers/staging/lustre/lustre/lov/lovsub_dev.c @@ -26,6 +26,8 @@ /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2013, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/lov/lovsub_object.c b/drivers/staging/lustre/lustre/lov/lovsub_object.c index d775e28d4097..5ba5ee1b8681 100644 --- a/drivers/staging/lustre/lustre/lov/lovsub_object.c +++ b/drivers/staging/lustre/lustre/lov/lovsub_object.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015 Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/lov/lproc_lov.c b/drivers/staging/lustre/lustre/lov/lproc_lov.c index a0be15c6b55a..337241d84980 100644 --- a/drivers/staging/lustre/lustre/lov/lproc_lov.c +++ b/drivers/staging/lustre/lustre/lov/lproc_lov.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015 Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c index 84e586223588..38f267a60f59 100644 --- a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c +++ b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/mdc/mdc_internal.h b/drivers/staging/lustre/lustre/mdc/mdc_internal.h index df50bdbcde19..3d2997a161b6 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_internal.h +++ b/drivers/staging/lustre/lustre/mdc/mdc_internal.h @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, Intel Corporation. + * Copyright (c) 2011, 2015 Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/mdc/mdc_lib.c b/drivers/staging/lustre/lustre/mdc/mdc_lib.c index 227fc9ee0dcf..7218532ffea3 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_lib.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_lib.c @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index d4bf34b61f3a..ef9a1e124ea4 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/mdc/mdc_reint.c b/drivers/staging/lustre/lustre/mdc/mdc_reint.c index c87c7d8efa07..ac7695a10753 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_reint.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_reint.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index e172be1bc1c6..8baf726a983f 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -27,7 +27,7 @@ * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index 2c4884727626..06dc2c3d36c2 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/obdclass/cl_io.c b/drivers/staging/lustre/lustre/obdclass/cl_io.c index e67cea758405..ab7e11041339 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_io.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_io.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c b/drivers/staging/lustre/lustre/obdclass/cl_object.c index a1a6024220ff..73ea8458af18 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_object.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c b/drivers/staging/lustre/lustre/obdclass/cl_page.c index 2f569edd0811..61f28ebfc058 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_page.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c index beb59f009cbe..0975e443057c 100644 --- a/drivers/staging/lustre/lustre/obdclass/class_obd.c +++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c @@ -27,7 +27,7 @@ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index 26f54f950350..228c44c37c4a 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -27,7 +27,7 @@ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c index 518288df4d53..42fc26f4ae25 100644 --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c @@ -27,7 +27,7 @@ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/obdclass/llog.c b/drivers/staging/lustre/lustre/obdclass/llog.c index 7cb55ef79737..f956d7ed6785 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog.c +++ b/drivers/staging/lustre/lustre/obdclass/llog.c @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/obdclass/llog_cat.c b/drivers/staging/lustre/lustre/obdclass/llog_cat.c index c442cae5fd37..0f05e9c4a5b2 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog_cat.c +++ b/drivers/staging/lustre/lustre/obdclass/llog_cat.c @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/obdclass/llog_internal.h b/drivers/staging/lustre/lustre/obdclass/llog_internal.h index b9fe4b01c690..7fb48dda355e 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog_internal.h +++ b/drivers/staging/lustre/lustre/obdclass/llog_internal.h @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/obdclass/llog_obd.c b/drivers/staging/lustre/lustre/obdclass/llog_obd.c index 3900b9d4007e..9bc51998c05c 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog_obd.c +++ b/drivers/staging/lustre/lustre/obdclass/llog_obd.c @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/obdclass/llog_swab.c b/drivers/staging/lustre/lustre/obdclass/llog_swab.c index 9354f75b5cab..3aa7393b20c3 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog_swab.c +++ b/drivers/staging/lustre/lustre/obdclass/llog_swab.c @@ -27,7 +27,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index dda5ad105f2e..51fe15f5d687 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index 0193608a930a..76ad9dc0447a 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c index c231e0da0e2a..49cdc647910c 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c index 7617c57d16e0..b5aa8168dbff 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index 46822183b9f5..b3463040c1ed 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c index c4d44e70f1d7..1091536fc90d 100644 --- a/drivers/staging/lustre/lustre/osc/lproc_osc.c +++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index b1d1a87f05e3..46cfde4b139f 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. * */ /* diff --git a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h index d2d68452d382..415c27e4ab66 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h +++ b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/osc/osc_dev.c b/drivers/staging/lustre/lustre/osc/osc_dev.c index 69b523c0f570..7078cc57d8b9 100644 --- a/drivers/staging/lustre/lustre/osc/osc_dev.c +++ b/drivers/staging/lustre/lustre/osc/osc_dev.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/osc/osc_internal.h b/drivers/staging/lustre/lustre/osc/osc_internal.h index db2ee9c23b42..a4c61463b1c7 100644 --- a/drivers/staging/lustre/lustre/osc/osc_internal.h +++ b/drivers/staging/lustre/lustre/osc/osc_internal.h @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c index d413496c0f63..abd0beb483fe 100644 --- a/drivers/staging/lustre/lustre/osc/osc_io.c +++ b/drivers/staging/lustre/lustre/osc/osc_io.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c index 194490dcaca9..71f2810d18b9 100644 --- a/drivers/staging/lustre/lustre/osc/osc_lock.c +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/osc/osc_object.c b/drivers/staging/lustre/lustre/osc/osc_object.c index ba57f8df5c7f..c29a0d45ffed 100644 --- a/drivers/staging/lustre/lustre/osc/osc_object.c +++ b/drivers/staging/lustre/lustre/osc/osc_object.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/osc/osc_page.c b/drivers/staging/lustre/lustre/osc/osc_page.c index 61eaf7172fdf..2439d804fe75 100644 --- a/drivers/staging/lustre/lustre/osc/osc_page.c +++ b/drivers/staging/lustre/lustre/osc/osc_page.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/osc/osc_quota.c b/drivers/staging/lustre/lustre/osc/osc_quota.c index 199783103f71..e70e7961d763 100644 --- a/drivers/staging/lustre/lustre/osc/osc_quota.c +++ b/drivers/staging/lustre/lustre/osc/osc_quota.c @@ -23,7 +23,7 @@ /* * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. * * Code originally extracted from quota directory */ diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index d6c1447f6bd9..b2642a798857 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index a9f1bf536da9..efdda09507bf 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c b/drivers/staging/lustre/lustre/ptlrpc/events.c index 9c2fd34e2eb9..990156986986 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/events.c +++ b/drivers/staging/lustre/lustre/ptlrpc/events.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015 Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c index bfa410f7e773..f752c789bda0 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/import.c +++ b/drivers/staging/lustre/lustre/ptlrpc/import.c @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ptlrpc/layout.c b/drivers/staging/lustre/lustre/ptlrpc/layout.c index d7c4f47808bd..c0e613c23854 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/layout.c +++ b/drivers/staging/lustre/lustre/ptlrpc/layout.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ptlrpc/llog_client.c b/drivers/staging/lustre/lustre/ptlrpc/llog_client.c index 5122205cbb99..e87702073f1f 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/llog_client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/llog_client.c @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c index 2aecab21e3e1..cc55b7973721 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c index 09ddeef6ba48..c5d7ff5cbd73 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c +++ b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ptlrpc/pers.c b/drivers/staging/lustre/lustre/ptlrpc/pers.c index 2a2a9fb6549c..ec3af109a1d7 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pers.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pers.c @@ -26,6 +26,8 @@ /* * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2014, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ptlrpc/pinger.c b/drivers/staging/lustre/lustre/ptlrpc/pinger.c index 5c719f175657..fb2d5236a971 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h index 833ed944125e..8f67e0562b73 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c index ac87aa12bd7e..60fb0ced7137 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c @@ -27,7 +27,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ptlrpc/recover.c b/drivers/staging/lustre/lustre/ptlrpc/recover.c index 7b1d72947330..db6626cab6f2 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/recover.c +++ b/drivers/staging/lustre/lustre/ptlrpc/recover.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c index cd8a9987f7ac..6152c1b766c3 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c index 7a206705865b..4b0b81c115ee 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c @@ -27,7 +27,7 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c b/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c index f448b4567af0..905a41451ca3 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2012, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index f45898f17793..8598300a61d1 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -27,7 +27,7 @@ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2010, 2012, Intel Corporation. + * Copyright (c) 2010, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ diff --git a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c index 40f720ca3b14..61d9ca93c53a 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c +++ b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c @@ -27,7 +27,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, Intel Corporation. + * Copyright (c) 2011, 2015, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ From f11e1de21a26ed30171f770e894a9cf0bfa31ffd Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Sun, 8 Nov 2015 23:27:15 -0500 Subject: [PATCH 755/843] staging: lustre: remove {linux,posix}-tracefile.h Move the definition of the trace buffer type enum in libcfs/libcfs/tracefile.h. Remove the then unneeded headers libcfs/libcfs/linux/linux-tracefile.h and libcfs/libcfs/posix/posix-tracefile.h. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675 Reviewed-on: http://review.whamcloud.com/11983 Reviewed-by: Bob Glossman Reviewed-by: James Simmons Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- .../lustre/libcfs/linux/linux-tracefile.h | 48 ------------------- .../staging/lustre/lustre/libcfs/tracefile.h | 7 ++- 2 files changed, 6 insertions(+), 49 deletions(-) delete mode 100644 drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.h diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.h b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.h deleted file mode 100644 index ba84e4ffddd1..000000000000 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - */ - -#ifndef __LIBCFS_LINUX_TRACEFILE_H__ -#define __LIBCFS_LINUX_TRACEFILE_H__ - -/** - * three types of trace_data in linux - */ -typedef enum { - CFS_TCD_TYPE_PROC = 0, - CFS_TCD_TYPE_SOFTIRQ, - CFS_TCD_TYPE_IRQ, - CFS_TCD_TYPE_MAX -} cfs_trace_buf_type_t; - -#endif diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.h b/drivers/staging/lustre/lustre/libcfs/tracefile.h index 6b37798336f2..b71b94fd7c35 100644 --- a/drivers/staging/lustre/lustre/libcfs/tracefile.h +++ b/drivers/staging/lustre/lustre/libcfs/tracefile.h @@ -39,7 +39,12 @@ #include "../../include/linux/libcfs/libcfs.h" -#include "linux/linux-tracefile.h" +typedef enum { + CFS_TCD_TYPE_PROC = 0, + CFS_TCD_TYPE_SOFTIRQ, + CFS_TCD_TYPE_IRQ, + CFS_TCD_TYPE_MAX +} cfs_trace_buf_type_t; /* trace file lock routines */ From bc2105370e6efdcc7648390246df4131a13e5016 Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Sun, 8 Nov 2015 23:27:16 -0500 Subject: [PATCH 756/843] staging: lustre: remove obsolete comment in tracefile.h Remove comment about tracefile handling for user land version of libcfs that no longer exist. Broken out of patch http://review.whamcloud.com/11983. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675 Reviewed-on: http://review.whamcloud.com/11983 Reviewed-by: Bob Glossman Reviewed-by: James Simmons Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/tracefile.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.h b/drivers/staging/lustre/lustre/libcfs/tracefile.h index b71b94fd7c35..7bf1471a54fb 100644 --- a/drivers/staging/lustre/lustre/libcfs/tracefile.h +++ b/drivers/staging/lustre/lustre/libcfs/tracefile.h @@ -256,13 +256,6 @@ void cfs_print_to_console(struct ptldebug_header *hdr, int mask, int cfs_trace_lock_tcd(struct cfs_trace_cpu_data *tcd, int walking); void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking); -/** - * trace_buf_type_t, trace_buf_idx_get() and trace_console_buffers[][] - * are not public libcfs API; they should be defined in - * platform-specific tracefile include files - * (see, for example, linux-tracefile.h). - */ - extern char *cfs_trace_console_buffers[NR_CPUS][CFS_TCD_TYPE_MAX]; cfs_trace_buf_type_t cfs_trace_buf_idx_get(void); From 97c2bb7bc5faf5e264c73bbe03517f2eac34b292 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Tue, 10 Nov 2015 00:24:17 +0530 Subject: [PATCH 757/843] staging: lustre: acl: Remove lustre_posix_acl_xattr_free wrapper Remove the wrapper function lustre_posix_acl_xattr_free() and replace its call in the file xattr with the function kfree() that it wrapped. Also, its prototype from the header lustre_eacl is removed as it is no longer of any use. Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/include/lustre_eacl.h | 2 -- drivers/staging/lustre/lustre/llite/xattr.c | 5 ++++- drivers/staging/lustre/lustre/obdclass/acl.c | 9 --------- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_eacl.h b/drivers/staging/lustre/lustre/include/lustre_eacl.h index fee4d2c75506..0b66593a9526 100644 --- a/drivers/staging/lustre/lustre/include/lustre_eacl.h +++ b/drivers/staging/lustre/lustre/include/lustre_eacl.h @@ -76,8 +76,6 @@ extern int lustre_posix_acl_xattr_filter(posix_acl_xattr_header *header, size_t size, posix_acl_xattr_header **out); extern void -lustre_posix_acl_xattr_free(posix_acl_xattr_header *header, int size); -extern void lustre_ext_acl_xattr_free(ext_acl_xattr_header *header); extern ext_acl_xattr_header * lustre_acl_xattr_merge2ext(posix_acl_xattr_header *posix_header, int size, diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index 92f579e51cf2..4d91538668ac 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c @@ -193,7 +193,10 @@ int ll_setxattr_common(struct inode *inode, const char *name, ll_i2suppgid(inode), &req); #ifdef CONFIG_FS_POSIX_ACL if (new_value != NULL) - lustre_posix_acl_xattr_free(new_value, size); + /* + * Release the posix ACL space. + */ + kfree(new_value); if (acl != NULL) lustre_ext_acl_xattr_free(acl); #endif diff --git a/drivers/staging/lustre/lustre/obdclass/acl.c b/drivers/staging/lustre/lustre/obdclass/acl.c index 2e20cf635b27..49ba8851c8ac 100644 --- a/drivers/staging/lustre/lustre/obdclass/acl.c +++ b/drivers/staging/lustre/lustre/obdclass/acl.c @@ -235,15 +235,6 @@ _out: } EXPORT_SYMBOL(lustre_posix_acl_xattr_filter); -/* - * Release the posix ACL space. - */ -void lustre_posix_acl_xattr_free(posix_acl_xattr_header *header, int size) -{ - kfree(header); -} -EXPORT_SYMBOL(lustre_posix_acl_xattr_free); - /* * Release the extended ACL space. */ From c328ae39e5d66be956fbdfbb7fba544ed1552fe2 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Wed, 11 Nov 2015 14:29:07 +0530 Subject: [PATCH 758/843] staging: lustre: cl_io: Remove cl_lock_descr_fid wrapper Remove unnecessary wrapper function cl_lock_descr_fid() and replace all its calls with the function it wrapped. Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/cl_io.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_io.c b/drivers/staging/lustre/lustre/obdclass/cl_io.c index ab7e11041339..08723a3f2880 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_io.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_io.c @@ -236,16 +236,11 @@ int cl_io_rw_init(const struct lu_env *env, struct cl_io *io, } EXPORT_SYMBOL(cl_io_rw_init); -static inline const struct lu_fid * -cl_lock_descr_fid(const struct cl_lock_descr *descr) -{ - return lu_object_fid(&descr->cld_obj->co_lu); -} - static int cl_lock_descr_sort(const struct cl_lock_descr *d0, const struct cl_lock_descr *d1) { - return lu_fid_cmp(cl_lock_descr_fid(d0), cl_lock_descr_fid(d1)) ?: + return lu_fid_cmp(lu_object_fid(&d0->cld_obj->co_lu), + lu_object_fid(&d1->cld_obj->co_lu)) ?: __diff_normalize(d0->cld_start, d1->cld_start); } @@ -254,7 +249,8 @@ static int cl_lock_descr_cmp(const struct cl_lock_descr *d0, { int ret; - ret = lu_fid_cmp(cl_lock_descr_fid(d0), cl_lock_descr_fid(d1)); + ret = lu_fid_cmp(lu_object_fid(&d0->cld_obj->co_lu), + lu_object_fid(&d1->cld_obj->co_lu)); if (ret) return ret; if (d0->cld_end < d1->cld_start) From 53f1a12768a55e53b2c40e00a8804b1edfa739b3 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Wed, 11 Nov 2015 15:43:28 +0530 Subject: [PATCH 759/843] staging: lustre: Remove cl_2queue_add wrapper Remove the wrapper function cl_2queue_add() and replace all its calls in different files with the function it wrapped. Also, comments are added wherever necessary to make the working of function clear. Prototype of the function is also removed from the header file as it is no longer needed. Signed-off-by: Shivani Bhardwaj Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/include/cl_object.h | 1 - drivers/staging/lustre/lustre/llite/rw26.c | 5 ++++- drivers/staging/lustre/lustre/llite/vvp_io.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_io.c | 14 ++++---------- .../staging/lustre/lustre/obdecho/echo_client.c | 6 ++++-- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h index 1e7391ac81cc..bd7acc2a1219 100644 --- a/drivers/staging/lustre/lustre/include/cl_object.h +++ b/drivers/staging/lustre/lustre/include/cl_object.h @@ -3127,7 +3127,6 @@ void cl_page_list_disown (const struct lu_env *env, struct cl_io *io, struct cl_page_list *plist); void cl_2queue_init (struct cl_2queue *queue); -void cl_2queue_add (struct cl_2queue *queue, struct cl_page *page); void cl_2queue_disown (const struct lu_env *env, struct cl_io *io, struct cl_2queue *queue); void cl_2queue_discard (const struct lu_env *env, diff --git a/drivers/staging/lustre/lustre/llite/rw26.c b/drivers/staging/lustre/lustre/llite/rw26.c index 3da4c01e2159..39fa13b74cbd 100644 --- a/drivers/staging/lustre/lustre/llite/rw26.c +++ b/drivers/staging/lustre/lustre/llite/rw26.c @@ -298,7 +298,10 @@ ssize_t ll_direct_rw_pages(const struct lu_env *env, struct cl_io *io, } if (likely(do_io)) { - cl_2queue_add(queue, clp); + /* + * Add a page to the incoming page list of 2-queue. + */ + cl_page_list_add(&queue->c2_qin, clp); /* * Set page clip to tell transfer formation engine diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c index 346b8a19dacd..f68e972886ca 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_io.c +++ b/drivers/staging/lustre/lustre/llite/vvp_io.c @@ -849,7 +849,7 @@ static int vvp_io_read_page(const struct lu_env *env, * Add page into the queue even when it is marked uptodate above. * this will unlock it automatically as part of cl_page_list_disown(). */ - cl_2queue_add(queue, page); + cl_page_list_add(&queue->c2_qin, page); if (sbi->ll_ra_info.ra_max_pages_per_file && sbi->ll_ra_info.ra_max_pages) ll_readahead(env, io, ras, diff --git a/drivers/staging/lustre/lustre/obdclass/cl_io.c b/drivers/staging/lustre/lustre/obdclass/cl_io.c index 08723a3f2880..63246ba36798 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_io.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_io.c @@ -1211,15 +1211,6 @@ void cl_2queue_init(struct cl_2queue *queue) } EXPORT_SYMBOL(cl_2queue_init); -/** - * Add a page to the incoming page list of 2-queue. - */ -void cl_2queue_add(struct cl_2queue *queue, struct cl_page *page) -{ - cl_page_list_add(&queue->c2_qin, page); -} -EXPORT_SYMBOL(cl_2queue_add); - /** * Disown pages in both lists of a 2-queue. */ @@ -1258,7 +1249,10 @@ EXPORT_SYMBOL(cl_2queue_fini); void cl_2queue_init_page(struct cl_2queue *queue, struct cl_page *page) { cl_2queue_init(queue); - cl_2queue_add(queue, page); + /* + * Add a page to the incoming page list of 2-queue. + */ + cl_page_list_add(&queue->c2_qin, page); } EXPORT_SYMBOL(cl_2queue_init_page); diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index b3463040c1ed..7b53f7dd1797 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -1228,8 +1228,10 @@ static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset, cl_page_put(env, clp); break; } - - cl_2queue_add(queue, clp); + /* + * Add a page to the incoming page list of 2-queue. + */ + cl_page_list_add(&queue->c2_qin, clp); /* drop the reference count for cl_page_find, so that the page * will be freed in cl_2queue_fini. */ From d2d32738ded3825a6608e0d34e276c30c96e63b2 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 14 Nov 2015 13:30:34 +0100 Subject: [PATCH 760/843] lustre: constify inode_operations structures The inode_operations structures are never modified, so declare them as const, like all the other inode_operations structures. Done with the help of Coccinelle. Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/file.c | 2 +- drivers/staging/lustre/lustre/llite/llite_internal.h | 4 ++-- drivers/staging/lustre/lustre/llite/symlink.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index baffd5281af3..c92d58b770ec 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -3139,7 +3139,7 @@ struct file_operations ll_file_operations_noflock = { .lock = ll_file_noflock }; -struct inode_operations ll_file_inode_operations = { +const struct inode_operations ll_file_inode_operations = { .setattr = ll_setattr, .getattr = ll_getattr, .permission = ll_inode_permission, diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index eb8d6a7520fd..ee8a1d67d191 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -705,7 +705,7 @@ extern const struct address_space_operations ll_aops; extern struct file_operations ll_file_operations; extern struct file_operations ll_file_operations_flock; extern struct file_operations ll_file_operations_noflock; -extern struct inode_operations ll_file_inode_operations; +extern const struct inode_operations ll_file_inode_operations; int ll_have_md_lock(struct inode *inode, __u64 *bits, ldlm_mode_t l_req_mode); ldlm_mode_t ll_take_md_lock(struct inode *inode, __u64 bits, @@ -805,7 +805,7 @@ struct inode *search_inode_for_lustre(struct super_block *sb, const struct lu_fid *fid); /* llite/symlink.c */ -extern struct inode_operations ll_fast_symlink_inode_operations; +extern const struct inode_operations ll_fast_symlink_inode_operations; /* llite/llite_close.c */ struct ll_close_queue { diff --git a/drivers/staging/lustre/lustre/llite/symlink.c b/drivers/staging/lustre/lustre/llite/symlink.c index 69b203651905..32c4cf48b318 100644 --- a/drivers/staging/lustre/lustre/llite/symlink.c +++ b/drivers/staging/lustre/lustre/llite/symlink.c @@ -146,7 +146,7 @@ static void ll_put_link(struct inode *unused, void *cookie) ptlrpc_req_finished(cookie); } -struct inode_operations ll_fast_symlink_inode_operations = { +const struct inode_operations ll_fast_symlink_inode_operations = { .readlink = generic_readlink, .setattr = ll_setattr, .follow_link = ll_follow_link, From 71872e9cc2af4dca1903ebc57daa15f08c795d86 Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 17 Nov 2015 22:06:40 +0200 Subject: [PATCH 761/843] staging: lustre: hash.c: Replace IS_PO2 by is_power_of_2 Replaces IS_PO2 by is_power_of_2. It is more accurate to use is_power_of_2 since it returns 1 for numbers that are powers of 2 only whereas IS_PO2 returns 1 for 0 and numbers that are powers of 2. Reviewed-by: Andreas Dilger Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/hash.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c index d285117af3ad..4d50510434be 100644 --- a/drivers/staging/lustre/lustre/libcfs/hash.c +++ b/drivers/staging/lustre/lustre/libcfs/hash.c @@ -107,6 +107,7 @@ * table. Also, user can break the iteration by return 1 in callback. */ #include +#include #include "../../include/linux/libcfs/libcfs.h" @@ -1777,7 +1778,7 @@ cfs_hash_rehash_cancel_locked(struct cfs_hash *hs) for (i = 2; cfs_hash_is_rehashing(hs); i++) { cfs_hash_unlock(hs, 1); /* raise console warning while waiting too long */ - CDEBUG(IS_PO2(i >> 3) ? D_WARNING : D_INFO, + CDEBUG(is_power_of_2(i >> 3) ? D_WARNING : D_INFO, "hash %s is still rehashing, rescheded %d\n", hs->hs_name, i - 1); cond_resched(); From d4891039904fa25edf1ca793a0469633ed81df3f Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 17 Nov 2015 22:07:07 +0200 Subject: [PATCH 762/843] staging: lustre: libcfs.h: remove IS_PO2 and __is_po2 Removes IS_PO2 and __is_po2 since the uses of IS_PO2 have been replaced by is_power_of_2 Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/include/linux/libcfs/libcfs.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h index 049f6a9a638b..0d8a91ee5ffc 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h @@ -42,13 +42,6 @@ #include "curproc.h" -static inline int __is_po2(unsigned long long val) -{ - return !(val & (val - 1)); -} - -#define IS_PO2(val) __is_po2((unsigned long long)(val)) - #define LOWEST_BIT_SET(x) ((x) & ~((x) - 1)) /* From f916774259d60e8ecd2cdd90e712e4c2fc64b947 Mon Sep 17 00:00:00 2001 From: Anjali Menon Date: Fri, 20 Nov 2015 11:25:22 +0530 Subject: [PATCH 763/843] staging: lustre: lustre: fld: Removed a blank line Removed a blank line after the open brace to remove the check detected by the checkpatch.pl. CHECK: Blank lines aren't necessary after an open brace '{' Signed-off-by: Anjali Menon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/fld/fld_cache.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/fld/fld_cache.c b/drivers/staging/lustre/lustre/fld/fld_cache.c index baa04074a61f..d9459e58e2ce 100644 --- a/drivers/staging/lustre/lustre/fld/fld_cache.c +++ b/drivers/staging/lustre/lustre/fld/fld_cache.c @@ -227,7 +227,6 @@ static int fld_cache_shrink(struct fld_cache *cache) while (cache->fci_cache_count + cache->fci_threshold > cache->fci_cache_size && curr != &cache->fci_lru) { - flde = list_entry(curr, struct fld_cache_entry, fce_lru); curr = curr->prev; fld_cache_entry_delete(cache, flde); From 20b0236628a8a420bfbf8a3d39576e2ed606fce7 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Sun, 6 Dec 2015 01:41:31 +0100 Subject: [PATCH 764/843] staging: lustre: fix %.2X versus signed char issue When char is signed and one of the bytes in lmm happens to have a byte value above 127, the result of printing that with %.2X will be 8 hex chars, the first 6 of which are 'F'. Worst case, we'll overrun our 'carefully' allocated buffer. I didn't have the tenacity to work through the gazillion and seven layers of macros behind CERROR, but I assume it'll all end at some function implemented in terms of the kernel's vsnprintf. Use %*phN for a hexdump. That'll cap the number of dumped bytes at 64. If that's a problem, the loop could be replaced by "bin2hex(buffer, lmm, lmm_bytes);". Signed-off-by: Rasmus Villemoes Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/lov/lov_pack.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index 198523139b3b..6b2d1007192b 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -258,22 +258,9 @@ static int lov_verify_lmm(void *lmm, int lmm_bytes, __u16 *stripe_count) int rc; if (lsm_op_find(le32_to_cpu(*(__u32 *)lmm)) == NULL) { - char *buffer; - int sz; - CERROR("bad disk LOV MAGIC: 0x%08X; dumping LMM (size=%d):\n", le32_to_cpu(*(__u32 *)lmm), lmm_bytes); - sz = lmm_bytes * 2 + 1; - buffer = libcfs_kvzalloc(sz, GFP_NOFS); - if (buffer != NULL) { - int i; - - for (i = 0; i < lmm_bytes; i++) - sprintf(buffer+2*i, "%.2X", ((char *)lmm)[i]); - buffer[sz - 1] = '\0'; - CERROR("%s\n", buffer); - kvfree(buffer); - } + CERROR("%*phN\n", lmm_bytes, lmm); return -EINVAL; } rc = lsm_op_find(le32_to_cpu(*(__u32 *)lmm))->lsm_lmm_verify(lmm, From 4e8d4e1b79896332205e5f505877b1bc6cff1d10 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Wed, 16 Dec 2015 23:10:15 +0530 Subject: [PATCH 765/843] Staging: lustre: include: Remove unused llog_backup declaration Function llog_backup is declared in header file but not used. Thus remove it. Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/include/lustre_log.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_log.h b/drivers/staging/lustre/lustre/include/lustre_log.h index 53af4cd1adcc..e4fc8b5e1336 100644 --- a/drivers/staging/lustre/lustre/include/lustre_log.h +++ b/drivers/staging/lustre/lustre/include/lustre_log.h @@ -94,9 +94,6 @@ int llog_open(const struct lu_env *env, struct llog_ctxt *ctxt, struct llog_handle **lgh, struct llog_logid *logid, char *name, enum llog_open_param open_param); int llog_close(const struct lu_env *env, struct llog_handle *cathandle); -int llog_backup(const struct lu_env *env, struct obd_device *obd, - struct llog_ctxt *ctxt, struct llog_ctxt *bak_ctxt, - char *name, char *backup); /* llog_process flags */ #define LLOG_FLAG_NODEAMON 0x0001 From 4f05f8ae0a20f692f5138e0383d4cee486ae7127 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Wed, 16 Dec 2015 23:10:17 +0530 Subject: [PATCH 766/843] Staging: lustre: lnet: Remove functions LNetEQWait and LNetEQGet Functions LNetEQWait and LNetEQGet are defined but not used. Thus remove it. Also remove corresponding declarations from header file. Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- .../staging/lustre/include/linux/lnet/api.h | 6 ------ drivers/staging/lustre/lnet/lnet/lib-eq.c | 18 ------------------ 2 files changed, 24 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/api.h b/drivers/staging/lustre/include/linux/lnet/api.h index 9493d5e236c5..75285fde15e8 100644 --- a/drivers/staging/lustre/include/linux/lnet/api.h +++ b/drivers/staging/lustre/include/linux/lnet/api.h @@ -161,12 +161,6 @@ int LNetEQAlloc(unsigned int count_in, int LNetEQFree(lnet_handle_eq_t eventq_in); -int LNetEQGet(lnet_handle_eq_t eventq_in, - lnet_event_t *event_out); - -int LNetEQWait(lnet_handle_eq_t eventq_in, - lnet_event_t *event_out); - int LNetEQPoll(lnet_handle_eq_t *eventqs_in, int neq_in, int timeout_ms, diff --git a/drivers/staging/lustre/lnet/lnet/lib-eq.c b/drivers/staging/lustre/lnet/lnet/lib-eq.c index 60889ebd2f2b..64f94a690081 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-eq.c +++ b/drivers/staging/lustre/lnet/lnet/lib-eq.c @@ -282,15 +282,6 @@ lnet_eq_dequeue_event(lnet_eq_t *eq, lnet_event_t *ev) * at least one event between this event and the last event obtained from the * EQ has been dropped due to limited space in the EQ. */ -int -LNetEQGet(lnet_handle_eq_t eventq, lnet_event_t *event) -{ - int which; - - return LNetEQPoll(&eventq, 1, 0, - event, &which); -} -EXPORT_SYMBOL(LNetEQGet); /** * Block the calling process until there is an event in the EQ. @@ -308,15 +299,6 @@ EXPORT_SYMBOL(LNetEQGet); * at least one event between this event and the last event obtained from the * EQ has been dropped due to limited space in the EQ. */ -int -LNetEQWait(lnet_handle_eq_t eventq, lnet_event_t *event) -{ - int which; - - return LNetEQPoll(&eventq, 1, LNET_TIME_FOREVER, - event, &which); -} -EXPORT_SYMBOL(LNetEQWait); static int lnet_eq_wait_locked(int *timeout_ms) From 9569ea54ebadbb01746b7d6a5e79a16f78eaa1ae Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Fri, 18 Dec 2015 02:40:26 +0530 Subject: [PATCH 767/843] Staging: lustre: obdclass: Declare cl_env_peek as static Declare cl_env_peek as static since it is used only in this file. Also remove the EXPORT SYMBOL. Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/cl_object.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c b/drivers/staging/lustre/lustre/obdclass/cl_object.c index 73ea8458af18..57c8d5412bbd 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_object.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c @@ -704,7 +704,7 @@ static inline struct cl_env *cl_env_container(struct lu_env *env) return container_of(env, struct cl_env, ce_lu); } -struct lu_env *cl_env_peek(int *refcheck) +static struct lu_env *cl_env_peek(int *refcheck) { struct lu_env *env; struct cl_env *cle; @@ -724,7 +724,6 @@ struct lu_env *cl_env_peek(int *refcheck) CDEBUG(D_OTHER, "%d@%p\n", cle ? cle->ce_ref : 0, cle); return env; } -EXPORT_SYMBOL(cl_env_peek); /** * Returns lu_env: if there already is an environment associated with the From 62dc2f66a9267388722a0b1a0c0c253299a3dfc1 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Fri, 18 Dec 2015 02:40:27 +0530 Subject: [PATCH 768/843] Staging: lustre: libcfs: Remove unused libcfs_debug_set_level Function libcfs_debug_set_level is defined but not used. Thus remove it. Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/libcfs/debug.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c b/drivers/staging/lustre/lustre/libcfs/debug.c index e56785a48242..0b38dad13546 100644 --- a/drivers/staging/lustre/lustre/libcfs/debug.c +++ b/drivers/staging/lustre/lustre/libcfs/debug.c @@ -557,10 +557,3 @@ int libcfs_debug_mark_buffer(const char *text) #undef DEBUG_SUBSYSTEM #define DEBUG_SUBSYSTEM S_LNET - -void libcfs_debug_set_level(unsigned int debug_level) -{ - pr_warn("Lustre: Setting portals debug level to %08x\n", - debug_level); - libcfs_debug = debug_level; -} From 6ef3f3c736bd7f4864db5d49e7ff53aeedc75ca3 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Fri, 18 Dec 2015 02:40:28 +0530 Subject: [PATCH 769/843] Staging: lustre: osc: Declare as static Declare osc_extent_find and osc_unreserve_grant as static since they are used only in this particular file. Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/osc/osc_cache.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 46cfde4b139f..2229419b7184 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -619,9 +619,9 @@ static inline int overlapped(struct osc_extent *ex1, struct osc_extent *ex2) * Find or create an extent which includes @index, core function to manage * extent tree. */ -struct osc_extent *osc_extent_find(const struct lu_env *env, - struct osc_object *obj, pgoff_t index, - int *grants) +static struct osc_extent *osc_extent_find(const struct lu_env *env, + struct osc_object *obj, pgoff_t index, + int *grants) { struct client_obd *cli = osc_cli(obj); @@ -1420,8 +1420,8 @@ static void __osc_unreserve_grant(struct client_obd *cli, } } -void osc_unreserve_grant(struct client_obd *cli, - unsigned int reserved, unsigned int unused) +static void osc_unreserve_grant(struct client_obd *cli, + unsigned int reserved, unsigned int unused) { client_obd_list_lock(&cli->cl_loi_list_lock); __osc_unreserve_grant(cli, reserved, unused); From 61db1bc4970ac896a1e08fc2214d707b68605d41 Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Fri, 18 Dec 2015 02:40:29 +0530 Subject: [PATCH 770/843] Staging: lustre: osc: Declare osc_attr_set as static osc_attr_set is used only in this particular file. Thus declare it as static. Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/osc/osc_object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_object.c b/drivers/staging/lustre/lustre/osc/osc_object.c index c29a0d45ffed..fdd6219aacf6 100644 --- a/drivers/staging/lustre/lustre/osc/osc_object.c +++ b/drivers/staging/lustre/lustre/osc/osc_object.c @@ -158,8 +158,8 @@ static int osc_attr_get(const struct lu_env *env, struct cl_object *obj, return 0; } -int osc_attr_set(const struct lu_env *env, struct cl_object *obj, - const struct cl_attr *attr, unsigned valid) +static int osc_attr_set(const struct lu_env *env, struct cl_object *obj, + const struct cl_attr *attr, unsigned valid) { struct lov_oinfo *oinfo = cl2osc(obj)->oo_oinfo; struct ost_lvb *lvb = &oinfo->loi_lvb; From fb7a02014b6bb4d56864424cd13dbd6417c3cd7d Mon Sep 17 00:00:00 2001 From: Shraddha Barke Date: Fri, 18 Dec 2015 02:40:30 +0530 Subject: [PATCH 771/843] Staging: lustre: obdclass: Declare lu_site_hash_ops as static lu_site_hash_ops is used only in this particular file. Thus declare it as static. Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/obdclass/lu_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index 76ad9dc0447a..ce248f4072c2 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -916,7 +916,7 @@ static void lu_obj_hop_put_locked(struct cfs_hash *hs, struct hlist_node *hnode) LBUG(); /* we should never called it */ } -struct cfs_hash_ops lu_site_hash_ops = { +static struct cfs_hash_ops lu_site_hash_ops = { .hs_hash = lu_obj_hop_hash, .hs_key = lu_obj_hop_key, .hs_keycmp = lu_obj_hop_keycmp, From 3af7370ca16e33f80ebcfd0fe5be59ed6094c95a Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Mon, 21 Dec 2015 18:15:45 +0100 Subject: [PATCH 772/843] staging: lustre: Delete unnecessary goto statements in six functions Six goto statements referred to a source code position directly behind them. Thus omit such unnecessary jumps. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/llite/namei.c | 1 - drivers/staging/lustre/lustre/mdc/mdc_request.c | 7 ------- 2 files changed, 8 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 14370b97fe5c..8d8220f3db83 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -556,7 +556,6 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, retval = NULL; else retval = dentry; - goto out; out: if (req) ptlrpc_req_finished(req); diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 8baf726a983f..57e0fc1e8549 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -1181,7 +1181,6 @@ static int mdc_ioc_hsm_progress(struct obd_export *exp, ptlrpc_request_set_replen(req); rc = mdc_queue_wait(req); - goto out; out: ptlrpc_req_finished(req); return rc; @@ -1216,7 +1215,6 @@ static int mdc_ioc_hsm_ct_register(struct obd_import *imp, __u32 archives) ptlrpc_request_set_replen(req); rc = mdc_queue_wait(req); - goto out; out: ptlrpc_req_finished(req); return rc; @@ -1282,7 +1280,6 @@ static int mdc_ioc_hsm_ct_unregister(struct obd_import *imp) ptlrpc_request_set_replen(req); rc = mdc_queue_wait(req); - goto out; out: ptlrpc_req_finished(req); return rc; @@ -1362,8 +1359,6 @@ static int mdc_ioc_hsm_state_set(struct obd_export *exp, ptlrpc_request_set_replen(req); rc = mdc_queue_wait(req); - goto out; - out: ptlrpc_req_finished(req); return rc; @@ -1427,8 +1422,6 @@ static int mdc_ioc_hsm_request(struct obd_export *exp, ptlrpc_request_set_replen(req); rc = mdc_queue_wait(req); - goto out; - out: ptlrpc_req_finished(req); return rc; From 24a386334f62b1f4e5f6209e8bbc0168168ba441 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Mon, 21 Dec 2015 18:24:45 +0100 Subject: [PATCH 773/843] staging: lustre: Delete an unnecessary variable initialisation in mgc_process_recover_log() The variable "mne_swab" will eventually be set to an appropriate value from a call of the ptlrpc_rep_need_swab() function. Thus let us omit the explicit initialisation at the beginning. Signed-off-by: Markus Elfring Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/mgc/mgc_request.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index 06dc2c3d36c2..ab4800c20a95 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -1293,7 +1293,7 @@ static int mgc_process_recover_log(struct obd_device *obd, struct page **pages; int nrpages; bool eof = true; - bool mne_swab = false; + bool mne_swab; int i; int ealen; int rc; From c71d264543f759fea147734cb63de36397817534 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Mon, 21 Dec 2015 19:30:42 +0100 Subject: [PATCH 774/843] staging: lustre: Fix a jump label position in osc_get_info() The script "checkpatch.pl" pointed out that labels should not be indented. Thus delete a horizontal tab before the jump label "out" in the function "osc_get_info". Signed-off-by: Markus Elfring Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/osc/osc_request.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index b2642a798857..7034f0a942c5 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -2727,7 +2727,7 @@ static int osc_get_info(const struct lu_env *env, struct obd_export *exp, } *((u64 *)val) = *reply; - out: +out: ptlrpc_req_finished(req); return rc; } else if (KEY_IS(KEY_FIEMAP)) { From 5bff5d9f2b557f63015925b1b076f98010533c52 Mon Sep 17 00:00:00 2001 From: Bogicevic Sasa Date: Fri, 13 Nov 2015 15:07:21 +0100 Subject: [PATCH 775/843] driver:staging:dgnc Fix spaces preferred around that ... This fixes all "spaces preferred around that ..." messages from checkpatch.pl Signed-off-by: Bogicevic Sasa Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_neo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c index 8106f5234bf5..15c255d184dc 100644 --- a/drivers/staging/dgnc/dgnc_neo.c +++ b/drivers/staging/dgnc/dgnc_neo.c @@ -1628,7 +1628,7 @@ static void neo_uart_init(struct channel_t *ch) /* Clear out UART and FIFO */ readb(&ch->ch_neo_uart->txrx); - writeb((UART_FCR_ENABLE_FIFO|UART_FCR_CLEAR_RCVR|UART_FCR_CLEAR_XMIT), &ch->ch_neo_uart->isr_fcr); + writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT), &ch->ch_neo_uart->isr_fcr); readb(&ch->ch_neo_uart->lsr); readb(&ch->ch_neo_uart->msr); @@ -1779,8 +1779,8 @@ static void neo_vpd(struct dgnc_board *brd) /* Store the VPD into our buffer */ for (i = 0; i < NEO_VPD_IMAGESIZE; i++) { a = neo_read_eeprom(brd->re_map_membase, i); - brd->vpd[i*2] = a & 0xff; - brd->vpd[(i*2)+1] = (a >> 8) & 0xff; + brd->vpd[i * 2] = a & 0xff; + brd->vpd[(i * 2) + 1] = (a >> 8) & 0xff; } if (((brd->vpd[0x08] != 0x82) /* long resource name tag */ From 013514946cbd85dea2a12e8848f2cfb775eecd52 Mon Sep 17 00:00:00 2001 From: Nizam Haider Date: Sat, 14 Nov 2015 20:10:45 +0530 Subject: [PATCH 776/843] Staging: dgnc: dgnc_neo.c Braces {} should be used on all arms of this statement Fix Checlpatch warning HECK: braces {} should be used on all arms of this statement Signed-off-by: Nizam Haider Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_neo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c index 15c255d184dc..39c76e78e56a 100644 --- a/drivers/staging/dgnc/dgnc_neo.c +++ b/drivers/staging/dgnc/dgnc_neo.c @@ -1108,9 +1108,9 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch) * On the other hand, if the UART IS in FIFO mode, then ask * the UART to give us an approximation of data it has RX'ed. */ - if (!(ch->ch_flags & CH_FIFO_ENABLED)) + if (!(ch->ch_flags & CH_FIFO_ENABLED)) { total = 0; - else { + } else { total = readb(&ch->ch_neo_uart->rfifo); /* From f7f2b10a82e8774eab3bd90061caccf8931a8bf4 Mon Sep 17 00:00:00 2001 From: Nizam Haider Date: Sat, 14 Nov 2015 20:10:46 +0530 Subject: [PATCH 777/843] Staging: dgnc: dgnc_tty: Typo error dgnc_wmove comment Fix Typo errror in the comment section of dgnc_wmove Signed-off-by: Nizam Haider Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_tty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c index 48e4b90578c1..b79eab084c02 100644 --- a/drivers/staging/dgnc/dgnc_tty.c +++ b/drivers/staging/dgnc/dgnc_tty.c @@ -448,7 +448,7 @@ void dgnc_tty_uninit(struct dgnc_board *brd) * dgnc_wmove - Write data to transmit queue. * * ch - Pointer to channel structure. - * buf - Poiter to characters to be moved. + * buf - Pointer to characters to be moved. * n - Number of characters to move. * *=======================================================================*/ From 6e411751f00faf00379f6aa94701ab360b068cff Mon Sep 17 00:00:00 2001 From: Jitendra Kumar Khasdev Date: Tue, 24 Nov 2015 23:01:13 +0530 Subject: [PATCH 778/843] staging: dgnc: dgnc_cls.c: Replaced udelay by usleep_range This patch is to file dgnc_cls.c that fixes up udelay function by usleep_range. It is safe to use according to the following documentation Documentation/timers/timers-howto.txt. So that is why I have given an appropriate time range. Signed-off-by: Jitendra Kumar Khasdev Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_cls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c index 75040daa40ce..72f0aaa6911f 100644 --- a/drivers/staging/dgnc/dgnc_cls.c +++ b/drivers/staging/dgnc/dgnc_cls.c @@ -934,7 +934,7 @@ static void cls_flush_uart_write(struct channel_t *ch) writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_XMIT), &ch->ch_cls_uart->isr_fcr); - udelay(10); + usleep_range(10, 20); ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); } From 04226e40592c4b27cc2250105b4505901d467102 Mon Sep 17 00:00:00 2001 From: Geliang Tang Date: Tue, 10 Nov 2015 22:41:34 +0800 Subject: [PATCH 779/843] staging: comedi: use kmalloc_array instead of kmalloc Use kmalloc_array instead of kmalloc to allocate memory for an array. Signed-off-by: Geliang Tang Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_pci224.c | 11 +++++++---- drivers/staging/comedi/drivers/ni_670x.c | 5 +++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index b2f7679a0116..cac011fdd375 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -1022,14 +1022,17 @@ pci224_auto_attach(struct comedi_device *dev, unsigned long context_model) irq = pci_dev->irq; /* Allocate buffer to hold values for AO channel scan. */ - devpriv->ao_scan_vals = kmalloc(sizeof(devpriv->ao_scan_vals[0]) * - board->ao_chans, GFP_KERNEL); + devpriv->ao_scan_vals = kmalloc_array(board->ao_chans, + sizeof(devpriv->ao_scan_vals[0]), + GFP_KERNEL); if (!devpriv->ao_scan_vals) return -ENOMEM; /* Allocate buffer to hold AO channel scan order. */ - devpriv->ao_scan_order = kmalloc(sizeof(devpriv->ao_scan_order[0]) * - board->ao_chans, GFP_KERNEL); + devpriv->ao_scan_order = + kmalloc_array(board->ao_chans, + sizeof(devpriv->ao_scan_order[0]), + GFP_KERNEL); if (!devpriv->ao_scan_order) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index f4c580f65a89..3e72718801a9 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -214,8 +214,9 @@ static int ni_670x_auto_attach(struct comedi_device *dev, if (s->n_chan == 32) { const struct comedi_lrange **range_table_list; - range_table_list = kmalloc(sizeof(struct comedi_lrange *) * 32, - GFP_KERNEL); + range_table_list = kmalloc_array(32, + sizeof(struct comedi_lrange *), + GFP_KERNEL); if (!range_table_list) return -ENOMEM; s->range_table_list = range_table_list; From 5e1a02bd93fb64fd195951a723ad768106120562 Mon Sep 17 00:00:00 2001 From: Ranjith Thangavel Date: Wed, 11 Nov 2015 21:24:01 +0530 Subject: [PATCH 780/843] comedi: comedi_parport: Fix coding style - use BIT macro BIT macro is used for defining BIT location instead of shifting operator - coding style issue Signed-off-by: Ranjith Thangavel Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/comedi_parport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index 15a4093efda1..1bf8ddc6f07c 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -75,8 +75,8 @@ #define PARPORT_DATA_REG 0x00 #define PARPORT_STATUS_REG 0x01 #define PARPORT_CTRL_REG 0x02 -#define PARPORT_CTRL_IRQ_ENA (1 << 4) -#define PARPORT_CTRL_BIDIR_ENA (1 << 5) +#define PARPORT_CTRL_IRQ_ENA BIT(4) +#define PARPORT_CTRL_BIDIR_ENA BIT(5) static int parport_data_reg_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, From ecbbf6d33005b287fc4a753de0011f5f261b5869 Mon Sep 17 00:00:00 2001 From: Ranjith Thangavel Date: Wed, 11 Nov 2015 21:52:02 +0530 Subject: [PATCH 781/843] comedi: ni_65xx: Fix coding style - use BIT macro BIT macro is used for defining BIT location instead of shifting operator - coding style issue Signed-off-by: Ranjith Thangavel Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_65xx.c | 54 ++++++++++++------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index 800d57426070..251117be1205 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -68,25 +68,25 @@ /* Non-recurring Registers (8-bit except where noted) */ #define NI_65XX_ID_REG 0x00 #define NI_65XX_CLR_REG 0x01 -#define NI_65XX_CLR_WDOG_INT (1 << 6) -#define NI_65XX_CLR_WDOG_PING (1 << 5) -#define NI_65XX_CLR_WDOG_EXP (1 << 4) -#define NI_65XX_CLR_EDGE_INT (1 << 3) -#define NI_65XX_CLR_OVERFLOW_INT (1 << 2) +#define NI_65XX_CLR_WDOG_INT BIT(6) +#define NI_65XX_CLR_WDOG_PING BIT(5) +#define NI_65XX_CLR_WDOG_EXP BIT(4) +#define NI_65XX_CLR_EDGE_INT BIT(3) +#define NI_65XX_CLR_OVERFLOW_INT BIT(2) #define NI_65XX_STATUS_REG 0x02 -#define NI_65XX_STATUS_WDOG_INT (1 << 5) -#define NI_65XX_STATUS_FALL_EDGE (1 << 4) -#define NI_65XX_STATUS_RISE_EDGE (1 << 3) -#define NI_65XX_STATUS_INT (1 << 2) -#define NI_65XX_STATUS_OVERFLOW_INT (1 << 1) -#define NI_65XX_STATUS_EDGE_INT (1 << 0) +#define NI_65XX_STATUS_WDOG_INT BIT(5) +#define NI_65XX_STATUS_FALL_EDGE BIT(4) +#define NI_65XX_STATUS_RISE_EDGE BIT(3) +#define NI_65XX_STATUS_INT BIT(2) +#define NI_65XX_STATUS_OVERFLOW_INT BIT(1) +#define NI_65XX_STATUS_EDGE_INT BIT(0) #define NI_65XX_CTRL_REG 0x03 -#define NI_65XX_CTRL_WDOG_ENA (1 << 5) -#define NI_65XX_CTRL_FALL_EDGE_ENA (1 << 4) -#define NI_65XX_CTRL_RISE_EDGE_ENA (1 << 3) -#define NI_65XX_CTRL_INT_ENA (1 << 2) -#define NI_65XX_CTRL_OVERFLOW_ENA (1 << 1) -#define NI_65XX_CTRL_EDGE_ENA (1 << 0) +#define NI_65XX_CTRL_WDOG_ENA BIT(5) +#define NI_65XX_CTRL_FALL_EDGE_ENA BIT(4) +#define NI_65XX_CTRL_RISE_EDGE_ENA BIT(3) +#define NI_65XX_CTRL_INT_ENA BIT(2) +#define NI_65XX_CTRL_OVERFLOW_ENA BIT(1) +#define NI_65XX_CTRL_EDGE_ENA BIT(0) #define NI_65XX_REV_REG 0x04 /* 32-bit */ #define NI_65XX_FILTER_REG 0x08 /* 32-bit */ #define NI_65XX_RTSI_ROUTE_REG 0x0c /* 16-bit */ @@ -94,24 +94,24 @@ #define NI_65XX_RTSI_WDOG_REG 0x10 /* 16-bit */ #define NI_65XX_RTSI_TRIG_REG 0x12 /* 16-bit */ #define NI_65XX_AUTO_CLK_SEL_REG 0x14 /* PXI-6528 only */ -#define NI_65XX_AUTO_CLK_SEL_STATUS (1 << 1) -#define NI_65XX_AUTO_CLK_SEL_DISABLE (1 << 0) +#define NI_65XX_AUTO_CLK_SEL_STATUS BIT(1) +#define NI_65XX_AUTO_CLK_SEL_DISABLE BIT(0) #define NI_65XX_WDOG_CTRL_REG 0x15 -#define NI_65XX_WDOG_CTRL_ENA (1 << 0) +#define NI_65XX_WDOG_CTRL_ENA BIT(0) #define NI_65XX_RTSI_CFG_REG 0x16 -#define NI_65XX_RTSI_CFG_RISE_SENSE (1 << 2) -#define NI_65XX_RTSI_CFG_FALL_SENSE (1 << 1) -#define NI_65XX_RTSI_CFG_SYNC_DETECT (1 << 0) +#define NI_65XX_RTSI_CFG_RISE_SENSE BIT(2) +#define NI_65XX_RTSI_CFG_FALL_SENSE BIT(1) +#define NI_65XX_RTSI_CFG_SYNC_DETECT BIT(0) #define NI_65XX_WDOG_STATUS_REG 0x17 -#define NI_65XX_WDOG_STATUS_EXP (1 << 0) +#define NI_65XX_WDOG_STATUS_EXP BIT(0) #define NI_65XX_WDOG_INTERVAL_REG 0x18 /* 32-bit */ /* Recurring port registers (8-bit) */ #define NI_65XX_PORT(x) ((x) * 0x10) #define NI_65XX_IO_DATA_REG(x) (0x40 + NI_65XX_PORT(x)) #define NI_65XX_IO_SEL_REG(x) (0x41 + NI_65XX_PORT(x)) -#define NI_65XX_IO_SEL_OUTPUT (0 << 0) -#define NI_65XX_IO_SEL_INPUT (1 << 0) +#define NI_65XX_IO_SEL_OUTPUT 0 +#define NI_65XX_IO_SEL_INPUT BIT(0) #define NI_65XX_RISE_EDGE_ENA_REG(x) (0x42 + NI_65XX_PORT(x)) #define NI_65XX_FALL_EDGE_ENA_REG(x) (0x43 + NI_65XX_PORT(x)) #define NI_65XX_FILTER_ENA(x) (0x44 + NI_65XX_PORT(x)) @@ -613,7 +613,7 @@ static int ni_65xx_intr_insn_config(struct comedi_device *dev, /* ripped from mite.h and mite_setup2() to avoid mite dependency */ #define MITE_IODWBSR 0xc0 /* IO Device Window Base Size Register */ -#define WENAB (1 << 7) /* window enable */ +#define WENAB BIT(7) /* window enable */ static int ni_65xx_mite_init(struct pci_dev *pcidev) { From 1a549cb61afa7fc18d92ef87061c8a8d47f535cf Mon Sep 17 00:00:00 2001 From: Ranjith Thangavel Date: Wed, 11 Nov 2015 21:57:51 +0530 Subject: [PATCH 782/843] comedi: cb_pcidda: Fix coding style - use BIT macro BIT macro is used for defining BIT location instead of shifting operator - coding style issue Signed-off-by: Ranjith Thangavel Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcidda.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidda.c b/drivers/staging/comedi/drivers/cb_pcidda.c index b00a36a5cb36..ccb37d1f0f8e 100644 --- a/drivers/staging/comedi/drivers/cb_pcidda.c +++ b/drivers/staging/comedi/drivers/cb_pcidda.c @@ -51,13 +51,13 @@ /* DAC registers */ #define CB_DDA_DA_CTRL_REG 0x00 /* D/A Control Register */ -#define CB_DDA_DA_CTRL_SU (1 << 0) /* Simultaneous update */ -#define CB_DDA_DA_CTRL_EN (1 << 1) /* Enable specified DAC */ +#define CB_DDA_DA_CTRL_SU BIT(0) /* Simultaneous update */ +#define CB_DDA_DA_CTRL_EN BIT(1) /* Enable specified DAC */ #define CB_DDA_DA_CTRL_DAC(x) ((x) << 2) /* Specify DAC channel */ #define CB_DDA_DA_CTRL_RANGE2V5 (0 << 6) /* 2.5V range */ #define CB_DDA_DA_CTRL_RANGE5V (2 << 6) /* 5V range */ #define CB_DDA_DA_CTRL_RANGE10V (3 << 6) /* 10V range */ -#define CB_DDA_DA_CTRL_UNIP (1 << 8) /* Unipolar range */ +#define CB_DDA_DA_CTRL_UNIP BIT(8) /* Unipolar range */ #define DACALIBRATION1 4 /* D/A CALIBRATION REGISTER 1 */ /* write bits */ From af904c49422be93dd182d45d0c9c3d1862ab72b0 Mon Sep 17 00:00:00 2001 From: "Daniel H. Hemmingsen" Date: Thu, 12 Nov 2015 17:03:18 +0100 Subject: [PATCH 783/843] Staging: comedi: Fixed multiple commenting and spacing codig style issues. Fixed multiple comment blocks that didn't comply with the kernels coding style, and fixed a few spacing issues as well. Signed-off-by: Daniel H. Hemmingsen Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi.h | 307 ++++++++++++++++++-------------- 1 file changed, 177 insertions(+), 130 deletions(-) diff --git a/drivers/staging/comedi/comedi.h b/drivers/staging/comedi/comedi.h index 66edda190b75..83bd309d011b 100644 --- a/drivers/staging/comedi/comedi.h +++ b/drivers/staging/comedi/comedi.h @@ -1,20 +1,20 @@ /* - include/comedi.h (installed as /usr/include/comedi.h) - header file for comedi - - COMEDI - Linux Control and Measurement Device Interface - Copyright (C) 1998-2001 David A. Schleef - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. -*/ + * include/comedi.h (installed as /usr/include/comedi.h) + * header file for comedi + * + * COMEDI - Linux Control and Measurement Device Interface + * Copyright (C) 1998-2001 David A. Schleef + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ #ifndef _COMEDI_H #define _COMEDI_H @@ -28,9 +28,9 @@ #define COMEDI_MAJOR 98 /* - maximum number of minor devices. This can be increased, although - kernel structures are currently statically allocated, thus you - don't want this to be much more than you actually use. + * maximum number of minor devices. This can be increased, although + * kernel structures are currently statically allocated, thus you + * don't want this to be much more than you actually use. */ #define COMEDI_NDEVICES 16 @@ -63,21 +63,21 @@ /* packs and unpacks a channel/range number */ #define CR_PACK(chan, rng, aref) \ - ((((aref)&0x3)<<24) | (((rng)&0xff)<<16) | (chan)) + ((((aref) & 0x3) << 24) | (((rng) & 0xff) << 16) | (chan)) #define CR_PACK_FLAGS(chan, range, aref, flags) \ (CR_PACK(chan, range, aref) | ((flags) & CR_FLAGS_MASK)) -#define CR_CHAN(a) ((a)&0xffff) -#define CR_RANGE(a) (((a)>>16)&0xff) -#define CR_AREF(a) (((a)>>24)&0x03) +#define CR_CHAN(a) ((a) & 0xffff) +#define CR_RANGE(a) (((a) >> 16) & 0xff) +#define CR_AREF(a) (((a) >> 24) & 0x03) #define CR_FLAGS_MASK 0xfc000000 -#define CR_ALT_FILTER (1<<26) +#define CR_ALT_FILTER (1 << 26) #define CR_DITHER CR_ALT_FILTER #define CR_DEGLITCH CR_ALT_FILTER -#define CR_ALT_SOURCE (1<<27) -#define CR_EDGE (1<<30) -#define CR_INVERT (1<<31) +#define CR_ALT_SOURCE (1 << 27) +#define CR_EDGE (1 << 30) +#define CR_INVERT (1 << 31) #define AREF_GROUND 0x00 /* analog ref = analog ground */ #define AREF_COMMON 0x01 /* analog ref = analog common */ @@ -114,11 +114,11 @@ #define INSN_READ (0 | INSN_MASK_READ) #define INSN_WRITE (1 | INSN_MASK_WRITE) -#define INSN_BITS (2 | INSN_MASK_READ|INSN_MASK_WRITE) -#define INSN_CONFIG (3 | INSN_MASK_READ|INSN_MASK_WRITE) -#define INSN_GTOD (4 | INSN_MASK_READ|INSN_MASK_SPECIAL) -#define INSN_WAIT (5 | INSN_MASK_WRITE|INSN_MASK_SPECIAL) -#define INSN_INTTRIG (6 | INSN_MASK_WRITE|INSN_MASK_SPECIAL) +#define INSN_BITS (2 | INSN_MASK_READ | INSN_MASK_WRITE) +#define INSN_CONFIG (3 | INSN_MASK_READ | INSN_MASK_WRITE) +#define INSN_GTOD (4 | INSN_MASK_READ | INSN_MASK_SPECIAL) +#define INSN_WAIT (5 | INSN_MASK_WRITE | INSN_MASK_SPECIAL) +#define INSN_INTTRIG (6 | INSN_MASK_WRITE | INSN_MASK_SPECIAL) /* trigger flags */ /* These flags are used in comedi_trig structures */ @@ -279,7 +279,8 @@ enum configuration_ids { INSN_CONFIG_SET_OTHER_SRC = 2005, /* Set other source */ /* INSN_CONFIG_GET_OTHER_SRC = 2006,*//* Get other source */ /* Get size in bytes of subdevice's on-board fifos used during - * streaming input/output */ + * streaming input/output + */ INSN_CONFIG_GET_HARDWARE_BUFFER_SIZE = 2006, INSN_CONFIG_SET_COUNTER_MODE = 4097, /* INSN_CONFIG_8254_SET_MODE is deprecated */ @@ -292,7 +293,8 @@ enum configuration_ids { INSN_CONFIG_PWM_GET_PERIOD = 5001, /* gets frequency */ INSN_CONFIG_GET_PWM_STATUS = 5002, /* is it running? */ /* sets H bridge: duty cycle and sign bit for a relay at the - * same time */ + * same time + */ INSN_CONFIG_PWM_SET_H_BRIDGE = 5003, /* gets H bridge data: duty cycle and the sign bit */ INSN_CONFIG_PWM_GET_H_BRIDGE = 5004 @@ -502,13 +504,13 @@ struct comedi_bufinfo { /* range stuff */ -#define __RANGE(a, b) ((((a)&0xffff)<<16)|((b)&0xffff)) +#define __RANGE(a, b) ((((a) & 0xffff) << 16) | ((b) & 0xffff)) -#define RANGE_OFFSET(a) (((a)>>16)&0xffff) -#define RANGE_LENGTH(b) ((b)&0xffff) +#define RANGE_OFFSET(a) (((a) >> 16) & 0xffff) +#define RANGE_LENGTH(b) ((b) & 0xffff) -#define RF_UNIT(flags) ((flags)&0xff) -#define RF_EXTERNAL (1<<8) +#define RF_UNIT(flags) ((flags) & 0xff) +#define RF_EXTERNAL (1 << 8) #define UNIT_volt 0 #define UNIT_mA 1 @@ -521,23 +523,22 @@ struct comedi_bufinfo { /**********************************************************/ /* - 8254 specific configuration. - - It supports two config commands: - - 0 ID: INSN_CONFIG_SET_COUNTER_MODE - 1 8254 Mode - I8254_MODE0, I8254_MODE1, ..., I8254_MODE5 - OR'ed with: - I8254_BCD, I8254_BINARY - - 0 ID: INSN_CONFIG_8254_READ_STATUS - 1 <-- Status byte returned here. - B7 = Output - B6 = NULL Count - B5 - B0 Current mode. - -*/ + * 8254 specific configuration. + * + * It supports two config commands: + * + * 0 ID: INSN_CONFIG_SET_COUNTER_MODE + * 1 8254 Mode + * I8254_MODE0, I8254_MODE1, ..., I8254_MODE5 + * OR'ed with: + * I8254_BCD, I8254_BINARY + * + * 0 ID: INSN_CONFIG_8254_READ_STATUS + * 1 <-- Status byte returned here. + * B7 = Output + * B6 = NULL Count + * B5 - B0 Current mode. + */ enum i8254_mode { I8254_MODE0 = (0 << 1), /* Interrupt on terminal count */ @@ -545,18 +546,20 @@ enum i8254_mode { I8254_MODE2 = (2 << 1), /* Rate generator */ I8254_MODE3 = (3 << 1), /* Square wave mode */ I8254_MODE4 = (4 << 1), /* Software triggered strobe */ - I8254_MODE5 = (5 << 1), /* Hardware triggered strobe - * (retriggerable) */ - I8254_BCD = 1, /* use binary-coded decimal instead of binary - * (pretty useless) */ + /* Hardware triggered strobe (retriggerable) */ + I8254_MODE5 = (5 << 1), + /* Use binary-coded decimal instead of binary (pretty useless) */ + I8254_BCD = 1, I8254_BINARY = 0 }; #define NI_USUAL_PFI_SELECT(x) (((x) < 10) ? (0x1 + (x)) : (0xb + (x))) #define NI_USUAL_RTSI_SELECT(x) (((x) < 7) ? (0xb + (x)) : 0x1b) -/* mode bits for NI general-purpose counters, set with - * INSN_CONFIG_SET_COUNTER_MODE */ +/* + * mode bits for NI general-purpose counters, set with + * INSN_CONFIG_SET_COUNTER_MODE + */ #define NI_GPCT_COUNTING_MODE_SHIFT 16 #define NI_GPCT_INDEX_PHASE_BITSHIFT 20 #define NI_GPCT_COUNTING_DIRECTION_SHIFT 24 @@ -624,8 +627,10 @@ enum ni_gpct_mode_bits { NI_GPCT_INVERT_OUTPUT_BIT = 0x20000000 }; -/* Bits for setting a clock source with - * INSN_CONFIG_SET_CLOCK_SRC when using NI general-purpose counters. */ +/* + * Bits for setting a clock source with + * INSN_CONFIG_SET_CLOCK_SRC when using NI general-purpose counters. + */ enum ni_gpct_clock_source_bits { NI_GPCT_CLOCK_SRC_SELECT_MASK = 0x3f, NI_GPCT_TIMEBASE_1_CLOCK_SRC_BITS = 0x0, @@ -656,9 +661,11 @@ enum ni_gpct_clock_source_bits { /* no pfi on NI 660x */ #define NI_GPCT_PFI_CLOCK_SRC_BITS(x) (0x20 + (x)) -/* Possibilities for setting a gate source with -INSN_CONFIG_SET_GATE_SRC when using NI general-purpose counters. -May be bitwise-or'd with CR_EDGE or CR_INVERT. */ +/* + * Possibilities for setting a gate source with + * INSN_CONFIG_SET_GATE_SRC when using NI general-purpose counters. + * May be bitwise-or'd with CR_EDGE or CR_INVERT. + */ enum ni_gpct_gate_select { /* m-series gates */ NI_GPCT_TIMESTAMP_MUX_GATE_SELECT = 0x0, @@ -675,9 +682,11 @@ enum ni_gpct_gate_select { /* more gates for 660x "second gate" */ NI_GPCT_UP_DOWN_PIN_i_GATE_SELECT = 0x201, NI_GPCT_SELECTED_GATE_GATE_SELECT = 0x21e, - /* m-series "second gate" sources are unknown, + /* + * m-series "second gate" sources are unknown, * we should add them here with an offset of 0x300 when - * known. */ + * known. + */ NI_GPCT_DISABLED_GATE_SELECT = 0x8000, }; @@ -686,8 +695,10 @@ enum ni_gpct_gate_select { #define NI_GPCT_PFI_GATE_SELECT(x) NI_USUAL_PFI_SELECT(x) #define NI_GPCT_UP_DOWN_PIN_GATE_SELECT(x) (0x202 + (x)) -/* Possibilities for setting a source with -INSN_CONFIG_SET_OTHER_SRC when using NI general-purpose counters. */ +/* + * Possibilities for setting a source with + * INSN_CONFIG_SET_OTHER_SRC when using NI general-purpose counters. + */ enum ni_gpct_other_index { NI_GPCT_SOURCE_ENCODER_A, NI_GPCT_SOURCE_ENCODER_B, @@ -702,18 +713,24 @@ enum ni_gpct_other_select { #define NI_GPCT_PFI_OTHER_SELECT(x) NI_USUAL_PFI_SELECT(x) -/* start sources for ni general-purpose counters for use with -INSN_CONFIG_ARM */ +/* + * start sources for ni general-purpose counters for use with + * INSN_CONFIG_ARM + */ enum ni_gpct_arm_source { NI_GPCT_ARM_IMMEDIATE = 0x0, - NI_GPCT_ARM_PAIRED_IMMEDIATE = 0x1, /* Start both the counter - * and the adjacent paired - * counter simultaneously */ - /* NI doesn't document bits for selecting hardware arm triggers. + /* + * Start both the counter and the adjacent pared + * counter simultaneously + */ + NI_GPCT_ARM_PAIRED_IMMEDIATE = 0x1, + /* + * NI doesn't document bits for selecting hardware arm triggers. * If the NI_GPCT_ARM_UNKNOWN bit is set, we will pass the least * significant bits (3 bits for 660x or 5 bits for m-series) * through to the hardware. This will at least allow someone to - * figure out what the bits do later. */ + * figure out what the bits do later. + */ NI_GPCT_ARM_UNKNOWN = 0x1000, }; @@ -728,8 +745,10 @@ enum ni_gpct_filter_select { NI_GPCT_FILTER_2x_TIMEBASE_3 = 0x6 }; -/* PFI digital filtering options for ni m-series for use with - * INSN_CONFIG_FILTER. */ +/* + * PFI digital filtering options for ni m-series for use with + * INSN_CONFIG_FILTER. + */ enum ni_pfi_filter_select { NI_PFI_FILTER_OFF = 0x0, NI_PFI_FILTER_125ns = 0x1, @@ -740,9 +759,11 @@ enum ni_pfi_filter_select { /* master clock sources for ni mio boards and INSN_CONFIG_SET_CLOCK_SRC */ enum ni_mio_clock_source { NI_MIO_INTERNAL_CLOCK = 0, - NI_MIO_RTSI_CLOCK = 1, /* doesn't work for m-series, use - NI_MIO_PLL_RTSI_CLOCK() */ - /* the NI_MIO_PLL_* sources are m-series only */ + /* + * Doesn't work for m-series, use NI_MIO_PLL_RTSI_CLOCK() + * the NI_MIO_PLL_* sources are m-series only + */ + NI_MIO_RTSI_CLOCK = 1, NI_MIO_PLL_PXI_STAR_TRIGGER_CLOCK = 2, NI_MIO_PLL_PXI10_CLOCK = 3, NI_MIO_PLL_RTSI0_CLOCK = 4 @@ -750,9 +771,11 @@ enum ni_mio_clock_source { #define NI_MIO_PLL_RTSI_CLOCK(x) (NI_MIO_PLL_RTSI0_CLOCK + (x)) -/* Signals which can be routed to an NI RTSI pin with INSN_CONFIG_SET_ROUTING. - The numbers assigned are not arbitrary, they correspond to the bits required - to program the board. */ +/* + * Signals which can be routed to an NI RTSI pin with INSN_CONFIG_SET_ROUTING. + * The numbers assigned are not arbitrary, they correspond to the bits required + * to program the board. + */ enum ni_rtsi_routing { NI_RTSI_OUTPUT_ADR_START1 = 0, NI_RTSI_OUTPUT_ADR_START2 = 1, @@ -763,17 +786,19 @@ enum ni_rtsi_routing { NI_RTSI_OUTPUT_G_GATE0 = 6, NI_RTSI_OUTPUT_RGOUT0 = 7, NI_RTSI_OUTPUT_RTSI_BRD_0 = 8, - NI_RTSI_OUTPUT_RTSI_OSC = 12 /* pre-m-series always have RTSI - * clock on line 7 */ + /* Pre-m-series always have RTSI clock on line 7 */ + NI_RTSI_OUTPUT_RTSI_OSC = 12 }; #define NI_RTSI_OUTPUT_RTSI_BRD(x) (NI_RTSI_OUTPUT_RTSI_BRD_0 + (x)) -/* Signals which can be routed to an NI PFI pin on an m-series board with +/* + * Signals which can be routed to an NI PFI pin on an m-series board with * INSN_CONFIG_SET_ROUTING. These numbers are also returned by * INSN_CONFIG_GET_ROUTING on pre-m-series boards, even though their routing * cannot be changed. The numbers assigned are not arbitrary, they correspond - * to the bits required to program the board. */ + * to the bits required to program the board. + */ enum ni_pfi_routing { NI_PFI_OUTPUT_PFI_DEFAULT = 0, NI_PFI_OUTPUT_AI_START1 = 1, @@ -803,20 +828,24 @@ enum ni_pfi_routing { #define NI_PFI_OUTPUT_RTSI(x) (NI_PFI_OUTPUT_RTSI0 + (x)) -/* Signals which can be routed to output on a NI PFI pin on a 660x board - with INSN_CONFIG_SET_ROUTING. The numbers assigned are - not arbitrary, they correspond to the bits required - to program the board. Lines 0 to 7 can only be set to - NI_660X_PFI_OUTPUT_DIO. Lines 32 to 39 can only be set to - NI_660X_PFI_OUTPUT_COUNTER. */ +/* + * Signals which can be routed to output on a NI PFI pin on a 660x board + * with INSN_CONFIG_SET_ROUTING. The numbers assigned are + * not arbitrary, they correspond to the bits required + * to program the board. Lines 0 to 7 can only be set to + * NI_660X_PFI_OUTPUT_DIO. Lines 32 to 39 can only be set to + * NI_660X_PFI_OUTPUT_COUNTER. + */ enum ni_660x_pfi_routing { NI_660X_PFI_OUTPUT_COUNTER = 1, /* counter */ NI_660X_PFI_OUTPUT_DIO = 2, /* static digital output */ }; -/* NI External Trigger lines. These values are not arbitrary, but are related +/* + * NI External Trigger lines. These values are not arbitrary, but are related * to the bits required to program the board (offset by 1 for historical - * reasons). */ + * reasons). + */ #define NI_EXT_PFI(x) (NI_USUAL_PFI_SELECT(x) - 1) #define NI_EXT_RTSI(x) (NI_USUAL_RTSI_SELECT(x) - 1) @@ -827,9 +856,11 @@ enum comedi_counter_status_flags { COMEDI_COUNTER_TERMINAL_COUNT = 0x4, }; -/* Clock sources for CDIO subdevice on NI m-series boards. Used as the +/* + * Clock sources for CDIO subdevice on NI m-series boards. Used as the * scan_begin_arg for a comedi_command. These sources may also be bitwise-or'd - * with CR_INVERT to change polarity. */ + * with CR_INVERT to change polarity. + */ enum ni_m_series_cdio_scan_begin_src { NI_CDIO_SCAN_BEGIN_SRC_GROUND = 0, NI_CDIO_SCAN_BEGIN_SRC_AI_START = 18, @@ -846,38 +877,50 @@ enum ni_m_series_cdio_scan_begin_src { #define NI_CDIO_SCAN_BEGIN_SRC_PFI(x) NI_USUAL_PFI_SELECT(x) #define NI_CDIO_SCAN_BEGIN_SRC_RTSI(x) NI_USUAL_RTSI_SELECT(x) -/* scan_begin_src for scan_begin_arg==TRIG_EXT with analog output command on NI +/* + * scan_begin_src for scan_begin_arg==TRIG_EXT with analog output command on NI * boards. These scan begin sources can also be bitwise-or'd with CR_INVERT to - * change polarity. */ + * change polarity. + */ #define NI_AO_SCAN_BEGIN_SRC_PFI(x) NI_USUAL_PFI_SELECT(x) #define NI_AO_SCAN_BEGIN_SRC_RTSI(x) NI_USUAL_RTSI_SELECT(x) -/* Bits for setting a clock source with - * INSN_CONFIG_SET_CLOCK_SRC when using NI frequency output subdevice. */ +/* + * Bits for setting a clock source with + * INSN_CONFIG_SET_CLOCK_SRC when using NI frequency output subdevice. + */ enum ni_freq_out_clock_source_bits { NI_FREQ_OUT_TIMEBASE_1_DIV_2_CLOCK_SRC, /* 10 MHz */ NI_FREQ_OUT_TIMEBASE_2_CLOCK_SRC /* 100 KHz */ }; -/* Values for setting a clock source with INSN_CONFIG_SET_CLOCK_SRC for - * 8254 counter subdevices on Amplicon DIO boards (amplc_dio200 driver). */ +/* + * Values for setting a clock source with INSN_CONFIG_SET_CLOCK_SRC for + * 8254 counter subdevices on Amplicon DIO boards (amplc_dio200 driver). + */ enum amplc_dio_clock_source { - AMPLC_DIO_CLK_CLKN, /* per channel external clock - input/output pin (pin is only an - input when clock source set to this - value, otherwise it is an output) */ + /* + * Per channel external clock + * input/output pin (pin is only an + * input when clock source set to this value, + * otherwise it is an output) + */ + AMPLC_DIO_CLK_CLKN, AMPLC_DIO_CLK_10MHZ, /* 10 MHz internal clock */ AMPLC_DIO_CLK_1MHZ, /* 1 MHz internal clock */ AMPLC_DIO_CLK_100KHZ, /* 100 kHz internal clock */ AMPLC_DIO_CLK_10KHZ, /* 10 kHz internal clock */ AMPLC_DIO_CLK_1KHZ, /* 1 kHz internal clock */ - AMPLC_DIO_CLK_OUTNM1, /* output of preceding counter channel - (for channel 0, preceding counter - channel is channel 2 on preceding - counter subdevice, for first counter - subdevice, preceding counter - subdevice is the last counter - subdevice) */ + /* + * Output of preceding counter channel + * (for channel 0, preceding counter + * channel is channel 2 on preceding + * counter subdevice, for first counter + * subdevice, preceding counter + * subdevice is the last counter + * subdevice) + */ + AMPLC_DIO_CLK_OUTNM1, AMPLC_DIO_CLK_EXT, /* per chip external input pin */ /* the following are "enhanced" clock sources for PCIe models */ AMPLC_DIO_CLK_VCC, /* clock input HIGH */ @@ -886,35 +929,39 @@ enum amplc_dio_clock_source { AMPLC_DIO_CLK_20MHZ /* 20 MHz internal clock */ }; -/* Values for setting a clock source with INSN_CONFIG_SET_CLOCK_SRC for - * timer subdevice on some Amplicon DIO PCIe boards (amplc_dio200 driver). */ +/* + * Values for setting a clock source with INSN_CONFIG_SET_CLOCK_SRC for + * timer subdevice on some Amplicon DIO PCIe boards (amplc_dio200 driver). + */ enum amplc_dio_ts_clock_src { AMPLC_DIO_TS_CLK_1GHZ, /* 1 ns period with 20 ns granularity */ AMPLC_DIO_TS_CLK_1MHZ, /* 1 us period */ AMPLC_DIO_TS_CLK_1KHZ /* 1 ms period */ }; -/* Values for setting a gate source with INSN_CONFIG_SET_GATE_SRC for - * 8254 counter subdevices on Amplicon DIO boards (amplc_dio200 driver). */ +/* + * Values for setting a gate source with INSN_CONFIG_SET_GATE_SRC for + * 8254 counter subdevices on Amplicon DIO boards (amplc_dio200 driver). + */ enum amplc_dio_gate_source { AMPLC_DIO_GAT_VCC, /* internal high logic level */ AMPLC_DIO_GAT_GND, /* internal low logic level */ AMPLC_DIO_GAT_GATN, /* per channel external gate input */ - AMPLC_DIO_GAT_NOUTNM2, /* negated output of counter channel - minus 2 (for channels 0 or 1, - channel minus 2 is channel 1 or 2 on - the preceding counter subdevice, for - the first counter subdevice the - preceding counter subdevice is the - last counter subdevice) */ + /* + * negated output of counter channel minus 2 + * (for channels 0 or 1, channel minus 2 is channel 1 or 2 on + * the preceding counter subdevice, for the first counter subdevice + * the preceding counter subdevice is the last counter subdevice) + */ + AMPLC_DIO_GAT_NOUTNM2, AMPLC_DIO_GAT_RESERVED4, AMPLC_DIO_GAT_RESERVED5, AMPLC_DIO_GAT_RESERVED6, AMPLC_DIO_GAT_RESERVED7, /* the following are "enhanced" gate sources for PCIe models */ AMPLC_DIO_GAT_NGATN = 6, /* negated per channel gate input */ - AMPLC_DIO_GAT_OUTNM2, /* non-negated output of counter - channel minus 2 */ + /* non-negated output of counter channel minus 2 */ + AMPLC_DIO_GAT_OUTNM2, AMPLC_DIO_GAT_PAT_PRESENT, /* "pattern present" signal */ AMPLC_DIO_GAT_PAT_OCCURRED, /* "pattern occurred" latched */ AMPLC_DIO_GAT_PAT_GONE, /* "pattern gone away" latched */ From c9e5ec256c7af7f1558290b66dd145326c403a18 Mon Sep 17 00:00:00 2001 From: Andrzej Pietrasiewicz Date: Sat, 14 Nov 2015 19:19:10 +0100 Subject: [PATCH 784/843] staging: comedi: ni_mio_common: add "no_channel" versions of some functions ni_release_ai_mite_channel(), ni_release_ao_mite_channel(), ni_release_gpct_mite_channel() and ni_release_cdo_mite_channel() call functions which interpret -1 as a special value meaning "no channel". This patch adds explicit "no_channel" versions instead. On the other hand, after "no_channel" versions are used, ni_set_ai_dma_channel(), ni_set_ao_dma_channel(), ni_set_gpct_dma_channel(), ni_set_cdo_dma_channel() are called with actual "channel" parameter being always unsigned, so their signatures are changed accordingly. A side benefit of the changes is suppressesing 4 sparse warnings: "warning: shift too big (4294967295) for type int". Signed-off-by: Andrzej Pietrasiewicz Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../staging/comedi/drivers/ni_mio_common.c | 82 +++++++++++-------- 1 file changed, 49 insertions(+), 33 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index cbb44fc6940b..5e8130a7d670 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -579,48 +579,54 @@ static inline unsigned ni_stc_dma_channel_select_bitfield(unsigned channel) return 0; } -/* negative channel means no channel */ -static inline void ni_set_ai_dma_channel(struct comedi_device *dev, int channel) +static inline void ni_set_ai_dma_channel(struct comedi_device *dev, + unsigned channel) { - unsigned bits = 0; - - if (channel >= 0) - bits = ni_stc_dma_channel_select_bitfield(channel); + unsigned bits = ni_stc_dma_channel_select_bitfield(channel); ni_set_bitfield(dev, NI_E_DMA_AI_AO_SEL_REG, NI_E_DMA_AI_SEL_MASK, NI_E_DMA_AI_SEL(bits)); } -/* negative channel means no channel */ -static inline void ni_set_ao_dma_channel(struct comedi_device *dev, int channel) +static inline void ni_set_ai_dma_no_channel(struct comedi_device *dev) { - unsigned bits = 0; + ni_set_bitfield(dev, NI_E_DMA_AI_AO_SEL_REG, NI_E_DMA_AI_SEL_MASK, 0); +} - if (channel >= 0) - bits = ni_stc_dma_channel_select_bitfield(channel); +static inline void ni_set_ao_dma_channel(struct comedi_device *dev, + unsigned channel) +{ + unsigned bits = ni_stc_dma_channel_select_bitfield(channel); ni_set_bitfield(dev, NI_E_DMA_AI_AO_SEL_REG, NI_E_DMA_AO_SEL_MASK, NI_E_DMA_AO_SEL(bits)); } -/* negative channel means no channel */ +static inline void ni_set_ao_dma_no_channel(struct comedi_device *dev) +{ + ni_set_bitfield(dev, NI_E_DMA_AI_AO_SEL_REG, NI_E_DMA_AO_SEL_MASK, 0); +} + static inline void ni_set_gpct_dma_channel(struct comedi_device *dev, unsigned gpct_index, - int channel) + unsigned channel) { - unsigned bits = 0; - - if (channel >= 0) - bits = ni_stc_dma_channel_select_bitfield(channel); + unsigned bits = ni_stc_dma_channel_select_bitfield(channel); ni_set_bitfield(dev, NI_E_DMA_G0_G1_SEL_REG, NI_E_DMA_G0_G1_SEL_MASK(gpct_index), NI_E_DMA_G0_G1_SEL(gpct_index, bits)); } -/* negative mite_channel means no channel */ +static inline void ni_set_gpct_dma_no_channel(struct comedi_device *dev, + unsigned gpct_index) +{ + ni_set_bitfield(dev, NI_E_DMA_G0_G1_SEL_REG, + NI_E_DMA_G0_G1_SEL_MASK(gpct_index), 0); +} + static inline void ni_set_cdo_dma_channel(struct comedi_device *dev, - int mite_channel) + unsigned mite_channel) { struct ni_private *devpriv = dev->private; unsigned long flags; @@ -628,16 +634,26 @@ static inline void ni_set_cdo_dma_channel(struct comedi_device *dev, spin_lock_irqsave(&devpriv->soft_reg_copy_lock, flags); devpriv->cdio_dma_select_reg &= ~NI_M_CDIO_DMA_SEL_CDO_MASK; - if (mite_channel >= 0) { - /* - * XXX just guessing ni_stc_dma_channel_select_bitfield() - * returns the right bits, under the assumption the cdio dma - * selection works just like ai/ao/gpct. - * Definitely works for dma channels 0 and 1. - */ - bits = ni_stc_dma_channel_select_bitfield(mite_channel); - devpriv->cdio_dma_select_reg |= NI_M_CDIO_DMA_SEL_CDO(bits); - } + /* + * XXX just guessing ni_stc_dma_channel_select_bitfield() + * returns the right bits, under the assumption the cdio dma + * selection works just like ai/ao/gpct. + * Definitely works for dma channels 0 and 1. + */ + bits = ni_stc_dma_channel_select_bitfield(mite_channel); + devpriv->cdio_dma_select_reg |= NI_M_CDIO_DMA_SEL_CDO(bits); + ni_writeb(dev, devpriv->cdio_dma_select_reg, NI_M_CDIO_DMA_SEL_REG); + mmiowb(); + spin_unlock_irqrestore(&devpriv->soft_reg_copy_lock, flags); +} + +static inline void ni_set_cdo_dma_no_channel(struct comedi_device *dev) +{ + struct ni_private *devpriv = dev->private; + unsigned long flags; + + spin_lock_irqsave(&devpriv->soft_reg_copy_lock, flags); + devpriv->cdio_dma_select_reg &= ~NI_M_CDIO_DMA_SEL_CDO_MASK; ni_writeb(dev, devpriv->cdio_dma_select_reg, NI_M_CDIO_DMA_SEL_REG); mmiowb(); spin_unlock_irqrestore(&devpriv->soft_reg_copy_lock, flags); @@ -745,7 +761,7 @@ static void ni_release_ai_mite_channel(struct comedi_device *dev) spin_lock_irqsave(&devpriv->mite_channel_lock, flags); if (devpriv->ai_mite_chan) { - ni_set_ai_dma_channel(dev, -1); + ni_set_ai_dma_no_channel(dev); mite_release_channel(devpriv->ai_mite_chan); devpriv->ai_mite_chan = NULL; } @@ -761,7 +777,7 @@ static void ni_release_ao_mite_channel(struct comedi_device *dev) spin_lock_irqsave(&devpriv->mite_channel_lock, flags); if (devpriv->ao_mite_chan) { - ni_set_ao_dma_channel(dev, -1); + ni_set_ao_dma_no_channel(dev); mite_release_channel(devpriv->ao_mite_chan); devpriv->ao_mite_chan = NULL; } @@ -781,7 +797,7 @@ static void ni_release_gpct_mite_channel(struct comedi_device *dev, struct mite_channel *mite_chan = devpriv->counter_dev->counters[gpct_index].mite_chan; - ni_set_gpct_dma_channel(dev, gpct_index, -1); + ni_set_gpct_dma_no_channel(dev, gpct_index); ni_tio_set_mite_channel(&devpriv-> counter_dev->counters[gpct_index], NULL); @@ -799,7 +815,7 @@ static void ni_release_cdo_mite_channel(struct comedi_device *dev) spin_lock_irqsave(&devpriv->mite_channel_lock, flags); if (devpriv->cdo_mite_chan) { - ni_set_cdo_dma_channel(dev, -1); + ni_set_cdo_dma_no_channel(dev); mite_release_channel(devpriv->cdo_mite_chan); devpriv->cdo_mite_chan = NULL; } From cff93d73f7d9a8ec6fff057e0ee8ccd89a1ed6ec Mon Sep 17 00:00:00 2001 From: Ranjith Thangavel Date: Mon, 16 Nov 2015 22:26:15 +0530 Subject: [PATCH 785/843] comedi: ni_6527: Fix coding style - use BIT macro BIT macro is used for defining BIT location instead of shifting operator - coding style issue Signed-off-by: Ranjith Thangavel Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_6527.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_6527.c b/drivers/staging/comedi/drivers/ni_6527.c index 62a817e4cd64..84c62e256094 100644 --- a/drivers/staging/comedi/drivers/ni_6527.c +++ b/drivers/staging/comedi/drivers/ni_6527.c @@ -42,24 +42,24 @@ #define NI6527_DO_REG(x) (0x03 + (x)) #define NI6527_ID_REG 0x06 #define NI6527_CLR_REG 0x07 -#define NI6527_CLR_EDGE (1 << 3) -#define NI6527_CLR_OVERFLOW (1 << 2) -#define NI6527_CLR_FILT (1 << 1) -#define NI6527_CLR_INTERVAL (1 << 0) +#define NI6527_CLR_EDGE BIT(3) +#define NI6527_CLR_OVERFLOW BIT(2) +#define NI6527_CLR_FILT BIT(1) +#define NI6527_CLR_INTERVAL BIT(0) #define NI6527_CLR_IRQS (NI6527_CLR_EDGE | NI6527_CLR_OVERFLOW) #define NI6527_CLR_RESET_FILT (NI6527_CLR_FILT | NI6527_CLR_INTERVAL) #define NI6527_FILT_INTERVAL_REG(x) (0x08 + (x)) #define NI6527_FILT_ENA_REG(x) (0x0c + (x)) #define NI6527_STATUS_REG 0x14 -#define NI6527_STATUS_IRQ (1 << 2) -#define NI6527_STATUS_OVERFLOW (1 << 1) -#define NI6527_STATUS_EDGE (1 << 0) +#define NI6527_STATUS_IRQ BIT(2) +#define NI6527_STATUS_OVERFLOW BIT(1) +#define NI6527_STATUS_EDGE BIT(0) #define NI6527_CTRL_REG 0x15 -#define NI6527_CTRL_FALLING (1 << 4) -#define NI6527_CTRL_RISING (1 << 3) -#define NI6527_CTRL_IRQ (1 << 2) -#define NI6527_CTRL_OVERFLOW (1 << 1) -#define NI6527_CTRL_EDGE (1 << 0) +#define NI6527_CTRL_FALLING BIT(4) +#define NI6527_CTRL_RISING BIT(3) +#define NI6527_CTRL_IRQ BIT(2) +#define NI6527_CTRL_OVERFLOW BIT(1) +#define NI6527_CTRL_EDGE BIT(0) #define NI6527_CTRL_DISABLE_IRQS 0 #define NI6527_CTRL_ENABLE_IRQS (NI6527_CTRL_FALLING | \ NI6527_CTRL_RISING | \ From e29641c21ef24e9e515e02ffcb213f4d51fd097e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:02 -0700 Subject: [PATCH 786/843] staging: comedi: adv_pci_dio: remove unnecessary function separation comments These are not necessary and just add cruft. Remove them. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 81b2cf27182c..28ed1cd3e9fa 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -298,9 +298,6 @@ static const struct dio_boardtype boardtypes[] = { }, }; -/* -============================================================================== -*/ static int pci_dio_insn_bits_di_b(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -315,9 +312,6 @@ static int pci_dio_insn_bits_di_b(struct comedi_device *dev, return insn->n; } -/* -============================================================================== -*/ static int pci_dio_insn_bits_di_w(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -497,9 +491,6 @@ static int pci_dio_add_di(struct comedi_device *dev, return 0; } -/* -============================================================================== -*/ static int pci_dio_add_do(struct comedi_device *dev, struct comedi_subdevice *s, const struct diosubd_data *d) From 744099055fd51cfb8db49784be23032751a3a228 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:03 -0700 Subject: [PATCH 787/843] staging: comedi: adv_pci_dio: tidy up comedi driver block comment Reformat the bolck comment in the kernel CodingStyle. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 40 +++++++++----------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 28ed1cd3e9fa..9794502a8565 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -4,30 +4,24 @@ * Author: Michal Dobes * * Hardware driver for Advantech PCI DIO cards. -*/ + */ + /* -Driver: adv_pci_dio -Description: Advantech PCI-1730, PCI-1733, PCI-1734, PCI-1735U, - PCI-1736UP, PCI-1739U, PCI-1750, PCI-1751, PCI-1752, - PCI-1753/E, PCI-1754, PCI-1756, PCI-1762 -Author: Michal Dobes -Devices: [Advantech] PCI-1730 (adv_pci_dio), PCI-1733, - PCI-1734, PCI-1735U, PCI-1736UP, PCI-1739U, PCI-1750, - PCI-1751, PCI-1752, PCI-1753, - PCI-1753+PCI-1753E, PCI-1754, PCI-1756, - PCI-1762 -Status: untested -Updated: Mon, 09 Jan 2012 12:40:46 +0000 - -This driver supports now only insn interface for DI/DO/DIO. - -Configuration options: - [0] - PCI bus of device (optional) - [1] - PCI slot of device (optional) - If bus/slot is not specified, the first available PCI - device will be used. - -*/ + * Driver: adv_pci_dio + * Description: Advantech PCI-1730, PCI-1733, PCI-1734, PCI-1735U, + * PCI-1736UP, PCI-1739U, PCI-1750, PCI-1751, PCI-1752, + * PCI-1753/E, PCI-1754, PCI-1756, PCI-1762 + * Devices: [Advantech] PCI-1730 (adv_pci_dio), PCI-1733, + * PCI-1734, PCI-1735U, PCI-1736UP, PCI-1739U, PCI-1750, + * PCI-1751, PCI-1752, PCI-1753, + * PCI-1753+PCI-1753E, PCI-1754, PCI-1756, + * PCI-1762 + * Author: Michal Dobes + * Updated: Mon, 09 Jan 2012 12:40:46 +0000 + * Status: untested + * + * Configuration Options: not applicable, uses PCI auto config + */ #include #include From c1e07ea22a46c39cbd632233f716ec3a591d94ed Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:04 -0700 Subject: [PATCH 788/843] staging: comedi: adv_pci_dio: remove 'main_pci_region' boardinfo All the boards use PCI BAR2 for the dev->iobase except for the pci1736 which uses PCI BAR0. Just use the board->cardtype to determine which PCI BAR to use. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 30 +++++--------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 9794502a8565..b1f966e7f392 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -53,8 +53,6 @@ enum hw_io_access { #define MAX_DIO_SUBDEVG 2 /* max number of DIO subdevices group per * card */ -#define PCIDIO_MAINREG 2 /* main I/O region for all Advantech cards? */ - /* Register offset definitions */ /* Advantech PCI-1730/3/4 */ #define PCI1730_IDI 0 /* R: Isolated digital input 0-15 */ @@ -83,7 +81,6 @@ enum hw_io_access { * interrupts */ #define PCI1736_3_INT_CLR 0x10 /* R/W: clear interrupts */ #define PCI1736_BOARDID 4 /* R: Board I/D switch for 1736UP */ -#define PCI1736_MAINREG 0 /* Normal register (2) doesn't work */ /* Advantech PCI-1739U */ #define PCI1739_DIO 0 /* R/W: begin of 8255 registers block */ @@ -144,7 +141,6 @@ struct diosubd_data { struct dio_boardtype { const char *name; /* board name */ - int main_pci_region; /* main I/O PCI region */ enum hw_cards_id cardtype; int nsubdevs; struct diosubd_data sdi[MAX_DI_SUBDEVS]; /* DI chans */ @@ -158,7 +154,6 @@ struct dio_boardtype { static const struct dio_boardtype boardtypes[] = { [TYPE_PCI1730] = { .name = "pci1730", - .main_pci_region = PCIDIO_MAINREG, .cardtype = TYPE_PCI1730, .nsubdevs = 5, .sdi[0] = { 16, PCI1730_DI, 2, 0, }, @@ -170,7 +165,6 @@ static const struct dio_boardtype boardtypes[] = { }, [TYPE_PCI1733] = { .name = "pci1733", - .main_pci_region = PCIDIO_MAINREG, .cardtype = TYPE_PCI1733, .nsubdevs = 2, .sdi[1] = { 32, PCI1733_IDI, 4, 0, }, @@ -179,7 +173,6 @@ static const struct dio_boardtype boardtypes[] = { }, [TYPE_PCI1734] = { .name = "pci1734", - .main_pci_region = PCIDIO_MAINREG, .cardtype = TYPE_PCI1734, .nsubdevs = 2, .sdo[1] = { 32, PCI1734_IDO, 4, 0, }, @@ -188,7 +181,6 @@ static const struct dio_boardtype boardtypes[] = { }, [TYPE_PCI1735] = { .name = "pci1735", - .main_pci_region = PCIDIO_MAINREG, .cardtype = TYPE_PCI1735, .nsubdevs = 4, .sdi[0] = { 32, PCI1735_DI, 4, 0, }, @@ -199,7 +191,6 @@ static const struct dio_boardtype boardtypes[] = { }, [TYPE_PCI1736] = { .name = "pci1736", - .main_pci_region = PCI1736_MAINREG, .cardtype = TYPE_PCI1736, .nsubdevs = 3, .sdi[1] = { 16, PCI1736_IDI, 2, 0, }, @@ -209,7 +200,6 @@ static const struct dio_boardtype boardtypes[] = { }, [TYPE_PCI1739] = { .name = "pci1739", - .main_pci_region = PCIDIO_MAINREG, .cardtype = TYPE_PCI1739, .nsubdevs = 2, .sdio[0] = { 48, PCI1739_DIO, 2, 0, }, @@ -217,7 +207,6 @@ static const struct dio_boardtype boardtypes[] = { }, [TYPE_PCI1750] = { .name = "pci1750", - .main_pci_region = PCIDIO_MAINREG, .cardtype = TYPE_PCI1750, .nsubdevs = 2, .sdi[1] = { 16, PCI1750_IDI, 2, 0, }, @@ -226,7 +215,6 @@ static const struct dio_boardtype boardtypes[] = { }, [TYPE_PCI1751] = { .name = "pci1751", - .main_pci_region = PCIDIO_MAINREG, .cardtype = TYPE_PCI1751, .nsubdevs = 3, .sdio[0] = { 48, PCI1751_DIO, 2, 0, }, @@ -235,7 +223,6 @@ static const struct dio_boardtype boardtypes[] = { }, [TYPE_PCI1752] = { .name = "pci1752", - .main_pci_region = PCIDIO_MAINREG, .cardtype = TYPE_PCI1752, .nsubdevs = 3, .sdo[0] = { 32, PCI1752_IDO, 2, 0, }, @@ -245,7 +232,6 @@ static const struct dio_boardtype boardtypes[] = { }, [TYPE_PCI1753] = { .name = "pci1753", - .main_pci_region = PCIDIO_MAINREG, .cardtype = TYPE_PCI1753, .nsubdevs = 4, .sdio[0] = { 96, PCI1753_DIO, 4, 0, }, @@ -253,7 +239,6 @@ static const struct dio_boardtype boardtypes[] = { }, [TYPE_PCI1753E] = { .name = "pci1753e", - .main_pci_region = PCIDIO_MAINREG, .cardtype = TYPE_PCI1753E, .nsubdevs = 8, .sdio[0] = { 96, PCI1753_DIO, 4, 0, }, @@ -262,7 +247,6 @@ static const struct dio_boardtype boardtypes[] = { }, [TYPE_PCI1754] = { .name = "pci1754", - .main_pci_region = PCIDIO_MAINREG, .cardtype = TYPE_PCI1754, .nsubdevs = 3, .sdi[0] = { 32, PCI1754_IDI, 2, 0, }, @@ -272,7 +256,6 @@ static const struct dio_boardtype boardtypes[] = { }, [TYPE_PCI1756] = { .name = "pci1756", - .main_pci_region = PCIDIO_MAINREG, .cardtype = TYPE_PCI1756, .nsubdevs = 3, .sdi[1] = { 32, PCI1756_IDI, 2, 0, }, @@ -282,7 +265,6 @@ static const struct dio_boardtype boardtypes[] = { }, [TYPE_PCI1762] = { .name = "pci1762", - .main_pci_region = PCIDIO_MAINREG, .cardtype = TYPE_PCI1762, .nsubdevs = 3, .sdi[1] = { 16, PCI1762_IDI, 1, 0, }, @@ -525,14 +507,13 @@ static unsigned long pci_dio_override_cardtype(struct pci_dev *pcidev, return cardtype; if (pci_enable_device(pcidev) < 0) return cardtype; - if (pci_request_region(pcidev, PCIDIO_MAINREG, "adv_pci_dio") == 0) { + if (pci_request_region(pcidev, 2, "adv_pci_dio") == 0) { /* * This test is based on Advantech's "advdaq" driver source * (which declares its module licence as "GPL" although the * driver source does not include a "COPYING" file). */ - unsigned long reg = - pci_resource_start(pcidev, PCIDIO_MAINREG) + 53; + unsigned long reg = pci_resource_start(pcidev, 2) + 53; outb(0x05, reg); if ((inb(reg) & 0x07) == 0x02) { @@ -540,7 +521,7 @@ static unsigned long pci_dio_override_cardtype(struct pci_dev *pcidev, if ((inb(reg) & 0x07) == 0x05) cardtype = TYPE_PCI1753E; } - pci_release_region(pcidev, PCIDIO_MAINREG); + pci_release_region(pcidev, 2); } pci_disable_device(pcidev); return cardtype; @@ -564,7 +545,10 @@ static int pci_dio_auto_attach(struct comedi_device *dev, ret = comedi_pci_enable(dev); if (ret) return ret; - dev->iobase = pci_resource_start(pcidev, board->main_pci_region); + if (board->cardtype == TYPE_PCI1736) + dev->iobase = pci_resource_start(pcidev, 0); + else + dev->iobase = pci_resource_start(pcidev, 2); ret = comedi_alloc_subdevices(dev, board->nsubdevs); if (ret) From afe5c118bd07edcb00503bd0f4ab83a6e56ae9d8 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:05 -0700 Subject: [PATCH 789/843] staging: comedi: adv_pci_dio: post increment 'subdev' in (*auto_attach) For aesthetics, post-increment the 'subdev' index when used to get a comedi_subdevice pointer instead of incrementing it after the subdevice is initialized. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index b1f966e7f392..4d4b38c1d0fc 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -557,38 +557,34 @@ static int pci_dio_auto_attach(struct comedi_device *dev, subdev = 0; for (i = 0; i < MAX_DI_SUBDEVS; i++) if (board->sdi[i].chans) { - s = &dev->subdevices[subdev]; + s = &dev->subdevices[subdev++]; pci_dio_add_di(dev, s, &board->sdi[i]); - subdev++; } for (i = 0; i < MAX_DO_SUBDEVS; i++) if (board->sdo[i].chans) { - s = &dev->subdevices[subdev]; + s = &dev->subdevices[subdev++]; pci_dio_add_do(dev, s, &board->sdo[i]); - subdev++; } for (i = 0; i < MAX_DIO_SUBDEVG; i++) for (j = 0; j < board->sdio[i].regs; j++) { - s = &dev->subdevices[subdev]; + s = &dev->subdevices[subdev++]; ret = subdev_8255_init(dev, s, NULL, board->sdio[i].addr + j * I8255_SIZE); if (ret) return ret; - subdev++; } if (board->boardid.chans) { - s = &dev->subdevices[subdev]; + s = &dev->subdevices[subdev++]; s->type = COMEDI_SUBD_DI; pci_dio_add_di(dev, s, &board->boardid); - subdev++; } if (board->timer_regbase) { - s = &dev->subdevices[subdev]; + s = &dev->subdevices[subdev++]; dev->pacer = comedi_8254_init(dev->iobase + board->timer_regbase, @@ -597,8 +593,6 @@ static int pci_dio_auto_attach(struct comedi_device *dev, return -ENOMEM; comedi_8254_subdevice_init(s, dev->pacer); - - subdev++; } pci_dio_reset(dev); From a1132fc1bb6914940aeaa68f32a79ca846e2090f Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:06 -0700 Subject: [PATCH 790/843] staging: comedi: adv_pci_dio: use a const pointer to the diosubd_data For aesthetics, use a const pointer to access the diosubd_data in the boardinfo when doing the (*auto_attach).. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 31 ++++++++++++-------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 4d4b38c1d0fc..5da1e623b01f 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -532,6 +532,7 @@ static int pci_dio_auto_attach(struct comedi_device *dev, { struct pci_dev *pcidev = comedi_to_pci_dev(dev); const struct dio_boardtype *board = NULL; + const struct diosubd_data *d; struct comedi_subdevice *s; int ret, subdev, i, j; @@ -555,32 +556,38 @@ static int pci_dio_auto_attach(struct comedi_device *dev, return ret; subdev = 0; - for (i = 0; i < MAX_DI_SUBDEVS; i++) - if (board->sdi[i].chans) { + for (i = 0; i < MAX_DI_SUBDEVS; i++) { + d = &board->sdi[i]; + if (d->chans) { s = &dev->subdevices[subdev++]; - pci_dio_add_di(dev, s, &board->sdi[i]); + pci_dio_add_di(dev, s, d); } + } - for (i = 0; i < MAX_DO_SUBDEVS; i++) - if (board->sdo[i].chans) { + for (i = 0; i < MAX_DO_SUBDEVS; i++) { + d = &board->sdo[i]; + if (d->chans) { s = &dev->subdevices[subdev++]; - pci_dio_add_do(dev, s, &board->sdo[i]); + pci_dio_add_do(dev, s, d); } + } - for (i = 0; i < MAX_DIO_SUBDEVG; i++) - for (j = 0; j < board->sdio[i].regs; j++) { + for (i = 0; i < MAX_DIO_SUBDEVG; i++) { + d = &board->sdio[i]; + for (j = 0; j < d->regs; j++) { s = &dev->subdevices[subdev++]; ret = subdev_8255_init(dev, s, NULL, - board->sdio[i].addr + - j * I8255_SIZE); + d->addr + j * I8255_SIZE); if (ret) return ret; } + } - if (board->boardid.chans) { + d = &board->boardid; + if (d->chans) { s = &dev->subdevices[subdev++]; s->type = COMEDI_SUBD_DI; - pci_dio_add_di(dev, s, &board->boardid); + pci_dio_add_di(dev, s, d); } if (board->timer_regbase) { From ac93d19adcd3ac4eecb246bdb6bc458c73865199 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:07 -0700 Subject: [PATCH 791/843] staging: comedi: adv_pci_dio: absorb pci_dio_add_do() This function initializes a digitial output subdevice. For aesthetics, absorb it into the (*auto_attach). Remove the improper initialization of the SDF_LSAMPL subdev_flag and len_chanlist. These are only used by subdevices that support async commands. Also remove the unnecessary initilaization of the subdevice 'state'. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 43 +++++++------------- 1 file changed, 14 insertions(+), 29 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 5da1e623b01f..deac3a8b9bb8 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -467,34 +467,6 @@ static int pci_dio_add_di(struct comedi_device *dev, return 0; } -static int pci_dio_add_do(struct comedi_device *dev, - struct comedi_subdevice *s, - const struct diosubd_data *d) -{ - const struct dio_boardtype *board = dev->board_ptr; - - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - if (d->chans > 16) - s->subdev_flags |= SDF_LSAMPL; - s->n_chan = d->chans; - s->maxdata = 1; - s->len_chanlist = d->chans; - s->range_table = &range_digital; - s->state = 0; - switch (board->io_access) { - case IO_8b: - s->insn_bits = pci_dio_insn_bits_do_b; - break; - case IO_16b: - s->insn_bits = pci_dio_insn_bits_do_w; - break; - } - s->private = (void *)d; - - return 0; -} - static unsigned long pci_dio_override_cardtype(struct pci_dev *pcidev, unsigned long cardtype) { @@ -568,7 +540,20 @@ static int pci_dio_auto_attach(struct comedi_device *dev, d = &board->sdo[i]; if (d->chans) { s = &dev->subdevices[subdev++]; - pci_dio_add_do(dev, s, d); + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = d->chans; + s->maxdata = 1; + s->range_table = &range_digital; + switch (board->io_access) { + case IO_8b: + s->insn_bits = pci_dio_insn_bits_do_b; + break; + case IO_16b: + s->insn_bits = pci_dio_insn_bits_do_w; + break; + } + s->private = (void *)d; } } From f5ceac9baacb7c83db4aba5ec059bc1a4f36273a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:08 -0700 Subject: [PATCH 792/843] staging: comedi: adv_pci_dio: absorb pci_dio_add_di() This function initializes a digitial input subdevices. For aesthetics, absorb it into the (*auto_attach). Remove the improper initialization of the SDF_LSAMPL subdev_flag and len_chanlist. These are only used by subdevices that support async commands. Also, remove the unnecessary 'specflags' from the diosubd_data. Only the boardid subdevice uses it. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 127 +++++++++---------- 1 file changed, 62 insertions(+), 65 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index deac3a8b9bb8..b0bbc7322cd5 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -136,7 +136,6 @@ struct diosubd_data { int addr; /* PCI address ofset */ int regs; /* number of registers to read or 8255 subdevices */ - unsigned int specflags; /* addon subdevice flags */ }; struct dio_boardtype { @@ -156,36 +155,36 @@ static const struct dio_boardtype boardtypes[] = { .name = "pci1730", .cardtype = TYPE_PCI1730, .nsubdevs = 5, - .sdi[0] = { 16, PCI1730_DI, 2, 0, }, - .sdi[1] = { 16, PCI1730_IDI, 2, 0, }, - .sdo[0] = { 16, PCI1730_DO, 2, 0, }, - .sdo[1] = { 16, PCI1730_IDO, 2, 0, }, - .boardid = { 4, PCI173x_BOARDID, 1, SDF_INTERNAL, }, + .sdi[0] = { 16, PCI1730_DI, 2, }, + .sdi[1] = { 16, PCI1730_IDI, 2, }, + .sdo[0] = { 16, PCI1730_DO, 2, }, + .sdo[1] = { 16, PCI1730_IDO, 2, }, + .boardid = { 4, PCI173x_BOARDID, 1, }, .io_access = IO_8b, }, [TYPE_PCI1733] = { .name = "pci1733", .cardtype = TYPE_PCI1733, .nsubdevs = 2, - .sdi[1] = { 32, PCI1733_IDI, 4, 0, }, - .boardid = { 4, PCI173x_BOARDID, 1, SDF_INTERNAL, }, + .sdi[1] = { 32, PCI1733_IDI, 4, }, + .boardid = { 4, PCI173x_BOARDID, 1, }, .io_access = IO_8b, }, [TYPE_PCI1734] = { .name = "pci1734", .cardtype = TYPE_PCI1734, .nsubdevs = 2, - .sdo[1] = { 32, PCI1734_IDO, 4, 0, }, - .boardid = { 4, PCI173x_BOARDID, 1, SDF_INTERNAL, }, + .sdo[1] = { 32, PCI1734_IDO, 4, }, + .boardid = { 4, PCI173x_BOARDID, 1, }, .io_access = IO_8b, }, [TYPE_PCI1735] = { .name = "pci1735", .cardtype = TYPE_PCI1735, .nsubdevs = 4, - .sdi[0] = { 32, PCI1735_DI, 4, 0, }, - .sdo[0] = { 32, PCI1735_DO, 4, 0, }, - .boardid = { 4, PCI1735_BOARDID, 1, SDF_INTERNAL, }, + .sdi[0] = { 32, PCI1735_DI, 4, }, + .sdo[0] = { 32, PCI1735_DO, 4, }, + .boardid = { 4, PCI1735_BOARDID, 1, }, .timer_regbase = PCI1735_C8254, .io_access = IO_8b, }, @@ -193,31 +192,31 @@ static const struct dio_boardtype boardtypes[] = { .name = "pci1736", .cardtype = TYPE_PCI1736, .nsubdevs = 3, - .sdi[1] = { 16, PCI1736_IDI, 2, 0, }, - .sdo[1] = { 16, PCI1736_IDO, 2, 0, }, - .boardid = { 4, PCI1736_BOARDID, 1, SDF_INTERNAL, }, + .sdi[1] = { 16, PCI1736_IDI, 2, }, + .sdo[1] = { 16, PCI1736_IDO, 2, }, + .boardid = { 4, PCI1736_BOARDID, 1, }, .io_access = IO_8b, }, [TYPE_PCI1739] = { .name = "pci1739", .cardtype = TYPE_PCI1739, .nsubdevs = 2, - .sdio[0] = { 48, PCI1739_DIO, 2, 0, }, + .sdio[0] = { 48, PCI1739_DIO, 2, }, .io_access = IO_8b, }, [TYPE_PCI1750] = { .name = "pci1750", .cardtype = TYPE_PCI1750, .nsubdevs = 2, - .sdi[1] = { 16, PCI1750_IDI, 2, 0, }, - .sdo[1] = { 16, PCI1750_IDO, 2, 0, }, + .sdi[1] = { 16, PCI1750_IDI, 2, }, + .sdo[1] = { 16, PCI1750_IDO, 2, }, .io_access = IO_8b, }, [TYPE_PCI1751] = { .name = "pci1751", .cardtype = TYPE_PCI1751, .nsubdevs = 3, - .sdio[0] = { 48, PCI1751_DIO, 2, 0, }, + .sdio[0] = { 48, PCI1751_DIO, 2, }, .timer_regbase = PCI1751_CNT, .io_access = IO_8b, }, @@ -225,51 +224,51 @@ static const struct dio_boardtype boardtypes[] = { .name = "pci1752", .cardtype = TYPE_PCI1752, .nsubdevs = 3, - .sdo[0] = { 32, PCI1752_IDO, 2, 0, }, - .sdo[1] = { 32, PCI1752_IDO2, 2, 0, }, - .boardid = { 4, PCI175x_BOARDID, 1, SDF_INTERNAL, }, + .sdo[0] = { 32, PCI1752_IDO, 2, }, + .sdo[1] = { 32, PCI1752_IDO2, 2, }, + .boardid = { 4, PCI175x_BOARDID, 1, }, .io_access = IO_16b, }, [TYPE_PCI1753] = { .name = "pci1753", .cardtype = TYPE_PCI1753, .nsubdevs = 4, - .sdio[0] = { 96, PCI1753_DIO, 4, 0, }, + .sdio[0] = { 96, PCI1753_DIO, 4, }, .io_access = IO_8b, }, [TYPE_PCI1753E] = { .name = "pci1753e", .cardtype = TYPE_PCI1753E, .nsubdevs = 8, - .sdio[0] = { 96, PCI1753_DIO, 4, 0, }, - .sdio[1] = { 96, PCI1753E_DIO, 4, 0, }, + .sdio[0] = { 96, PCI1753_DIO, 4, }, + .sdio[1] = { 96, PCI1753E_DIO, 4, }, .io_access = IO_8b, }, [TYPE_PCI1754] = { .name = "pci1754", .cardtype = TYPE_PCI1754, .nsubdevs = 3, - .sdi[0] = { 32, PCI1754_IDI, 2, 0, }, - .sdi[1] = { 32, PCI1754_IDI2, 2, 0, }, - .boardid = { 4, PCI175x_BOARDID, 1, SDF_INTERNAL, }, + .sdi[0] = { 32, PCI1754_IDI, 2, }, + .sdi[1] = { 32, PCI1754_IDI2, 2, }, + .boardid = { 4, PCI175x_BOARDID, 1, }, .io_access = IO_16b, }, [TYPE_PCI1756] = { .name = "pci1756", .cardtype = TYPE_PCI1756, .nsubdevs = 3, - .sdi[1] = { 32, PCI1756_IDI, 2, 0, }, - .sdo[1] = { 32, PCI1756_IDO, 2, 0, }, - .boardid = { 4, PCI175x_BOARDID, 1, SDF_INTERNAL, }, + .sdi[1] = { 32, PCI1756_IDI, 2, }, + .sdo[1] = { 32, PCI1756_IDO, 2, }, + .boardid = { 4, PCI175x_BOARDID, 1, }, .io_access = IO_16b, }, [TYPE_PCI1762] = { .name = "pci1762", .cardtype = TYPE_PCI1762, .nsubdevs = 3, - .sdi[1] = { 16, PCI1762_IDI, 1, 0, }, - .sdo[1] = { 16, PCI1762_RO, 1, 0, }, - .boardid = { 4, PCI1762_BOARDID, 1, SDF_INTERNAL, }, + .sdi[1] = { 16, PCI1762_IDI, 1, }, + .sdo[1] = { 16, PCI1762_RO, 1, }, + .boardid = { 4, PCI1762_BOARDID, 1, }, .io_access = IO_16b, }, }; @@ -440,33 +439,6 @@ static int pci_dio_reset(struct comedi_device *dev) return 0; } -static int pci_dio_add_di(struct comedi_device *dev, - struct comedi_subdevice *s, - const struct diosubd_data *d) -{ - const struct dio_boardtype *board = dev->board_ptr; - - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE | d->specflags; - if (d->chans > 16) - s->subdev_flags |= SDF_LSAMPL; - s->n_chan = d->chans; - s->maxdata = 1; - s->len_chanlist = d->chans; - s->range_table = &range_digital; - switch (board->io_access) { - case IO_8b: - s->insn_bits = pci_dio_insn_bits_di_b; - break; - case IO_16b: - s->insn_bits = pci_dio_insn_bits_di_w; - break; - } - s->private = (void *)d; - - return 0; -} - static unsigned long pci_dio_override_cardtype(struct pci_dev *pcidev, unsigned long cardtype) { @@ -532,7 +504,20 @@ static int pci_dio_auto_attach(struct comedi_device *dev, d = &board->sdi[i]; if (d->chans) { s = &dev->subdevices[subdev++]; - pci_dio_add_di(dev, s, d); + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = d->chans; + s->maxdata = 1; + s->range_table = &range_digital; + switch (board->io_access) { + case IO_8b: + s->insn_bits = pci_dio_insn_bits_di_b; + break; + case IO_16b: + s->insn_bits = pci_dio_insn_bits_di_w; + break; + } + s->private = (void *)d; } } @@ -571,8 +556,20 @@ static int pci_dio_auto_attach(struct comedi_device *dev, d = &board->boardid; if (d->chans) { s = &dev->subdevices[subdev++]; - s->type = COMEDI_SUBD_DI; - pci_dio_add_di(dev, s, d); + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE | SDF_INTERNAL; + s->n_chan = d->chans; + s->maxdata = 1; + s->range_table = &range_digital; + switch (board->io_access) { + case IO_8b: + s->insn_bits = pci_dio_insn_bits_di_b; + break; + case IO_16b: + s->insn_bits = pci_dio_insn_bits_di_w; + break; + } + s->private = (void *)d; } if (board->timer_regbase) { From 3cdddd6338749da4102788467584c8d9a2ee2699 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:09 -0700 Subject: [PATCH 793/843] staging: comedi: adv_pci_dio: refactor 'io_access' boardinfo The boards supported by this driver either use 8-bit or 16-bit I/O. The 'io_access' member of the boardinfo is used by the (*auto_attach) to determine which (*insn_bits) function to use. Simplify the boardinfo a bit by refactoring the 'io_access' member into a bit-field flag 'is_16bit'. Use the new flag and remove the switch () code in the (*auto_attach). Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 57 +++++--------------- 1 file changed, 13 insertions(+), 44 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index b0bbc7322cd5..ba3cb3b338e2 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -43,11 +43,6 @@ enum hw_cards_id { TYPE_PCI1762 }; -/* which I/O instructions to use */ -enum hw_io_access { - IO_8b, IO_16b -}; - #define MAX_DI_SUBDEVS 2 /* max number of DI subdevices per card */ #define MAX_DO_SUBDEVS 2 /* max number of DO subdevices per card */ #define MAX_DIO_SUBDEVG 2 /* max number of DIO subdevices group per @@ -147,7 +142,7 @@ struct dio_boardtype { struct diosubd_data sdio[MAX_DIO_SUBDEVG]; /* DIO 8255 chans */ struct diosubd_data boardid; /* card supports board ID switch */ unsigned long timer_regbase; - enum hw_io_access io_access; + unsigned int is_16bit:1; }; static const struct dio_boardtype boardtypes[] = { @@ -160,7 +155,6 @@ static const struct dio_boardtype boardtypes[] = { .sdo[0] = { 16, PCI1730_DO, 2, }, .sdo[1] = { 16, PCI1730_IDO, 2, }, .boardid = { 4, PCI173x_BOARDID, 1, }, - .io_access = IO_8b, }, [TYPE_PCI1733] = { .name = "pci1733", @@ -168,7 +162,6 @@ static const struct dio_boardtype boardtypes[] = { .nsubdevs = 2, .sdi[1] = { 32, PCI1733_IDI, 4, }, .boardid = { 4, PCI173x_BOARDID, 1, }, - .io_access = IO_8b, }, [TYPE_PCI1734] = { .name = "pci1734", @@ -176,7 +169,6 @@ static const struct dio_boardtype boardtypes[] = { .nsubdevs = 2, .sdo[1] = { 32, PCI1734_IDO, 4, }, .boardid = { 4, PCI173x_BOARDID, 1, }, - .io_access = IO_8b, }, [TYPE_PCI1735] = { .name = "pci1735", @@ -186,7 +178,6 @@ static const struct dio_boardtype boardtypes[] = { .sdo[0] = { 32, PCI1735_DO, 4, }, .boardid = { 4, PCI1735_BOARDID, 1, }, .timer_regbase = PCI1735_C8254, - .io_access = IO_8b, }, [TYPE_PCI1736] = { .name = "pci1736", @@ -195,14 +186,12 @@ static const struct dio_boardtype boardtypes[] = { .sdi[1] = { 16, PCI1736_IDI, 2, }, .sdo[1] = { 16, PCI1736_IDO, 2, }, .boardid = { 4, PCI1736_BOARDID, 1, }, - .io_access = IO_8b, }, [TYPE_PCI1739] = { .name = "pci1739", .cardtype = TYPE_PCI1739, .nsubdevs = 2, .sdio[0] = { 48, PCI1739_DIO, 2, }, - .io_access = IO_8b, }, [TYPE_PCI1750] = { .name = "pci1750", @@ -210,7 +199,6 @@ static const struct dio_boardtype boardtypes[] = { .nsubdevs = 2, .sdi[1] = { 16, PCI1750_IDI, 2, }, .sdo[1] = { 16, PCI1750_IDO, 2, }, - .io_access = IO_8b, }, [TYPE_PCI1751] = { .name = "pci1751", @@ -218,7 +206,6 @@ static const struct dio_boardtype boardtypes[] = { .nsubdevs = 3, .sdio[0] = { 48, PCI1751_DIO, 2, }, .timer_regbase = PCI1751_CNT, - .io_access = IO_8b, }, [TYPE_PCI1752] = { .name = "pci1752", @@ -227,14 +214,13 @@ static const struct dio_boardtype boardtypes[] = { .sdo[0] = { 32, PCI1752_IDO, 2, }, .sdo[1] = { 32, PCI1752_IDO2, 2, }, .boardid = { 4, PCI175x_BOARDID, 1, }, - .io_access = IO_16b, + .is_16bit = 1, }, [TYPE_PCI1753] = { .name = "pci1753", .cardtype = TYPE_PCI1753, .nsubdevs = 4, .sdio[0] = { 96, PCI1753_DIO, 4, }, - .io_access = IO_8b, }, [TYPE_PCI1753E] = { .name = "pci1753e", @@ -242,7 +228,6 @@ static const struct dio_boardtype boardtypes[] = { .nsubdevs = 8, .sdio[0] = { 96, PCI1753_DIO, 4, }, .sdio[1] = { 96, PCI1753E_DIO, 4, }, - .io_access = IO_8b, }, [TYPE_PCI1754] = { .name = "pci1754", @@ -251,7 +236,7 @@ static const struct dio_boardtype boardtypes[] = { .sdi[0] = { 32, PCI1754_IDI, 2, }, .sdi[1] = { 32, PCI1754_IDI2, 2, }, .boardid = { 4, PCI175x_BOARDID, 1, }, - .io_access = IO_16b, + .is_16bit = 1, }, [TYPE_PCI1756] = { .name = "pci1756", @@ -260,7 +245,7 @@ static const struct dio_boardtype boardtypes[] = { .sdi[1] = { 32, PCI1756_IDI, 2, }, .sdo[1] = { 32, PCI1756_IDO, 2, }, .boardid = { 4, PCI175x_BOARDID, 1, }, - .io_access = IO_16b, + .is_16bit = 1, }, [TYPE_PCI1762] = { .name = "pci1762", @@ -269,7 +254,7 @@ static const struct dio_boardtype boardtypes[] = { .sdi[1] = { 16, PCI1762_IDI, 1, }, .sdo[1] = { 16, PCI1762_RO, 1, }, .boardid = { 4, PCI1762_BOARDID, 1, }, - .io_access = IO_16b, + .is_16bit = 1, }, }; @@ -509,14 +494,9 @@ static int pci_dio_auto_attach(struct comedi_device *dev, s->n_chan = d->chans; s->maxdata = 1; s->range_table = &range_digital; - switch (board->io_access) { - case IO_8b: - s->insn_bits = pci_dio_insn_bits_di_b; - break; - case IO_16b: - s->insn_bits = pci_dio_insn_bits_di_w; - break; - } + s->insn_bits = board->is_16bit + ? pci_dio_insn_bits_di_w + : pci_dio_insn_bits_di_b; s->private = (void *)d; } } @@ -530,14 +510,9 @@ static int pci_dio_auto_attach(struct comedi_device *dev, s->n_chan = d->chans; s->maxdata = 1; s->range_table = &range_digital; - switch (board->io_access) { - case IO_8b: - s->insn_bits = pci_dio_insn_bits_do_b; - break; - case IO_16b: - s->insn_bits = pci_dio_insn_bits_do_w; - break; - } + s->insn_bits = board->is_16bit + ? pci_dio_insn_bits_do_w + : pci_dio_insn_bits_do_b; s->private = (void *)d; } } @@ -561,14 +536,8 @@ static int pci_dio_auto_attach(struct comedi_device *dev, s->n_chan = d->chans; s->maxdata = 1; s->range_table = &range_digital; - switch (board->io_access) { - case IO_8b: - s->insn_bits = pci_dio_insn_bits_di_b; - break; - case IO_16b: - s->insn_bits = pci_dio_insn_bits_di_w; - break; - } + s->insn_bits = board->is_16bit ? pci_dio_insn_bits_di_w + : pci_dio_insn_bits_di_b; s->private = (void *)d; } From 039c5c1b27e786cd92c130559800f88625988dee Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:10 -0700 Subject: [PATCH 794/843] staging: comedi: adv_pci_dio: remove need for diosubd_data 'regs' member Currently the (*insn_bits) functions used the 'regs' member to determine how many registers need to be read or written to update the subdevice. We can use the subdevice 'n_chan' to determine this and make the code a bit clearer. The (*auto_attach) also uses this member to determine how many 8255 devices need to be initialized. These subdevices do not use the 'chans' member of diosubd_data. Move the 'regs' value to the 'chans' to allow removing the 'regs' member completely. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 120 ++++++++++--------- 1 file changed, 64 insertions(+), 56 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index ba3cb3b338e2..e620e34c70bc 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -127,10 +127,8 @@ enum hw_cards_id { #define PCI1762_ISR 6 /* R: Interrupt status register */ struct diosubd_data { - int chans; /* num of chans */ + int chans; /* num of chans or 8255 devices */ int addr; /* PCI address ofset */ - int regs; /* number of registers to read or 8255 - subdevices */ }; struct dio_boardtype { @@ -150,138 +148,144 @@ static const struct dio_boardtype boardtypes[] = { .name = "pci1730", .cardtype = TYPE_PCI1730, .nsubdevs = 5, - .sdi[0] = { 16, PCI1730_DI, 2, }, - .sdi[1] = { 16, PCI1730_IDI, 2, }, - .sdo[0] = { 16, PCI1730_DO, 2, }, - .sdo[1] = { 16, PCI1730_IDO, 2, }, - .boardid = { 4, PCI173x_BOARDID, 1, }, + .sdi[0] = { 16, PCI1730_DI, }, + .sdi[1] = { 16, PCI1730_IDI, }, + .sdo[0] = { 16, PCI1730_DO, }, + .sdo[1] = { 16, PCI1730_IDO, }, + .boardid = { 4, PCI173x_BOARDID, }, }, [TYPE_PCI1733] = { .name = "pci1733", .cardtype = TYPE_PCI1733, .nsubdevs = 2, - .sdi[1] = { 32, PCI1733_IDI, 4, }, - .boardid = { 4, PCI173x_BOARDID, 1, }, + .sdi[1] = { 32, PCI1733_IDI, }, + .boardid = { 4, PCI173x_BOARDID, }, }, [TYPE_PCI1734] = { .name = "pci1734", .cardtype = TYPE_PCI1734, .nsubdevs = 2, - .sdo[1] = { 32, PCI1734_IDO, 4, }, - .boardid = { 4, PCI173x_BOARDID, 1, }, + .sdo[1] = { 32, PCI1734_IDO, }, + .boardid = { 4, PCI173x_BOARDID, }, }, [TYPE_PCI1735] = { .name = "pci1735", .cardtype = TYPE_PCI1735, .nsubdevs = 4, - .sdi[0] = { 32, PCI1735_DI, 4, }, - .sdo[0] = { 32, PCI1735_DO, 4, }, - .boardid = { 4, PCI1735_BOARDID, 1, }, + .sdi[0] = { 32, PCI1735_DI, }, + .sdo[0] = { 32, PCI1735_DO, }, + .boardid = { 4, PCI1735_BOARDID, }, .timer_regbase = PCI1735_C8254, }, [TYPE_PCI1736] = { .name = "pci1736", .cardtype = TYPE_PCI1736, .nsubdevs = 3, - .sdi[1] = { 16, PCI1736_IDI, 2, }, - .sdo[1] = { 16, PCI1736_IDO, 2, }, - .boardid = { 4, PCI1736_BOARDID, 1, }, + .sdi[1] = { 16, PCI1736_IDI, }, + .sdo[1] = { 16, PCI1736_IDO, }, + .boardid = { 4, PCI1736_BOARDID, }, }, [TYPE_PCI1739] = { .name = "pci1739", .cardtype = TYPE_PCI1739, .nsubdevs = 2, - .sdio[0] = { 48, PCI1739_DIO, 2, }, + .sdio[0] = { 2, PCI1739_DIO, }, }, [TYPE_PCI1750] = { .name = "pci1750", .cardtype = TYPE_PCI1750, .nsubdevs = 2, - .sdi[1] = { 16, PCI1750_IDI, 2, }, - .sdo[1] = { 16, PCI1750_IDO, 2, }, + .sdi[1] = { 16, PCI1750_IDI, }, + .sdo[1] = { 16, PCI1750_IDO, }, }, [TYPE_PCI1751] = { .name = "pci1751", .cardtype = TYPE_PCI1751, .nsubdevs = 3, - .sdio[0] = { 48, PCI1751_DIO, 2, }, + .sdio[0] = { 2, PCI1751_DIO, }, .timer_regbase = PCI1751_CNT, }, [TYPE_PCI1752] = { .name = "pci1752", .cardtype = TYPE_PCI1752, .nsubdevs = 3, - .sdo[0] = { 32, PCI1752_IDO, 2, }, - .sdo[1] = { 32, PCI1752_IDO2, 2, }, - .boardid = { 4, PCI175x_BOARDID, 1, }, + .sdo[0] = { 32, PCI1752_IDO, }, + .sdo[1] = { 32, PCI1752_IDO2, }, + .boardid = { 4, PCI175x_BOARDID, }, .is_16bit = 1, }, [TYPE_PCI1753] = { .name = "pci1753", .cardtype = TYPE_PCI1753, .nsubdevs = 4, - .sdio[0] = { 96, PCI1753_DIO, 4, }, + .sdio[0] = { 4, PCI1753_DIO, }, }, [TYPE_PCI1753E] = { .name = "pci1753e", .cardtype = TYPE_PCI1753E, .nsubdevs = 8, - .sdio[0] = { 96, PCI1753_DIO, 4, }, - .sdio[1] = { 96, PCI1753E_DIO, 4, }, + .sdio[0] = { 4, PCI1753_DIO, }, + .sdio[1] = { 4, PCI1753E_DIO, }, }, [TYPE_PCI1754] = { .name = "pci1754", .cardtype = TYPE_PCI1754, .nsubdevs = 3, - .sdi[0] = { 32, PCI1754_IDI, 2, }, - .sdi[1] = { 32, PCI1754_IDI2, 2, }, - .boardid = { 4, PCI175x_BOARDID, 1, }, + .sdi[0] = { 32, PCI1754_IDI, }, + .sdi[1] = { 32, PCI1754_IDI2, }, + .boardid = { 4, PCI175x_BOARDID, }, .is_16bit = 1, }, [TYPE_PCI1756] = { .name = "pci1756", .cardtype = TYPE_PCI1756, .nsubdevs = 3, - .sdi[1] = { 32, PCI1756_IDI, 2, }, - .sdo[1] = { 32, PCI1756_IDO, 2, }, - .boardid = { 4, PCI175x_BOARDID, 1, }, + .sdi[1] = { 32, PCI1756_IDI, }, + .sdo[1] = { 32, PCI1756_IDO, }, + .boardid = { 4, PCI175x_BOARDID, }, .is_16bit = 1, }, [TYPE_PCI1762] = { .name = "pci1762", .cardtype = TYPE_PCI1762, .nsubdevs = 3, - .sdi[1] = { 16, PCI1762_IDI, 1, }, - .sdo[1] = { 16, PCI1762_RO, 1, }, - .boardid = { 4, PCI1762_BOARDID, 1, }, + .sdi[1] = { 16, PCI1762_IDI, }, + .sdo[1] = { 16, PCI1762_RO, }, + .boardid = { 4, PCI1762_BOARDID, }, .is_16bit = 1, }, }; static int pci_dio_insn_bits_di_b(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_insn *insn, + unsigned int *data) { const struct diosubd_data *d = (const struct diosubd_data *)s->private; - int i; + unsigned long iobase = dev->iobase + d->addr; - data[1] = 0; - for (i = 0; i < d->regs; i++) - data[1] |= inb(dev->iobase + d->addr + i) << (8 * i); + data[1] = inb(iobase); + if (s->n_chan > 8) + data[1] |= (inb(iobase + 1) << 8); + if (s->n_chan > 16) + data[1] |= (inb(iobase + 2) << 16); + if (s->n_chan > 24) + data[1] |= (inb(iobase + 3) << 24); return insn->n; } static int pci_dio_insn_bits_di_w(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_insn *insn, + unsigned int *data) { const struct diosubd_data *d = (const struct diosubd_data *)s->private; - int i; + unsigned long iobase = dev->iobase + d->addr; - data[1] = 0; - for (i = 0; i < d->regs; i++) - data[1] |= inw(dev->iobase + d->addr + 2 * i) << (16 * i); + data[1] = inw(iobase); + if (s->n_chan > 16) + data[1] |= (inw(iobase + 2) << 16); return insn->n; } @@ -292,12 +296,16 @@ static int pci_dio_insn_bits_do_b(struct comedi_device *dev, unsigned int *data) { const struct diosubd_data *d = (const struct diosubd_data *)s->private; - int i; + unsigned long iobase = dev->iobase + d->addr; if (comedi_dio_update_state(s, data)) { - for (i = 0; i < d->regs; i++) - outb((s->state >> (8 * i)) & 0xff, - dev->iobase + d->addr + i); + outb(s->state & 0xff, iobase); + if (s->n_chan > 8) + outb((s->state >> 8) & 0xff, iobase + 1); + if (s->n_chan > 16) + outb((s->state >> 16) & 0xff, iobase + 2); + if (s->n_chan > 24) + outb((s->state >> 24) & 0xff, iobase + 3); } data[1] = s->state; @@ -311,12 +319,12 @@ static int pci_dio_insn_bits_do_w(struct comedi_device *dev, unsigned int *data) { const struct diosubd_data *d = (const struct diosubd_data *)s->private; - int i; + unsigned long iobase = dev->iobase + d->addr; if (comedi_dio_update_state(s, data)) { - for (i = 0; i < d->regs; i++) - outw((s->state >> (16 * i)) & 0xffff, - dev->iobase + d->addr + 2 * i); + outw(s->state & 0xffff, iobase); + if (s->n_chan > 16) + outw((s->state >> 16) & 0xffff, iobase + 2); } data[1] = s->state; @@ -519,7 +527,7 @@ static int pci_dio_auto_attach(struct comedi_device *dev, for (i = 0; i < MAX_DIO_SUBDEVG; i++) { d = &board->sdio[i]; - for (j = 0; j < d->regs; j++) { + for (j = 0; j < d->chans; j++) { s = &dev->subdevices[subdev++]; ret = subdev_8255_init(dev, s, NULL, d->addr + j * I8255_SIZE); From 66f516e6a31e24972b1768453c2bd1abac273ff1 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:11 -0700 Subject: [PATCH 795/843] staging: comedi: adv_pci_dio: use the diosubd_data 'addr' for di/do s->private Currently the di/do subdevices store a pointer to the diosubd_data in s->private. The (*insn_bits) functions then use that to get to the 'addr' needed to access the registers. The only member of diosubd_data that is needed by the (*insn_bits) functions is the 'addr'. For aesthetics, just store the 'addr' in s->private. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index e620e34c70bc..51611c72f742 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -128,7 +128,7 @@ enum hw_cards_id { struct diosubd_data { int chans; /* num of chans or 8255 devices */ - int addr; /* PCI address ofset */ + unsigned long addr; /* PCI address ofset */ }; struct dio_boardtype { @@ -261,8 +261,8 @@ static int pci_dio_insn_bits_di_b(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - const struct diosubd_data *d = (const struct diosubd_data *)s->private; - unsigned long iobase = dev->iobase + d->addr; + unsigned long reg = (unsigned long)s->private; + unsigned long iobase = dev->iobase + reg; data[1] = inb(iobase); if (s->n_chan > 8) @@ -280,8 +280,8 @@ static int pci_dio_insn_bits_di_w(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - const struct diosubd_data *d = (const struct diosubd_data *)s->private; - unsigned long iobase = dev->iobase + d->addr; + unsigned long reg = (unsigned long)s->private; + unsigned long iobase = dev->iobase + reg; data[1] = inw(iobase); if (s->n_chan > 16) @@ -295,8 +295,8 @@ static int pci_dio_insn_bits_do_b(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - const struct diosubd_data *d = (const struct diosubd_data *)s->private; - unsigned long iobase = dev->iobase + d->addr; + unsigned long reg = (unsigned long)s->private; + unsigned long iobase = dev->iobase + reg; if (comedi_dio_update_state(s, data)) { outb(s->state & 0xff, iobase); @@ -318,8 +318,8 @@ static int pci_dio_insn_bits_do_w(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - const struct diosubd_data *d = (const struct diosubd_data *)s->private; - unsigned long iobase = dev->iobase + d->addr; + unsigned long reg = (unsigned long)s->private; + unsigned long iobase = dev->iobase + reg; if (comedi_dio_update_state(s, data)) { outw(s->state & 0xffff, iobase); @@ -505,7 +505,7 @@ static int pci_dio_auto_attach(struct comedi_device *dev, s->insn_bits = board->is_16bit ? pci_dio_insn_bits_di_w : pci_dio_insn_bits_di_b; - s->private = (void *)d; + s->private = (void *)d->addr; } } @@ -521,7 +521,7 @@ static int pci_dio_auto_attach(struct comedi_device *dev, s->insn_bits = board->is_16bit ? pci_dio_insn_bits_do_w : pci_dio_insn_bits_do_b; - s->private = (void *)d; + s->private = (void *)d->addr; } } @@ -546,7 +546,7 @@ static int pci_dio_auto_attach(struct comedi_device *dev, s->range_table = &range_digital; s->insn_bits = board->is_16bit ? pci_dio_insn_bits_di_w : pci_dio_insn_bits_di_b; - s->private = (void *)d; + s->private = (void *)d->addr; } if (board->timer_regbase) { From 2001807e25d9a645cfaa28e893a0a5968f6b38a0 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:12 -0700 Subject: [PATCH 796/843] staging: comedi: adv_pci_dio: simplify the 'boardid' boardinfo The "board id" register is always 4-bits (4 di channels) and the register used to read the bits is always > 0. Simplify the 'boardid' boardinfo by replacing it with a 'id_reg' member and open-coding the subdevice n_chan. For aesthetics, remove all the *_BOARDID defines and just open-code the register values in the boardinfo. Add the missing boardinfo for the pci1739 board id register and increase the nsubdevs to handle it. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 36 ++++++++------------ 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 51611c72f742..d24134f1d4a2 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -60,13 +60,11 @@ enum hw_cards_id { * interrupts */ #define PCI1730_3_INT_CLR 0x10 /* R/W: clear interrupts */ #define PCI1734_IDO 0 /* W: Isolated digital output 0-31 */ -#define PCI173x_BOARDID 4 /* R: Board I/D switch for 1730/3/4 */ /* Advantech PCI-1735U */ #define PCI1735_DI 0 /* R: Digital input 0-31 */ #define PCI1735_DO 0 /* W: Digital output 0-31 */ #define PCI1735_C8254 4 /* R/W: 8254 counter */ -#define PCI1735_BOARDID 8 /* R: Board I/D switch for 1735U */ /* Advantech PCI-1736UP */ #define PCI1736_IDI 0 /* R: Isolated digital input 0-15 */ @@ -75,13 +73,11 @@ enum hw_cards_id { #define PCI1736_3_INT_RF 0x0c /* R/W: set falling/raising edge for * interrupts */ #define PCI1736_3_INT_CLR 0x10 /* R/W: clear interrupts */ -#define PCI1736_BOARDID 4 /* R: Board I/D switch for 1736UP */ /* Advantech PCI-1739U */ #define PCI1739_DIO 0 /* R/W: begin of 8255 registers block */ #define PCI1739_ICR 32 /* W: Interrupt control register */ #define PCI1739_ISR 32 /* R: Interrupt status register */ -#define PCI1739_BOARDID 8 /* R: Board I/D switch for 1739U */ /* Advantech PCI-1750 */ #define PCI1750_IDI 0 /* R: Isolated digital input 0-15 */ @@ -117,12 +113,10 @@ enum hw_cards_id { #define PCI1754_ICR2 0x0c /* R/W: Interrupt control register group 2 */ #define PCI1754_ICR3 0x0e /* R/W: Interrupt control register group 3 */ #define PCI1752_6_CFC 0x12 /* R/W: set/read channel freeze function */ -#define PCI175x_BOARDID 0x10 /* R: Board I/D switch for 1752/4/6 */ /* Advantech PCI-1762 registers */ #define PCI1762_RO 0 /* R/W: Relays status/output */ #define PCI1762_IDI 2 /* R: Isolated input status */ -#define PCI1762_BOARDID 4 /* R: Board I/D switch */ #define PCI1762_ICR 6 /* W: Interrupt control register */ #define PCI1762_ISR 6 /* R: Interrupt status register */ @@ -138,7 +132,7 @@ struct dio_boardtype { struct diosubd_data sdi[MAX_DI_SUBDEVS]; /* DI chans */ struct diosubd_data sdo[MAX_DO_SUBDEVS]; /* DO chans */ struct diosubd_data sdio[MAX_DIO_SUBDEVG]; /* DIO 8255 chans */ - struct diosubd_data boardid; /* card supports board ID switch */ + unsigned long id_reg; unsigned long timer_regbase; unsigned int is_16bit:1; }; @@ -152,21 +146,21 @@ static const struct dio_boardtype boardtypes[] = { .sdi[1] = { 16, PCI1730_IDI, }, .sdo[0] = { 16, PCI1730_DO, }, .sdo[1] = { 16, PCI1730_IDO, }, - .boardid = { 4, PCI173x_BOARDID, }, + .id_reg = 0x04, }, [TYPE_PCI1733] = { .name = "pci1733", .cardtype = TYPE_PCI1733, .nsubdevs = 2, .sdi[1] = { 32, PCI1733_IDI, }, - .boardid = { 4, PCI173x_BOARDID, }, + .id_reg = 0x04, }, [TYPE_PCI1734] = { .name = "pci1734", .cardtype = TYPE_PCI1734, .nsubdevs = 2, .sdo[1] = { 32, PCI1734_IDO, }, - .boardid = { 4, PCI173x_BOARDID, }, + .id_reg = 0x04, }, [TYPE_PCI1735] = { .name = "pci1735", @@ -174,7 +168,7 @@ static const struct dio_boardtype boardtypes[] = { .nsubdevs = 4, .sdi[0] = { 32, PCI1735_DI, }, .sdo[0] = { 32, PCI1735_DO, }, - .boardid = { 4, PCI1735_BOARDID, }, + .id_reg = 0x08, .timer_regbase = PCI1735_C8254, }, [TYPE_PCI1736] = { @@ -183,13 +177,14 @@ static const struct dio_boardtype boardtypes[] = { .nsubdevs = 3, .sdi[1] = { 16, PCI1736_IDI, }, .sdo[1] = { 16, PCI1736_IDO, }, - .boardid = { 4, PCI1736_BOARDID, }, + .id_reg = 0x04, }, [TYPE_PCI1739] = { .name = "pci1739", .cardtype = TYPE_PCI1739, - .nsubdevs = 2, + .nsubdevs = 3, .sdio[0] = { 2, PCI1739_DIO, }, + .id_reg = 0x08, }, [TYPE_PCI1750] = { .name = "pci1750", @@ -211,7 +206,7 @@ static const struct dio_boardtype boardtypes[] = { .nsubdevs = 3, .sdo[0] = { 32, PCI1752_IDO, }, .sdo[1] = { 32, PCI1752_IDO2, }, - .boardid = { 4, PCI175x_BOARDID, }, + .id_reg = 0x10, .is_16bit = 1, }, [TYPE_PCI1753] = { @@ -233,7 +228,7 @@ static const struct dio_boardtype boardtypes[] = { .nsubdevs = 3, .sdi[0] = { 32, PCI1754_IDI, }, .sdi[1] = { 32, PCI1754_IDI2, }, - .boardid = { 4, PCI175x_BOARDID, }, + .id_reg = 0x10, .is_16bit = 1, }, [TYPE_PCI1756] = { @@ -242,7 +237,7 @@ static const struct dio_boardtype boardtypes[] = { .nsubdevs = 3, .sdi[1] = { 32, PCI1756_IDI, }, .sdo[1] = { 32, PCI1756_IDO, }, - .boardid = { 4, PCI175x_BOARDID, }, + .id_reg = 0x10, .is_16bit = 1, }, [TYPE_PCI1762] = { @@ -251,7 +246,7 @@ static const struct dio_boardtype boardtypes[] = { .nsubdevs = 3, .sdi[1] = { 16, PCI1762_IDI, }, .sdo[1] = { 16, PCI1762_RO, }, - .boardid = { 4, PCI1762_BOARDID, }, + .id_reg = 0x04, .is_16bit = 1, }, }; @@ -536,17 +531,16 @@ static int pci_dio_auto_attach(struct comedi_device *dev, } } - d = &board->boardid; - if (d->chans) { + if (board->id_reg) { s = &dev->subdevices[subdev++]; s->type = COMEDI_SUBD_DI; s->subdev_flags = SDF_READABLE | SDF_INTERNAL; - s->n_chan = d->chans; + s->n_chan = 4; s->maxdata = 1; s->range_table = &range_digital; s->insn_bits = board->is_16bit ? pci_dio_insn_bits_di_w : pci_dio_insn_bits_di_b; - s->private = (void *)d->addr; + s->private = (void *)board->id_reg; } if (board->timer_regbase) { From d9d238d898903d1f6f965a11ffb6aeb844eca5d5 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:13 -0700 Subject: [PATCH 797/843] staging: comedi: adv_pci_dio: remove defines used for the 'timer_regbase' These defines are only used to initialize the 'timer_regbase' boardinfo. For aesthetics, just open-code the values and remove the defines. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index d24134f1d4a2..fdb6063b6da4 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -64,7 +64,6 @@ enum hw_cards_id { /* Advantech PCI-1735U */ #define PCI1735_DI 0 /* R: Digital input 0-31 */ #define PCI1735_DO 0 /* W: Digital output 0-31 */ -#define PCI1735_C8254 4 /* R/W: 8254 counter */ /* Advantech PCI-1736UP */ #define PCI1736_IDI 0 /* R: Isolated digital input 0-15 */ @@ -87,7 +86,6 @@ enum hw_cards_id { /* Advantech PCI-1751/3/3E */ #define PCI1751_DIO 0 /* R/W: begin of 8255 registers block */ -#define PCI1751_CNT 24 /* R/W: begin of 8254 registers block */ #define PCI1751_ICR 32 /* W: Interrupt control register */ #define PCI1751_ISR 32 /* R: Interrupt status register */ #define PCI1753_DIO 0 /* R/W: begin of 8255 registers block */ @@ -169,7 +167,7 @@ static const struct dio_boardtype boardtypes[] = { .sdi[0] = { 32, PCI1735_DI, }, .sdo[0] = { 32, PCI1735_DO, }, .id_reg = 0x08, - .timer_regbase = PCI1735_C8254, + .timer_regbase = 0x04, }, [TYPE_PCI1736] = { .name = "pci1736", @@ -198,7 +196,7 @@ static const struct dio_boardtype boardtypes[] = { .cardtype = TYPE_PCI1751, .nsubdevs = 3, .sdio[0] = { 2, PCI1751_DIO, }, - .timer_regbase = PCI1751_CNT, + .timer_regbase = 0x18, }, [TYPE_PCI1752] = { .name = "pci1752", From e01b70bc13cecc917ae8a0dd23c5ddac38d0813b Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:14 -0700 Subject: [PATCH 798/843] staging: comedi: adv_pci_dio: remove defines used for the di registers These defines are only used to initialize the diosubd_data 'addr' members in the boardinfo. For aesthetics, just open-code the values and remove the defines. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 30 +++++++------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index fdb6063b6da4..3c4335ec31d6 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -50,11 +50,8 @@ enum hw_cards_id { /* Register offset definitions */ /* Advantech PCI-1730/3/4 */ -#define PCI1730_IDI 0 /* R: Isolated digital input 0-15 */ #define PCI1730_IDO 0 /* W: Isolated digital output 0-15 */ -#define PCI1730_DI 2 /* R: Digital input 0-15 */ #define PCI1730_DO 2 /* W: Digital output 0-15 */ -#define PCI1733_IDI 0 /* R: Isolated digital input 0-31 */ #define PCI1730_3_INT_EN 0x08 /* R/W: enable/disable interrupts */ #define PCI1730_3_INT_RF 0x0c /* R/W: set falling/raising edge for * interrupts */ @@ -62,11 +59,9 @@ enum hw_cards_id { #define PCI1734_IDO 0 /* W: Isolated digital output 0-31 */ /* Advantech PCI-1735U */ -#define PCI1735_DI 0 /* R: Digital input 0-31 */ #define PCI1735_DO 0 /* W: Digital output 0-31 */ /* Advantech PCI-1736UP */ -#define PCI1736_IDI 0 /* R: Isolated digital input 0-15 */ #define PCI1736_IDO 0 /* W: Isolated digital output 0-15 */ #define PCI1736_3_INT_EN 0x08 /* R/W: enable/disable interrupts */ #define PCI1736_3_INT_RF 0x0c /* R/W: set falling/raising edge for @@ -79,7 +74,6 @@ enum hw_cards_id { #define PCI1739_ISR 32 /* R: Interrupt status register */ /* Advantech PCI-1750 */ -#define PCI1750_IDI 0 /* R: Isolated digital input 0-15 */ #define PCI1750_IDO 0 /* W: Isolated digital output 0-15 */ #define PCI1750_ICR 32 /* W: Interrupt control register */ #define PCI1750_ISR 32 /* R: Interrupt status register */ @@ -102,9 +96,6 @@ enum hw_cards_id { /* Advantech PCI-1752/4/6 */ #define PCI1752_IDO 0 /* R/W: Digital output 0-31 */ #define PCI1752_IDO2 4 /* R/W: Digital output 32-63 */ -#define PCI1754_IDI 0 /* R: Digital input 0-31 */ -#define PCI1754_IDI2 4 /* R: Digital input 32-64 */ -#define PCI1756_IDI 0 /* R: Digital input 0-31 */ #define PCI1756_IDO 4 /* R/W: Digital output 0-31 */ #define PCI1754_6_ICR0 0x08 /* R/W: Interrupt control register group 0 */ #define PCI1754_6_ICR1 0x0a /* R/W: Interrupt control register group 1 */ @@ -114,7 +105,6 @@ enum hw_cards_id { /* Advantech PCI-1762 registers */ #define PCI1762_RO 0 /* R/W: Relays status/output */ -#define PCI1762_IDI 2 /* R: Isolated input status */ #define PCI1762_ICR 6 /* W: Interrupt control register */ #define PCI1762_ISR 6 /* R: Interrupt status register */ @@ -140,8 +130,8 @@ static const struct dio_boardtype boardtypes[] = { .name = "pci1730", .cardtype = TYPE_PCI1730, .nsubdevs = 5, - .sdi[0] = { 16, PCI1730_DI, }, - .sdi[1] = { 16, PCI1730_IDI, }, + .sdi[0] = { 16, 0x02, }, /* DI 0-15 */ + .sdi[1] = { 16, 0x00, }, /* ISO DI 0-15 */ .sdo[0] = { 16, PCI1730_DO, }, .sdo[1] = { 16, PCI1730_IDO, }, .id_reg = 0x04, @@ -150,7 +140,7 @@ static const struct dio_boardtype boardtypes[] = { .name = "pci1733", .cardtype = TYPE_PCI1733, .nsubdevs = 2, - .sdi[1] = { 32, PCI1733_IDI, }, + .sdi[1] = { 32, 0x00, }, /* ISO DI 0-31 */ .id_reg = 0x04, }, [TYPE_PCI1734] = { @@ -164,7 +154,7 @@ static const struct dio_boardtype boardtypes[] = { .name = "pci1735", .cardtype = TYPE_PCI1735, .nsubdevs = 4, - .sdi[0] = { 32, PCI1735_DI, }, + .sdi[0] = { 32, 0x00, }, /* DI 0-31 */ .sdo[0] = { 32, PCI1735_DO, }, .id_reg = 0x08, .timer_regbase = 0x04, @@ -173,7 +163,7 @@ static const struct dio_boardtype boardtypes[] = { .name = "pci1736", .cardtype = TYPE_PCI1736, .nsubdevs = 3, - .sdi[1] = { 16, PCI1736_IDI, }, + .sdi[1] = { 16, 0x00, }, /* ISO DI 0-15 */ .sdo[1] = { 16, PCI1736_IDO, }, .id_reg = 0x04, }, @@ -188,7 +178,7 @@ static const struct dio_boardtype boardtypes[] = { .name = "pci1750", .cardtype = TYPE_PCI1750, .nsubdevs = 2, - .sdi[1] = { 16, PCI1750_IDI, }, + .sdi[1] = { 16, 0x00, }, /* ISO DI 0-15 */ .sdo[1] = { 16, PCI1750_IDO, }, }, [TYPE_PCI1751] = { @@ -224,8 +214,8 @@ static const struct dio_boardtype boardtypes[] = { .name = "pci1754", .cardtype = TYPE_PCI1754, .nsubdevs = 3, - .sdi[0] = { 32, PCI1754_IDI, }, - .sdi[1] = { 32, PCI1754_IDI2, }, + .sdi[0] = { 32, 0x00, }, /* DI 0-31 */ + .sdi[1] = { 32, 0x04, }, /* DI 32-63 */ .id_reg = 0x10, .is_16bit = 1, }, @@ -233,7 +223,7 @@ static const struct dio_boardtype boardtypes[] = { .name = "pci1756", .cardtype = TYPE_PCI1756, .nsubdevs = 3, - .sdi[1] = { 32, PCI1756_IDI, }, + .sdi[1] = { 32, 0x00, }, /* DI 0-31 */ .sdo[1] = { 32, PCI1756_IDO, }, .id_reg = 0x10, .is_16bit = 1, @@ -242,7 +232,7 @@ static const struct dio_boardtype boardtypes[] = { .name = "pci1762", .cardtype = TYPE_PCI1762, .nsubdevs = 3, - .sdi[1] = { 16, PCI1762_IDI, }, + .sdi[1] = { 16, 0x02, }, /* ISO DI 0-15 */ .sdo[1] = { 16, PCI1762_RO, }, .id_reg = 0x04, .is_16bit = 1, From 4190c22008ef241cd9ae791bd9934e16c563fbc4 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:15 -0700 Subject: [PATCH 799/843] staging: comedi: adv_pci_dio: remove board reset during (*detach) The board reset function disables and clears all interrupts. It also resets all the digital output channels to 0. Interrupts are not used by this driver so the disable/clear during the (*detach) is not necessary. Reseting all the digital outputs to 0 might not be desired depending on what the outputs are connected to. Remove the board reset and just use comedi_pci_detach() directly for the driver (*detach). Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 3c4335ec31d6..83591a6c3f93 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -548,18 +548,11 @@ static int pci_dio_auto_attach(struct comedi_device *dev, return 0; } -static void pci_dio_detach(struct comedi_device *dev) -{ - if (dev->iobase) - pci_dio_reset(dev); - comedi_pci_detach(dev); -} - static struct comedi_driver adv_pci_dio_driver = { .driver_name = "adv_pci_dio", .module = THIS_MODULE, .auto_attach = pci_dio_auto_attach, - .detach = pci_dio_detach, + .detach = comedi_pci_detach, }; static int adv_pci_dio_pci_probe(struct pci_dev *dev, From 42100e306c0a33f56a079645148d6ceed17d2c40 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:16 -0700 Subject: [PATCH 800/843] staging: comedi: adv_pci_dio: do board reset early in (*auto_attach) The board reset function disables and clears all interrupts. It also resets all the digital output channels to 0. Interrupts are not currently used by this driver. For asthetics, do the board reset early in the (*auto_attach) to make sure the interrupts are disabled in case this feature is added. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 83591a6c3f93..55ca8f936dcd 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -471,6 +471,8 @@ static int pci_dio_auto_attach(struct comedi_device *dev, else dev->iobase = pci_resource_start(pcidev, 2); + pci_dio_reset(dev); + ret = comedi_alloc_subdevices(dev, board->nsubdevs); if (ret) return ret; @@ -543,8 +545,6 @@ static int pci_dio_auto_attach(struct comedi_device *dev, comedi_8254_subdevice_init(s, dev->pacer); } - pci_dio_reset(dev); - return 0; } From d06ddc1967566c0dcca243cfc9a60457d9644115 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:17 -0700 Subject: [PATCH 801/843] staging: comedi: adv_pci_dio: reset digital outputs in subdevice init Currently the board reset function also resets the digital output channels to 0. This works but it makes the reset function a bit messy and each board type has to be handled special. Move the digital output reset into the subdevice init where it can be handle based on the subdevice setup. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 36 ++++++++------------ 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 55ca8f936dcd..578c64661905 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -321,11 +321,6 @@ static int pci_dio_reset(struct comedi_device *dev) switch (board->cardtype) { case TYPE_PCI1730: - outb(0, dev->iobase + PCI1730_DO); /* clear outputs */ - outb(0, dev->iobase + PCI1730_DO + 1); - outb(0, dev->iobase + PCI1730_IDO); - outb(0, dev->iobase + PCI1730_IDO + 1); - /* fallthrough */ case TYPE_PCI1733: /* disable interrupts */ outb(0, dev->iobase + PCI1730_3_INT_EN); @@ -335,21 +330,11 @@ static int pci_dio_reset(struct comedi_device *dev) outb(0, dev->iobase + PCI1730_3_INT_RF); break; case TYPE_PCI1734: - outb(0, dev->iobase + PCI1734_IDO); /* clear outputs */ - outb(0, dev->iobase + PCI1734_IDO + 1); - outb(0, dev->iobase + PCI1734_IDO + 2); - outb(0, dev->iobase + PCI1734_IDO + 3); break; case TYPE_PCI1735: - outb(0, dev->iobase + PCI1735_DO); /* clear outputs */ - outb(0, dev->iobase + PCI1735_DO + 1); - outb(0, dev->iobase + PCI1735_DO + 2); - outb(0, dev->iobase + PCI1735_DO + 3); break; case TYPE_PCI1736: - outb(0, dev->iobase + PCI1736_IDO); - outb(0, dev->iobase + PCI1736_IDO + 1); /* disable interrupts */ outb(0, dev->iobase + PCI1736_3_INT_EN); /* clear interrupts */ @@ -371,10 +356,6 @@ static int pci_dio_reset(struct comedi_device *dev) case TYPE_PCI1752: outw(0, dev->iobase + PCI1752_6_CFC); /* disable channel freeze * function */ - outw(0, dev->iobase + PCI1752_IDO); /* clear outputs */ - outw(0, dev->iobase + PCI1752_IDO + 2); - outw(0, dev->iobase + PCI1752_IDO2); - outw(0, dev->iobase + PCI1752_IDO2 + 2); break; case TYPE_PCI1753E: outb(0x88, dev->iobase + PCI1753E_ICR0); /* disable & clear @@ -403,8 +384,6 @@ static int pci_dio_reset(struct comedi_device *dev) outw(0x08, dev->iobase + PCI1754_6_ICR0); /* disable and clear * interrupts */ outw(0x08, dev->iobase + PCI1754_6_ICR1); - outw(0, dev->iobase + PCI1756_IDO); /* clear outputs */ - outw(0, dev->iobase + PCI1756_IDO + 2); break; case TYPE_PCI1762: outw(0x0101, dev->iobase + PCI1762_ICR); /* disable & clear @@ -507,6 +486,21 @@ static int pci_dio_auto_attach(struct comedi_device *dev, ? pci_dio_insn_bits_do_w : pci_dio_insn_bits_do_b; s->private = (void *)d->addr; + + /* reset all outputs to 0 */ + if (board->is_16bit) { + outw(0, dev->iobase + d->addr); + if (s->n_chan > 16) + outw(0, dev->iobase + d->addr + 2); + } else { + outb(0, dev->iobase + d->addr); + if (s->n_chan > 8) + outb(0, dev->iobase + d->addr + 1); + if (s->n_chan > 16) + outb(0, dev->iobase + d->addr + 2); + if (s->n_chan > 24) + outb(0, dev->iobase + d->addr + 3); + } } } From 7f442292fac6b8b251eebf311efead4c3c59923e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:18 -0700 Subject: [PATCH 802/843] staging: comedi: adv_pci_dio: remove defines used for the do registers These defines are only used to initialize the diosubd_data 'addr' members in the boardinfo. For aesthetics, just open-code the values and remove the defines. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 32 ++++++-------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 578c64661905..a72b04e82ebe 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -50,19 +50,12 @@ enum hw_cards_id { /* Register offset definitions */ /* Advantech PCI-1730/3/4 */ -#define PCI1730_IDO 0 /* W: Isolated digital output 0-15 */ -#define PCI1730_DO 2 /* W: Digital output 0-15 */ #define PCI1730_3_INT_EN 0x08 /* R/W: enable/disable interrupts */ #define PCI1730_3_INT_RF 0x0c /* R/W: set falling/raising edge for * interrupts */ #define PCI1730_3_INT_CLR 0x10 /* R/W: clear interrupts */ -#define PCI1734_IDO 0 /* W: Isolated digital output 0-31 */ - -/* Advantech PCI-1735U */ -#define PCI1735_DO 0 /* W: Digital output 0-31 */ /* Advantech PCI-1736UP */ -#define PCI1736_IDO 0 /* W: Isolated digital output 0-15 */ #define PCI1736_3_INT_EN 0x08 /* R/W: enable/disable interrupts */ #define PCI1736_3_INT_RF 0x0c /* R/W: set falling/raising edge for * interrupts */ @@ -74,7 +67,6 @@ enum hw_cards_id { #define PCI1739_ISR 32 /* R: Interrupt status register */ /* Advantech PCI-1750 */ -#define PCI1750_IDO 0 /* W: Isolated digital output 0-15 */ #define PCI1750_ICR 32 /* W: Interrupt control register */ #define PCI1750_ISR 32 /* R: Interrupt status register */ @@ -94,9 +86,6 @@ enum hw_cards_id { #define PCI1753E_ICR3 51 /* R/W: Interrupt control register group 3 */ /* Advantech PCI-1752/4/6 */ -#define PCI1752_IDO 0 /* R/W: Digital output 0-31 */ -#define PCI1752_IDO2 4 /* R/W: Digital output 32-63 */ -#define PCI1756_IDO 4 /* R/W: Digital output 0-31 */ #define PCI1754_6_ICR0 0x08 /* R/W: Interrupt control register group 0 */ #define PCI1754_6_ICR1 0x0a /* R/W: Interrupt control register group 1 */ #define PCI1754_ICR2 0x0c /* R/W: Interrupt control register group 2 */ @@ -104,7 +93,6 @@ enum hw_cards_id { #define PCI1752_6_CFC 0x12 /* R/W: set/read channel freeze function */ /* Advantech PCI-1762 registers */ -#define PCI1762_RO 0 /* R/W: Relays status/output */ #define PCI1762_ICR 6 /* W: Interrupt control register */ #define PCI1762_ISR 6 /* R: Interrupt status register */ @@ -132,8 +120,8 @@ static const struct dio_boardtype boardtypes[] = { .nsubdevs = 5, .sdi[0] = { 16, 0x02, }, /* DI 0-15 */ .sdi[1] = { 16, 0x00, }, /* ISO DI 0-15 */ - .sdo[0] = { 16, PCI1730_DO, }, - .sdo[1] = { 16, PCI1730_IDO, }, + .sdo[0] = { 16, 0x02, }, /* DO 0-15 */ + .sdo[1] = { 16, 0x00, }, /* ISO DO 0-15 */ .id_reg = 0x04, }, [TYPE_PCI1733] = { @@ -147,7 +135,7 @@ static const struct dio_boardtype boardtypes[] = { .name = "pci1734", .cardtype = TYPE_PCI1734, .nsubdevs = 2, - .sdo[1] = { 32, PCI1734_IDO, }, + .sdo[1] = { 32, 0x00, }, /* ISO DO 0-31 */ .id_reg = 0x04, }, [TYPE_PCI1735] = { @@ -155,7 +143,7 @@ static const struct dio_boardtype boardtypes[] = { .cardtype = TYPE_PCI1735, .nsubdevs = 4, .sdi[0] = { 32, 0x00, }, /* DI 0-31 */ - .sdo[0] = { 32, PCI1735_DO, }, + .sdo[0] = { 32, 0x00, }, /* DO 0-31 */ .id_reg = 0x08, .timer_regbase = 0x04, }, @@ -164,7 +152,7 @@ static const struct dio_boardtype boardtypes[] = { .cardtype = TYPE_PCI1736, .nsubdevs = 3, .sdi[1] = { 16, 0x00, }, /* ISO DI 0-15 */ - .sdo[1] = { 16, PCI1736_IDO, }, + .sdo[1] = { 16, 0x00, }, /* ISO DO 0-15 */ .id_reg = 0x04, }, [TYPE_PCI1739] = { @@ -179,7 +167,7 @@ static const struct dio_boardtype boardtypes[] = { .cardtype = TYPE_PCI1750, .nsubdevs = 2, .sdi[1] = { 16, 0x00, }, /* ISO DI 0-15 */ - .sdo[1] = { 16, PCI1750_IDO, }, + .sdo[1] = { 16, 0x00, }, /* ISO DO 0-15 */ }, [TYPE_PCI1751] = { .name = "pci1751", @@ -192,8 +180,8 @@ static const struct dio_boardtype boardtypes[] = { .name = "pci1752", .cardtype = TYPE_PCI1752, .nsubdevs = 3, - .sdo[0] = { 32, PCI1752_IDO, }, - .sdo[1] = { 32, PCI1752_IDO2, }, + .sdo[0] = { 32, 0x00, }, /* DO 0-31 */ + .sdo[1] = { 32, 0x04, }, /* DO 32-63 */ .id_reg = 0x10, .is_16bit = 1, }, @@ -224,7 +212,7 @@ static const struct dio_boardtype boardtypes[] = { .cardtype = TYPE_PCI1756, .nsubdevs = 3, .sdi[1] = { 32, 0x00, }, /* DI 0-31 */ - .sdo[1] = { 32, PCI1756_IDO, }, + .sdo[1] = { 32, 0x04, }, /* DO 0-31 */ .id_reg = 0x10, .is_16bit = 1, }, @@ -233,7 +221,7 @@ static const struct dio_boardtype boardtypes[] = { .cardtype = TYPE_PCI1762, .nsubdevs = 3, .sdi[1] = { 16, 0x02, }, /* ISO DI 0-15 */ - .sdo[1] = { 16, PCI1762_RO, }, + .sdo[1] = { 16, 0x00, }, /* ISO DO 0-15 */ .id_reg = 0x04, .is_16bit = 1, }, From 4cabeb10be65f2ee95e281ad3bc01291e4653213 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:19 -0700 Subject: [PATCH 803/843] staging: comedi: adv_pci_dio: remove defines used for the dio (8255) registers These defines are only used to initialize the diosubd_data 'addr' members in the boardinfo. For aesthetics, just open-code the values and remove the defines. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index a72b04e82ebe..c564b69acd3f 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -62,7 +62,6 @@ enum hw_cards_id { #define PCI1736_3_INT_CLR 0x10 /* R/W: clear interrupts */ /* Advantech PCI-1739U */ -#define PCI1739_DIO 0 /* R/W: begin of 8255 registers block */ #define PCI1739_ICR 32 /* W: Interrupt control register */ #define PCI1739_ISR 32 /* R: Interrupt status register */ @@ -71,15 +70,12 @@ enum hw_cards_id { #define PCI1750_ISR 32 /* R: Interrupt status register */ /* Advantech PCI-1751/3/3E */ -#define PCI1751_DIO 0 /* R/W: begin of 8255 registers block */ #define PCI1751_ICR 32 /* W: Interrupt control register */ #define PCI1751_ISR 32 /* R: Interrupt status register */ -#define PCI1753_DIO 0 /* R/W: begin of 8255 registers block */ #define PCI1753_ICR0 16 /* R/W: Interrupt control register group 0 */ #define PCI1753_ICR1 17 /* R/W: Interrupt control register group 1 */ #define PCI1753_ICR2 18 /* R/W: Interrupt control register group 2 */ #define PCI1753_ICR3 19 /* R/W: Interrupt control register group 3 */ -#define PCI1753E_DIO 32 /* R/W: begin of 8255 registers block */ #define PCI1753E_ICR0 48 /* R/W: Interrupt control register group 0 */ #define PCI1753E_ICR1 49 /* R/W: Interrupt control register group 1 */ #define PCI1753E_ICR2 50 /* R/W: Interrupt control register group 2 */ @@ -159,7 +155,7 @@ static const struct dio_boardtype boardtypes[] = { .name = "pci1739", .cardtype = TYPE_PCI1739, .nsubdevs = 3, - .sdio[0] = { 2, PCI1739_DIO, }, + .sdio[0] = { 2, 0x00, }, /* 8255 DIO */ .id_reg = 0x08, }, [TYPE_PCI1750] = { @@ -173,7 +169,7 @@ static const struct dio_boardtype boardtypes[] = { .name = "pci1751", .cardtype = TYPE_PCI1751, .nsubdevs = 3, - .sdio[0] = { 2, PCI1751_DIO, }, + .sdio[0] = { 2, 0x00, }, /* 8255 DIO */ .timer_regbase = 0x18, }, [TYPE_PCI1752] = { @@ -189,14 +185,14 @@ static const struct dio_boardtype boardtypes[] = { .name = "pci1753", .cardtype = TYPE_PCI1753, .nsubdevs = 4, - .sdio[0] = { 4, PCI1753_DIO, }, + .sdio[0] = { 4, 0x00, }, /* 8255 DIO */ }, [TYPE_PCI1753E] = { .name = "pci1753e", .cardtype = TYPE_PCI1753E, .nsubdevs = 8, - .sdio[0] = { 4, PCI1753_DIO, }, - .sdio[1] = { 4, PCI1753E_DIO, }, + .sdio[0] = { 4, 0x00, }, /* 8255 DIO */ + .sdio[1] = { 4, 0x20, }, /* 8255 DIO */ }, [TYPE_PCI1754] = { .name = "pci1754", From eaf1e647efd70fc4579e77313a96371e317fae38 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:20 -0700 Subject: [PATCH 804/843] staging: comedi: adv_pci_dio: use a default case in pci_dio_reset() For aesthetics, use a default case in the switch (board->cardtype) used to reset the various boards. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index c564b69acd3f..231fa73c0e87 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -313,11 +313,6 @@ static int pci_dio_reset(struct comedi_device *dev) /* set rising edge trigger */ outb(0, dev->iobase + PCI1730_3_INT_RF); break; - case TYPE_PCI1734: - break; - case TYPE_PCI1735: - break; - case TYPE_PCI1736: /* disable interrupts */ outb(0, dev->iobase + PCI1736_3_INT_EN); @@ -326,12 +321,10 @@ static int pci_dio_reset(struct comedi_device *dev) /* set rising edge trigger */ outb(0, dev->iobase + PCI1736_3_INT_RF); break; - case TYPE_PCI1739: /* disable & clear interrupts */ outb(0x88, dev->iobase + PCI1739_ICR); break; - case TYPE_PCI1750: case TYPE_PCI1751: /* disable & clear interrupts */ @@ -373,6 +366,8 @@ static int pci_dio_reset(struct comedi_device *dev) outw(0x0101, dev->iobase + PCI1762_ICR); /* disable & clear * interrupts */ break; + default: + break; } return 0; From c94a5991bf86cc0fddc854daceff96342d299c60 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:21 -0700 Subject: [PATCH 805/843] staging: comedi: adv_pci_dio: disable channel freeze outside of switch For aesthetics, move the disable of the channel freeze for the PCI-1752 and PCI-1756 boards out of the switch used to disable and clear interrupts. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 231fa73c0e87..80c34aa89268 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -303,6 +303,10 @@ static int pci_dio_reset(struct comedi_device *dev) { const struct dio_boardtype *board = dev->board_ptr; + /* disable channel freeze function on the PCI-1752/1756 boards */ + if (board->cardtype == TYPE_PCI1752 || board->cardtype == TYPE_PCI1756) + outw(0, dev->iobase + PCI1752_6_CFC); + switch (board->cardtype) { case TYPE_PCI1730: case TYPE_PCI1733: @@ -330,10 +334,6 @@ static int pci_dio_reset(struct comedi_device *dev) /* disable & clear interrupts */ outb(0x88, dev->iobase + PCI1750_ICR); break; - case TYPE_PCI1752: - outw(0, dev->iobase + PCI1752_6_CFC); /* disable channel freeze - * function */ - break; case TYPE_PCI1753E: outb(0x88, dev->iobase + PCI1753E_ICR0); /* disable & clear * interrupts */ @@ -356,8 +356,6 @@ static int pci_dio_reset(struct comedi_device *dev) outw(0x08, dev->iobase + PCI1754_ICR3); break; case TYPE_PCI1756: - outw(0, dev->iobase + PCI1752_6_CFC); /* disable channel freeze - * function */ outw(0x08, dev->iobase + PCI1754_6_ICR0); /* disable and clear * interrupts */ outw(0x08, dev->iobase + PCI1754_6_ICR1); From ac67a3b9ba6c87bbea813e90f3f290ed7b304d85 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:22 -0700 Subject: [PATCH 806/843] staging: comedi: adv_pci_dio: cleanup "disable and clear interrupts" comments For aesthetics, use a common comment for the switch() that disables and clears interrupts. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 24 +++++--------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 80c34aa89268..8fb03e258b31 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -307,62 +307,50 @@ static int pci_dio_reset(struct comedi_device *dev) if (board->cardtype == TYPE_PCI1752 || board->cardtype == TYPE_PCI1756) outw(0, dev->iobase + PCI1752_6_CFC); + /* disable and clear interrupts */ switch (board->cardtype) { case TYPE_PCI1730: case TYPE_PCI1733: - /* disable interrupts */ outb(0, dev->iobase + PCI1730_3_INT_EN); - /* clear interrupts */ outb(0x0f, dev->iobase + PCI1730_3_INT_CLR); - /* set rising edge trigger */ outb(0, dev->iobase + PCI1730_3_INT_RF); break; case TYPE_PCI1736: - /* disable interrupts */ outb(0, dev->iobase + PCI1736_3_INT_EN); - /* clear interrupts */ outb(0x0f, dev->iobase + PCI1736_3_INT_CLR); - /* set rising edge trigger */ outb(0, dev->iobase + PCI1736_3_INT_RF); break; case TYPE_PCI1739: - /* disable & clear interrupts */ outb(0x88, dev->iobase + PCI1739_ICR); break; case TYPE_PCI1750: case TYPE_PCI1751: - /* disable & clear interrupts */ outb(0x88, dev->iobase + PCI1750_ICR); break; case TYPE_PCI1753E: - outb(0x88, dev->iobase + PCI1753E_ICR0); /* disable & clear - * interrupts */ + outb(0x88, dev->iobase + PCI1753E_ICR0); outb(0x80, dev->iobase + PCI1753E_ICR1); outb(0x80, dev->iobase + PCI1753E_ICR2); outb(0x80, dev->iobase + PCI1753E_ICR3); /* fallthrough */ case TYPE_PCI1753: - outb(0x88, dev->iobase + PCI1753_ICR0); /* disable & clear - * interrupts */ + outb(0x88, dev->iobase + PCI1753_ICR0); outb(0x80, dev->iobase + PCI1753_ICR1); outb(0x80, dev->iobase + PCI1753_ICR2); outb(0x80, dev->iobase + PCI1753_ICR3); break; case TYPE_PCI1754: - outw(0x08, dev->iobase + PCI1754_6_ICR0); /* disable and clear - * interrupts */ + outw(0x08, dev->iobase + PCI1754_6_ICR0); outw(0x08, dev->iobase + PCI1754_6_ICR1); outw(0x08, dev->iobase + PCI1754_ICR2); outw(0x08, dev->iobase + PCI1754_ICR3); break; case TYPE_PCI1756: - outw(0x08, dev->iobase + PCI1754_6_ICR0); /* disable and clear - * interrupts */ + outw(0x08, dev->iobase + PCI1754_6_ICR0); outw(0x08, dev->iobase + PCI1754_6_ICR1); break; case TYPE_PCI1762: - outw(0x0101, dev->iobase + PCI1762_ICR); /* disable & clear - * interrupts */ + outw(0x0101, dev->iobase + PCI1762_ICR); break; default: break; From 86065e4d60a4a961600822654a4e6e2f232eff97 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:23 -0700 Subject: [PATCH 807/843] staging: comedi: adv_pci_dio: use common defines for PCI-173[036] registers These boards use the same offsets for the interrupt control registers. For aesthetics, remove the current defines and use common ones. Fix the switch() in pci_dio_reset() to use common code. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 28 +++++++------------- 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 8fb03e258b31..fae0a0b29c03 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -48,18 +48,14 @@ enum hw_cards_id { #define MAX_DIO_SUBDEVG 2 /* max number of DIO subdevices group per * card */ -/* Register offset definitions */ -/* Advantech PCI-1730/3/4 */ -#define PCI1730_3_INT_EN 0x08 /* R/W: enable/disable interrupts */ -#define PCI1730_3_INT_RF 0x0c /* R/W: set falling/raising edge for - * interrupts */ -#define PCI1730_3_INT_CLR 0x10 /* R/W: clear interrupts */ +/* + * Register offset definitions + */ -/* Advantech PCI-1736UP */ -#define PCI1736_3_INT_EN 0x08 /* R/W: enable/disable interrupts */ -#define PCI1736_3_INT_RF 0x0c /* R/W: set falling/raising edge for - * interrupts */ -#define PCI1736_3_INT_CLR 0x10 /* R/W: clear interrupts */ +/* PCI-1730, PCI-1733, PCI-1736 interrupt control registers */ +#define PCI173X_INT_EN_REG 0x08 /* R/W: enable/disable */ +#define PCI173X_INT_RF_REG 0x0c /* R/W: falling/rising edge */ +#define PCI173X_INT_CLR_REG 0x10 /* R/W: clear */ /* Advantech PCI-1739U */ #define PCI1739_ICR 32 /* W: Interrupt control register */ @@ -311,14 +307,10 @@ static int pci_dio_reset(struct comedi_device *dev) switch (board->cardtype) { case TYPE_PCI1730: case TYPE_PCI1733: - outb(0, dev->iobase + PCI1730_3_INT_EN); - outb(0x0f, dev->iobase + PCI1730_3_INT_CLR); - outb(0, dev->iobase + PCI1730_3_INT_RF); - break; case TYPE_PCI1736: - outb(0, dev->iobase + PCI1736_3_INT_EN); - outb(0x0f, dev->iobase + PCI1736_3_INT_CLR); - outb(0, dev->iobase + PCI1736_3_INT_RF); + outb(0, dev->iobase + PCI173X_INT_EN_REG); + outb(0x0f, dev->iobase + PCI173X_INT_CLR_REG); + outb(0, dev->iobase + PCI173X_INT_RF_REG); break; case TYPE_PCI1739: outb(0x88, dev->iobase + PCI1739_ICR); From db2c830d467db6e10e30729f16401ecd4b6480aa Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:24 -0700 Subject: [PATCH 808/843] staging: comedi: adv_pci_dio: use common defines for PCI-1739/175[01] registers These boards use the same offsets for the interrupt control registers. For aesthetics, remove the current defines and use common ones. Fix the switch() in pci_dio_reset() to use common code. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index fae0a0b29c03..c216f39af595 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -57,17 +57,10 @@ enum hw_cards_id { #define PCI173X_INT_RF_REG 0x0c /* R/W: falling/rising edge */ #define PCI173X_INT_CLR_REG 0x10 /* R/W: clear */ -/* Advantech PCI-1739U */ -#define PCI1739_ICR 32 /* W: Interrupt control register */ -#define PCI1739_ISR 32 /* R: Interrupt status register */ - -/* Advantech PCI-1750 */ -#define PCI1750_ICR 32 /* W: Interrupt control register */ -#define PCI1750_ISR 32 /* R: Interrupt status register */ +/* PCI-1739U, PCI-1750, PCI1751 interrupt control registers */ +#define PCI1750_INT_REG 0x20 /* R/W: status/control */ /* Advantech PCI-1751/3/3E */ -#define PCI1751_ICR 32 /* W: Interrupt control register */ -#define PCI1751_ISR 32 /* R: Interrupt status register */ #define PCI1753_ICR0 16 /* R/W: Interrupt control register group 0 */ #define PCI1753_ICR1 17 /* R/W: Interrupt control register group 1 */ #define PCI1753_ICR2 18 /* R/W: Interrupt control register group 2 */ @@ -313,11 +306,9 @@ static int pci_dio_reset(struct comedi_device *dev) outb(0, dev->iobase + PCI173X_INT_RF_REG); break; case TYPE_PCI1739: - outb(0x88, dev->iobase + PCI1739_ICR); - break; case TYPE_PCI1750: case TYPE_PCI1751: - outb(0x88, dev->iobase + PCI1750_ICR); + outb(0x88, dev->iobase + PCI1750_INT_REG); break; case TYPE_PCI1753E: outb(0x88, dev->iobase + PCI1753E_ICR0); From 774a8c57b14646c74c439097e1e6d06b50c21b85 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:25 -0700 Subject: [PATCH 809/843] staging: comedi: adv_pci_dio: cleanup PCI-1753 interrupt register defines For aesthetics, replace these defines with some macros. Refactor the switch in pci_dio_reset() to not require the fallthrough comment. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 33 +++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index c216f39af595..df60503d5154 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -60,15 +60,9 @@ enum hw_cards_id { /* PCI-1739U, PCI-1750, PCI1751 interrupt control registers */ #define PCI1750_INT_REG 0x20 /* R/W: status/control */ -/* Advantech PCI-1751/3/3E */ -#define PCI1753_ICR0 16 /* R/W: Interrupt control register group 0 */ -#define PCI1753_ICR1 17 /* R/W: Interrupt control register group 1 */ -#define PCI1753_ICR2 18 /* R/W: Interrupt control register group 2 */ -#define PCI1753_ICR3 19 /* R/W: Interrupt control register group 3 */ -#define PCI1753E_ICR0 48 /* R/W: Interrupt control register group 0 */ -#define PCI1753E_ICR1 49 /* R/W: Interrupt control register group 1 */ -#define PCI1753E_ICR2 50 /* R/W: Interrupt control register group 2 */ -#define PCI1753E_ICR3 51 /* R/W: Interrupt control register group 3 */ +/* PCI-1753, PCI-1753E interrupt control registers */ +#define PCI1753_INT_REG(x) (0x10 + (x)) /* R/W: control group 0 to 3 */ +#define PCI1753E_INT_REG(x) (0x30 + (x)) /* R/W: control group 0 to 3 */ /* Advantech PCI-1752/4/6 */ #define PCI1754_6_ICR0 0x08 /* R/W: Interrupt control register group 0 */ @@ -310,17 +304,18 @@ static int pci_dio_reset(struct comedi_device *dev) case TYPE_PCI1751: outb(0x88, dev->iobase + PCI1750_INT_REG); break; - case TYPE_PCI1753E: - outb(0x88, dev->iobase + PCI1753E_ICR0); - outb(0x80, dev->iobase + PCI1753E_ICR1); - outb(0x80, dev->iobase + PCI1753E_ICR2); - outb(0x80, dev->iobase + PCI1753E_ICR3); - /* fallthrough */ case TYPE_PCI1753: - outb(0x88, dev->iobase + PCI1753_ICR0); - outb(0x80, dev->iobase + PCI1753_ICR1); - outb(0x80, dev->iobase + PCI1753_ICR2); - outb(0x80, dev->iobase + PCI1753_ICR3); + case TYPE_PCI1753E: + outb(0x88, dev->iobase + PCI1753_INT_REG(0)); + outb(0x80, dev->iobase + PCI1753_INT_REG(1)); + outb(0x80, dev->iobase + PCI1753_INT_REG(2)); + outb(0x80, dev->iobase + PCI1753_INT_REG(3)); + if (board->cardtype == TYPE_PCI1753E) { + outb(0x88, dev->iobase + PCI1753E_INT_REG(0)); + outb(0x80, dev->iobase + PCI1753E_INT_REG(1)); + outb(0x80, dev->iobase + PCI1753E_INT_REG(2)); + outb(0x80, dev->iobase + PCI1753E_INT_REG(3)); + } break; case TYPE_PCI1754: outw(0x08, dev->iobase + PCI1754_6_ICR0); From 008342ebfda46239ccecb6d4059d511ce5b125c1 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:26 -0700 Subject: [PATCH 810/843] staging: comedi: adv_pci_dio: cleanup PCI-175[46] interrupt registers For aesthetics, replace these defines with a macro. Refactor the switch in pci_dio_reset() to use common code. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 21 +++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index df60503d5154..f7466f43c95c 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -64,11 +64,9 @@ enum hw_cards_id { #define PCI1753_INT_REG(x) (0x10 + (x)) /* R/W: control group 0 to 3 */ #define PCI1753E_INT_REG(x) (0x30 + (x)) /* R/W: control group 0 to 3 */ -/* Advantech PCI-1752/4/6 */ -#define PCI1754_6_ICR0 0x08 /* R/W: Interrupt control register group 0 */ -#define PCI1754_6_ICR1 0x0a /* R/W: Interrupt control register group 1 */ -#define PCI1754_ICR2 0x0c /* R/W: Interrupt control register group 2 */ -#define PCI1754_ICR3 0x0e /* R/W: Interrupt control register group 3 */ +/* PCI-1754, PCI-1756 interrupt control registers */ +#define PCI1754_INT_REG(x) (0x08 + (x) * 2) /* R/W: control group 0 to 3 */ + #define PCI1752_6_CFC 0x12 /* R/W: set/read channel freeze function */ /* Advantech PCI-1762 registers */ @@ -318,14 +316,13 @@ static int pci_dio_reset(struct comedi_device *dev) } break; case TYPE_PCI1754: - outw(0x08, dev->iobase + PCI1754_6_ICR0); - outw(0x08, dev->iobase + PCI1754_6_ICR1); - outw(0x08, dev->iobase + PCI1754_ICR2); - outw(0x08, dev->iobase + PCI1754_ICR3); - break; case TYPE_PCI1756: - outw(0x08, dev->iobase + PCI1754_6_ICR0); - outw(0x08, dev->iobase + PCI1754_6_ICR1); + outw(0x08, dev->iobase + PCI1754_INT_REG(0)); + outw(0x08, dev->iobase + PCI1754_INT_REG(1)); + if (board->cardtype == TYPE_PCI1754) { + outw(0x08, dev->iobase + PCI1754_INT_REG(2)); + outw(0x08, dev->iobase + PCI1754_INT_REG(3)); + } break; case TYPE_PCI1762: outw(0x0101, dev->iobase + PCI1762_ICR); From 6a1c0149a4dd96e2a689f6e279727d04ef2fd81a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:27 -0700 Subject: [PATCH 811/843] staging: comedi: adv_pci_dio: rename PCI1752_6_CFC define For aesthetics, rename this define and fix the alignment. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index f7466f43c95c..5aba40e9b350 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -67,7 +67,8 @@ enum hw_cards_id { /* PCI-1754, PCI-1756 interrupt control registers */ #define PCI1754_INT_REG(x) (0x08 + (x) * 2) /* R/W: control group 0 to 3 */ -#define PCI1752_6_CFC 0x12 /* R/W: set/read channel freeze function */ +/* PCI-1752, PCI-1756 special registers */ +#define PCI1752_CFC_REG 0x12 /* R/W: channel freeze function */ /* Advantech PCI-1762 registers */ #define PCI1762_ICR 6 /* W: Interrupt control register */ @@ -286,7 +287,7 @@ static int pci_dio_reset(struct comedi_device *dev) /* disable channel freeze function on the PCI-1752/1756 boards */ if (board->cardtype == TYPE_PCI1752 || board->cardtype == TYPE_PCI1756) - outw(0, dev->iobase + PCI1752_6_CFC); + outw(0, dev->iobase + PCI1752_CFC_REG); /* disable and clear interrupts */ switch (board->cardtype) { From d0b5860c273ae04ac1b747572aca04354f6515e1 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:28 -0700 Subject: [PATCH 812/843] staging: comedi: adv_pci_dio: cleanup PCI-1762 interrupt registers For aesthetics, use a common define for the interrupt control and status registers. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 5aba40e9b350..6fafc2402d42 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -70,9 +70,8 @@ enum hw_cards_id { /* PCI-1752, PCI-1756 special registers */ #define PCI1752_CFC_REG 0x12 /* R/W: channel freeze function */ -/* Advantech PCI-1762 registers */ -#define PCI1762_ICR 6 /* W: Interrupt control register */ -#define PCI1762_ISR 6 /* R: Interrupt status register */ +/* PCI-1762 interrupt control registers */ +#define PCI1762_INT_REG 0x06 /* R/W: status/control */ struct diosubd_data { int chans; /* num of chans or 8255 devices */ @@ -326,7 +325,7 @@ static int pci_dio_reset(struct comedi_device *dev) } break; case TYPE_PCI1762: - outw(0x0101, dev->iobase + PCI1762_ICR); + outw(0x0101, dev->iobase + PCI1762_INT_REG); break; default: break; From bcae0adaf4f2fd9105ca11ca9df10a5f3881ea26 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:29 -0700 Subject: [PATCH 813/843] staging: comedi: adv_pci_dio: remove boardinfo 'cardtype' This member of the boardinfo is identical to the offset of the boardinfo in the boardtypes array. It's also passed as the 'context' to the driver (*auto_attach). The 'cardtype' is only needed by the (*auto_attach) to determine which PCI BAR to use and in pci_dio_reset() to handle the board specific code. Remove the 'cardtype' member and use the 'context' value instead. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 31 +++++--------------- 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 6fafc2402d42..21df12319107 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -80,7 +80,6 @@ struct diosubd_data { struct dio_boardtype { const char *name; /* board name */ - enum hw_cards_id cardtype; int nsubdevs; struct diosubd_data sdi[MAX_DI_SUBDEVS]; /* DI chans */ struct diosubd_data sdo[MAX_DO_SUBDEVS]; /* DO chans */ @@ -93,7 +92,6 @@ struct dio_boardtype { static const struct dio_boardtype boardtypes[] = { [TYPE_PCI1730] = { .name = "pci1730", - .cardtype = TYPE_PCI1730, .nsubdevs = 5, .sdi[0] = { 16, 0x02, }, /* DI 0-15 */ .sdi[1] = { 16, 0x00, }, /* ISO DI 0-15 */ @@ -103,21 +101,18 @@ static const struct dio_boardtype boardtypes[] = { }, [TYPE_PCI1733] = { .name = "pci1733", - .cardtype = TYPE_PCI1733, .nsubdevs = 2, .sdi[1] = { 32, 0x00, }, /* ISO DI 0-31 */ .id_reg = 0x04, }, [TYPE_PCI1734] = { .name = "pci1734", - .cardtype = TYPE_PCI1734, .nsubdevs = 2, .sdo[1] = { 32, 0x00, }, /* ISO DO 0-31 */ .id_reg = 0x04, }, [TYPE_PCI1735] = { .name = "pci1735", - .cardtype = TYPE_PCI1735, .nsubdevs = 4, .sdi[0] = { 32, 0x00, }, /* DI 0-31 */ .sdo[0] = { 32, 0x00, }, /* DO 0-31 */ @@ -126,7 +121,6 @@ static const struct dio_boardtype boardtypes[] = { }, [TYPE_PCI1736] = { .name = "pci1736", - .cardtype = TYPE_PCI1736, .nsubdevs = 3, .sdi[1] = { 16, 0x00, }, /* ISO DI 0-15 */ .sdo[1] = { 16, 0x00, }, /* ISO DO 0-15 */ @@ -134,28 +128,24 @@ static const struct dio_boardtype boardtypes[] = { }, [TYPE_PCI1739] = { .name = "pci1739", - .cardtype = TYPE_PCI1739, .nsubdevs = 3, .sdio[0] = { 2, 0x00, }, /* 8255 DIO */ .id_reg = 0x08, }, [TYPE_PCI1750] = { .name = "pci1750", - .cardtype = TYPE_PCI1750, .nsubdevs = 2, .sdi[1] = { 16, 0x00, }, /* ISO DI 0-15 */ .sdo[1] = { 16, 0x00, }, /* ISO DO 0-15 */ }, [TYPE_PCI1751] = { .name = "pci1751", - .cardtype = TYPE_PCI1751, .nsubdevs = 3, .sdio[0] = { 2, 0x00, }, /* 8255 DIO */ .timer_regbase = 0x18, }, [TYPE_PCI1752] = { .name = "pci1752", - .cardtype = TYPE_PCI1752, .nsubdevs = 3, .sdo[0] = { 32, 0x00, }, /* DO 0-31 */ .sdo[1] = { 32, 0x04, }, /* DO 32-63 */ @@ -164,20 +154,17 @@ static const struct dio_boardtype boardtypes[] = { }, [TYPE_PCI1753] = { .name = "pci1753", - .cardtype = TYPE_PCI1753, .nsubdevs = 4, .sdio[0] = { 4, 0x00, }, /* 8255 DIO */ }, [TYPE_PCI1753E] = { .name = "pci1753e", - .cardtype = TYPE_PCI1753E, .nsubdevs = 8, .sdio[0] = { 4, 0x00, }, /* 8255 DIO */ .sdio[1] = { 4, 0x20, }, /* 8255 DIO */ }, [TYPE_PCI1754] = { .name = "pci1754", - .cardtype = TYPE_PCI1754, .nsubdevs = 3, .sdi[0] = { 32, 0x00, }, /* DI 0-31 */ .sdi[1] = { 32, 0x04, }, /* DI 32-63 */ @@ -186,7 +173,6 @@ static const struct dio_boardtype boardtypes[] = { }, [TYPE_PCI1756] = { .name = "pci1756", - .cardtype = TYPE_PCI1756, .nsubdevs = 3, .sdi[1] = { 32, 0x00, }, /* DI 0-31 */ .sdo[1] = { 32, 0x04, }, /* DO 0-31 */ @@ -195,7 +181,6 @@ static const struct dio_boardtype boardtypes[] = { }, [TYPE_PCI1762] = { .name = "pci1762", - .cardtype = TYPE_PCI1762, .nsubdevs = 3, .sdi[1] = { 16, 0x02, }, /* ISO DI 0-15 */ .sdo[1] = { 16, 0x00, }, /* ISO DO 0-15 */ @@ -280,16 +265,14 @@ static int pci_dio_insn_bits_do_w(struct comedi_device *dev, return insn->n; } -static int pci_dio_reset(struct comedi_device *dev) +static int pci_dio_reset(struct comedi_device *dev, unsigned long cardtype) { - const struct dio_boardtype *board = dev->board_ptr; - /* disable channel freeze function on the PCI-1752/1756 boards */ - if (board->cardtype == TYPE_PCI1752 || board->cardtype == TYPE_PCI1756) + if (cardtype == TYPE_PCI1752 || cardtype == TYPE_PCI1756) outw(0, dev->iobase + PCI1752_CFC_REG); /* disable and clear interrupts */ - switch (board->cardtype) { + switch (cardtype) { case TYPE_PCI1730: case TYPE_PCI1733: case TYPE_PCI1736: @@ -308,7 +291,7 @@ static int pci_dio_reset(struct comedi_device *dev) outb(0x80, dev->iobase + PCI1753_INT_REG(1)); outb(0x80, dev->iobase + PCI1753_INT_REG(2)); outb(0x80, dev->iobase + PCI1753_INT_REG(3)); - if (board->cardtype == TYPE_PCI1753E) { + if (cardtype == TYPE_PCI1753E) { outb(0x88, dev->iobase + PCI1753E_INT_REG(0)); outb(0x80, dev->iobase + PCI1753E_INT_REG(1)); outb(0x80, dev->iobase + PCI1753E_INT_REG(2)); @@ -319,7 +302,7 @@ static int pci_dio_reset(struct comedi_device *dev) case TYPE_PCI1756: outw(0x08, dev->iobase + PCI1754_INT_REG(0)); outw(0x08, dev->iobase + PCI1754_INT_REG(1)); - if (board->cardtype == TYPE_PCI1754) { + if (cardtype == TYPE_PCI1754) { outw(0x08, dev->iobase + PCI1754_INT_REG(2)); outw(0x08, dev->iobase + PCI1754_INT_REG(3)); } @@ -385,12 +368,12 @@ static int pci_dio_auto_attach(struct comedi_device *dev, ret = comedi_pci_enable(dev); if (ret) return ret; - if (board->cardtype == TYPE_PCI1736) + if (context == TYPE_PCI1736) dev->iobase = pci_resource_start(pcidev, 0); else dev->iobase = pci_resource_start(pcidev, 2); - pci_dio_reset(dev); + pci_dio_reset(dev, context); ret = comedi_alloc_subdevices(dev, board->nsubdevs); if (ret) From 2b60bbde040f1ad542bfc7d94b6b9b4b71140f5f Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:30 -0700 Subject: [PATCH 814/843] staging: comedi: adv_pci_dio: move and rename enum hw_cards_id For aesthetics, move this enum after the register defines and rename it to have namespace associated with the driver. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 29 ++++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 21df12319107..2f89cbec670c 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -31,18 +31,6 @@ #include "8255.h" #include "comedi_8254.h" -/* hardware types of the cards */ -enum hw_cards_id { - TYPE_PCI1730, TYPE_PCI1733, TYPE_PCI1734, TYPE_PCI1735, TYPE_PCI1736, - TYPE_PCI1739, - TYPE_PCI1750, - TYPE_PCI1751, - TYPE_PCI1752, - TYPE_PCI1753, TYPE_PCI1753E, - TYPE_PCI1754, TYPE_PCI1756, - TYPE_PCI1762 -}; - #define MAX_DI_SUBDEVS 2 /* max number of DI subdevices per card */ #define MAX_DO_SUBDEVS 2 /* max number of DO subdevices per card */ #define MAX_DIO_SUBDEVG 2 /* max number of DIO subdevices group per @@ -73,6 +61,23 @@ enum hw_cards_id { /* PCI-1762 interrupt control registers */ #define PCI1762_INT_REG 0x06 /* R/W: status/control */ +enum pci_dio_boardid { + TYPE_PCI1730, + TYPE_PCI1733, + TYPE_PCI1734, + TYPE_PCI1735, + TYPE_PCI1736, + TYPE_PCI1739, + TYPE_PCI1750, + TYPE_PCI1751, + TYPE_PCI1752, + TYPE_PCI1753, + TYPE_PCI1753E, + TYPE_PCI1754, + TYPE_PCI1756, + TYPE_PCI1762 +}; + struct diosubd_data { int chans; /* num of chans or 8255 devices */ unsigned long addr; /* PCI address ofset */ From a54b6e60f32841e482d6d5ad5edb136fd68697ad Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:31 -0700 Subject: [PATCH 815/843] staging: comedi: adv_pci_dio: move and rename the MAX_*_SUBDEV[SG] defines For aesthetics, move these defines after the register defines and rename them to have namespace associated with the driver. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 2f89cbec670c..f3c9628c7d95 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -31,11 +31,6 @@ #include "8255.h" #include "comedi_8254.h" -#define MAX_DI_SUBDEVS 2 /* max number of DI subdevices per card */ -#define MAX_DO_SUBDEVS 2 /* max number of DO subdevices per card */ -#define MAX_DIO_SUBDEVG 2 /* max number of DIO subdevices group per - * card */ - /* * Register offset definitions */ @@ -61,6 +56,11 @@ /* PCI-1762 interrupt control registers */ #define PCI1762_INT_REG 0x06 /* R/W: status/control */ +/* maximum number of subdevice descriptions in the boardinfo */ +#define PCI_DIO_MAX_DI_SUBDEVS 2 /* 2 x 8/16/32 input channels max */ +#define PCI_DIO_MAX_DO_SUBDEVS 2 /* 2 x 8/16/32 output channels max */ +#define PCI_DIO_MAX_DIO_SUBDEVG 2 /* 2 x any number of 8255 devices max */ + enum pci_dio_boardid { TYPE_PCI1730, TYPE_PCI1733, @@ -86,9 +86,9 @@ struct diosubd_data { struct dio_boardtype { const char *name; /* board name */ int nsubdevs; - struct diosubd_data sdi[MAX_DI_SUBDEVS]; /* DI chans */ - struct diosubd_data sdo[MAX_DO_SUBDEVS]; /* DO chans */ - struct diosubd_data sdio[MAX_DIO_SUBDEVG]; /* DIO 8255 chans */ + struct diosubd_data sdi[PCI_DIO_MAX_DI_SUBDEVS]; + struct diosubd_data sdo[PCI_DIO_MAX_DO_SUBDEVS]; + struct diosubd_data sdio[PCI_DIO_MAX_DIO_SUBDEVG]; unsigned long id_reg; unsigned long timer_regbase; unsigned int is_16bit:1; @@ -385,7 +385,7 @@ static int pci_dio_auto_attach(struct comedi_device *dev, return ret; subdev = 0; - for (i = 0; i < MAX_DI_SUBDEVS; i++) { + for (i = 0; i < PCI_DIO_MAX_DI_SUBDEVS; i++) { d = &board->sdi[i]; if (d->chans) { s = &dev->subdevices[subdev++]; @@ -401,7 +401,7 @@ static int pci_dio_auto_attach(struct comedi_device *dev, } } - for (i = 0; i < MAX_DO_SUBDEVS; i++) { + for (i = 0; i < PCI_DIO_MAX_DO_SUBDEVS; i++) { d = &board->sdo[i]; if (d->chans) { s = &dev->subdevices[subdev++]; @@ -432,7 +432,7 @@ static int pci_dio_auto_attach(struct comedi_device *dev, } } - for (i = 0; i < MAX_DIO_SUBDEVG; i++) { + for (i = 0; i < PCI_DIO_MAX_DIO_SUBDEVG; i++) { d = &board->sdio[i]; for (j = 0; j < d->chans; j++) { s = &dev->subdevices[subdev++]; From d97e1552fd71e7ba512c626f5c90afa331c48cec Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:32 -0700 Subject: [PATCH 816/843] staging: comedi: adv_pci_dio: move pci_dio_override_cardtype() This function is called as part of the pci_driver (*probe) before doing the (*auto_attach) of the comedi driver. For aesthetics, move the function to a more logical place in the driver. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 64 ++++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index f3c9628c7d95..b7f13bca2b72 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -322,38 +322,6 @@ static int pci_dio_reset(struct comedi_device *dev, unsigned long cardtype) return 0; } -static unsigned long pci_dio_override_cardtype(struct pci_dev *pcidev, - unsigned long cardtype) -{ - /* - * Change cardtype from TYPE_PCI1753 to TYPE_PCI1753E if expansion - * board available. Need to enable PCI device and request the main - * registers PCI BAR temporarily to perform the test. - */ - if (cardtype != TYPE_PCI1753) - return cardtype; - if (pci_enable_device(pcidev) < 0) - return cardtype; - if (pci_request_region(pcidev, 2, "adv_pci_dio") == 0) { - /* - * This test is based on Advantech's "advdaq" driver source - * (which declares its module licence as "GPL" although the - * driver source does not include a "COPYING" file). - */ - unsigned long reg = pci_resource_start(pcidev, 2) + 53; - - outb(0x05, reg); - if ((inb(reg) & 0x07) == 0x02) { - outb(0x02, reg); - if ((inb(reg) & 0x07) == 0x05) - cardtype = TYPE_PCI1753E; - } - pci_release_region(pcidev, 2); - } - pci_disable_device(pcidev); - return cardtype; -} - static int pci_dio_auto_attach(struct comedi_device *dev, unsigned long context) { @@ -477,6 +445,38 @@ static struct comedi_driver adv_pci_dio_driver = { .detach = comedi_pci_detach, }; +static unsigned long pci_dio_override_cardtype(struct pci_dev *pcidev, + unsigned long cardtype) +{ + /* + * Change cardtype from TYPE_PCI1753 to TYPE_PCI1753E if expansion + * board available. Need to enable PCI device and request the main + * registers PCI BAR temporarily to perform the test. + */ + if (cardtype != TYPE_PCI1753) + return cardtype; + if (pci_enable_device(pcidev) < 0) + return cardtype; + if (pci_request_region(pcidev, 2, "adv_pci_dio") == 0) { + /* + * This test is based on Advantech's "advdaq" driver source + * (which declares its module licence as "GPL" although the + * driver source does not include a "COPYING" file). + */ + unsigned long reg = pci_resource_start(pcidev, 2) + 53; + + outb(0x05, reg); + if ((inb(reg) & 0x07) == 0x02) { + outb(0x02, reg); + if ((inb(reg) & 0x07) == 0x05) + cardtype = TYPE_PCI1753E; + } + pci_release_region(pcidev, 2); + } + pci_disable_device(pcidev); + return cardtype; +} + static int adv_pci_dio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) { From bb263fd5d33f4060fb813f99b3558dff1a11d4c1 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:33 -0700 Subject: [PATCH 817/843] staging: comedi: adv_pci_dio: tidy up the comedi comment block The Description is a bit long winded and the same information is in the Devices. Shorten the Description and tidy up the Devices. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index b7f13bca2b72..f8e9bf903a67 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -8,14 +8,11 @@ /* * Driver: adv_pci_dio - * Description: Advantech PCI-1730, PCI-1733, PCI-1734, PCI-1735U, - * PCI-1736UP, PCI-1739U, PCI-1750, PCI-1751, PCI-1752, - * PCI-1753/E, PCI-1754, PCI-1756, PCI-1762 + * Description: Advantech Digital I/O Cards * Devices: [Advantech] PCI-1730 (adv_pci_dio), PCI-1733, * PCI-1734, PCI-1735U, PCI-1736UP, PCI-1739U, PCI-1750, - * PCI-1751, PCI-1752, PCI-1753, - * PCI-1753+PCI-1753E, PCI-1754, PCI-1756, - * PCI-1762 + * PCI-1751, PCI-1752, PCI-1753, PCI-1753+PCI-1753E, + * PCI-1754, PCI-1756, PCI-1762 * Author: Michal Dobes * Updated: Mon, 09 Jan 2012 12:40:46 +0000 * Status: untested From b4717ff608c180115ace1d307e7f452e114ca29c Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 18 Nov 2015 10:07:34 -0700 Subject: [PATCH 818/843] staging: comedi: adv_pci_dio: update the MODULE_DESCRIPTION Change the MODULE_DESCRIPTION to something more useful than the generic "Comedi low-level driver". Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci_dio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index f8e9bf903a67..620cec13d74c 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -510,5 +510,5 @@ static struct pci_driver adv_pci_dio_pci_driver = { module_comedi_pci_driver(adv_pci_dio_driver, adv_pci_dio_pci_driver); MODULE_AUTHOR("Comedi http://www.comedi.org"); -MODULE_DESCRIPTION("Comedi low-level driver"); +MODULE_DESCRIPTION("Comedi driver for Advantech Digital I/O Cards"); MODULE_LICENSE("GPL"); From 06181de14ff09b274b699ee2dd39fe5e37efb419 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 18 Nov 2015 17:55:04 +0000 Subject: [PATCH 819/843] staging: comedi: rearrange comedi_write() code Rearrange the code in `comedi_write()` to reduce the amount of indentation. The code never reiterates the `while` loop once `count` has become non-zero, so we can check that in the `while` condition to save an indentation level. (Note that `nbytes` has been checked to be non-zero before entering the loop, so we can remove that check.) Move the code that makes the subdevice "become non-busy" outside the `while` loop, using a new flag variable `become_nonbusy` to decide whether it needs to be done. This simplifies the wait queue handling so there is a single place where the task is removed from the wait queue, and we can remove the `on_wait_queue` flag variable. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 71 ++++++++++++---------------- 1 file changed, 30 insertions(+), 41 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 7b4af519e17e..c9da6f39b1c6 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2307,7 +2307,7 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, DECLARE_WAITQUEUE(wait, current); struct comedi_file *cfp = file->private_data; struct comedi_device *dev = cfp->dev; - bool on_wait_queue = false; + bool become_nonbusy = false; bool attach_locked; unsigned int old_detach_count; @@ -2342,48 +2342,16 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, } add_wait_queue(&async->wait_head, &wait); - on_wait_queue = true; - while (nbytes > 0 && !retval) { + while (count == 0 && !retval) { unsigned runflags; set_current_state(TASK_INTERRUPTIBLE); runflags = comedi_get_subdevice_runflags(s); if (!comedi_is_runflags_running(runflags)) { - if (count == 0) { - struct comedi_subdevice *new_s; - - if (comedi_is_runflags_in_error(runflags)) - retval = -EPIPE; - else - retval = 0; - /* - * To avoid deadlock, cannot acquire dev->mutex - * while dev->attach_lock is held. Need to - * remove task from the async wait queue before - * releasing dev->attach_lock, as it might not - * be valid afterwards. - */ - remove_wait_queue(&async->wait_head, &wait); - on_wait_queue = false; - up_read(&dev->attach_lock); - attach_locked = false; - mutex_lock(&dev->mutex); - /* - * Become non-busy unless things have changed - * behind our back. Checking dev->detach_count - * is unchanged ought to be sufficient (unless - * there have been 2**32 detaches in the - * meantime!), but check the subdevice pointer - * as well just in case. - */ - new_s = comedi_file_write_subdevice(file); - if (dev->attached && - old_detach_count == dev->detach_count && - s == new_s && new_s->async == async) - do_become_nonbusy(dev, s); - mutex_unlock(&dev->mutex); - } + if (comedi_is_runflags_in_error(runflags)) + retval = -EPIPE; + become_nonbusy = true; break; } @@ -2433,12 +2401,33 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, nbytes -= n; buf += n; - break; /* makes device work like a pipe */ + } + remove_wait_queue(&async->wait_head, &wait); + set_current_state(TASK_RUNNING); + if (become_nonbusy && count == 0) { + struct comedi_subdevice *new_s; + + /* + * To avoid deadlock, cannot acquire dev->mutex + * while dev->attach_lock is held. + */ + up_read(&dev->attach_lock); + attach_locked = false; + mutex_lock(&dev->mutex); + /* + * Check device hasn't become detached behind our back. + * Checking dev->detach_count is unchanged ought to be + * sufficient (unless there have been 2**32 detaches in the + * meantime!), but check the subdevice pointer as well just in + * case. + */ + new_s = comedi_file_write_subdevice(file); + if (dev->attached && old_detach_count == dev->detach_count && + s == new_s && new_s->async == async) + do_become_nonbusy(dev, s); + mutex_unlock(&dev->mutex); } out: - if (on_wait_queue) - remove_wait_queue(&async->wait_head, &wait); - set_current_state(TASK_RUNNING); if (attach_locked) up_read(&dev->attach_lock); From ed65bba31bdf038bada04415065b8d9b218b6066 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 18 Nov 2015 17:55:05 +0000 Subject: [PATCH 820/843] staging: comedi: do extra checks for becoming non-busy for "write" `comedi_write()` is the handler for the "write" file operation for COMEDI devices. It mostly runs without using the main mutex of the COMEDI device, but uses the `attach_lock` rw_semaphore to protect against the COMEDI device becoming "detached". A file object can write data for a COMEDI asynchonous command if it initiated the command. The COMEDI subdevice is marked as busy when the command is started. At some point, the "write" handler detects that the command has terminated and so marks the subdevice as non-busy. In order to mark the subdevice as non-busy, the "write" handler needs to release the `attach_lock` rw_semaphore and `acquire the main `mutex`. There is a vulnerable point between the two, so it checks that the device is still attached after acquiring the mutex. However, it does not currently check that the conditions for becoming non-busy still hold. Add some more checks that the subdevice is still busy with a command initiated by the same file object, and that the command is in the correct direction (in case the subdevice supports both "read" and "write"). Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index c9da6f39b1c6..94c23484284f 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2420,10 +2420,15 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, * sufficient (unless there have been 2**32 detaches in the * meantime!), but check the subdevice pointer as well just in * case. + * + * Also check the subdevice is still in a suitable state to + * become non-busy in case it changed behind our back. */ new_s = comedi_file_write_subdevice(file); if (dev->attached && old_detach_count == dev->detach_count && - s == new_s && new_s->async == async) + s == new_s && new_s->async == async && s->busy == file && + (async->cmd.flags & CMDF_WRITE) && + !comedi_is_subdevice_running(s)) do_become_nonbusy(dev, s); mutex_unlock(&dev->mutex); } From 84a185ec429fe64e5b0d81d7ac815c91578ee569 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 18 Nov 2015 17:55:06 +0000 Subject: [PATCH 821/843] staging: comedi: make some variables unsigned in comedi_write() In `comedi_write()`, the `n` and `m` variables are of type `int`. Change them to `unsigned int` as they are used to measure a positive number of bytes. The `count` variable is also of type `int` and holds the returned number of bytes written. Change it to type `ssize_t` to match the function's return type. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 94c23484284f..188a12a02ce7 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2303,7 +2303,9 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, { struct comedi_subdevice *s; struct comedi_async *async; - int n, m, count = 0, retval = 0; + unsigned int n, m; + ssize_t count = 0; + int retval = 0; DECLARE_WAITQUEUE(wait, current); struct comedi_file *cfp = file->private_data; struct comedi_device *dev = cfp->dev; From 591c5f8a599a58c7c3773027010e537fc1d7a7d5 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 18 Nov 2015 17:55:07 +0000 Subject: [PATCH 822/843] staging: comedi: avoid bad truncation of a size_t in comedi_write() At one point in `comedi_write()`, the variable `n` gets assigned to the minimum of the parameter `nbytes` and the amount of writeable buffer space. The way that is done currently is unsafe in the unlikely case that `nbytes` exceeds `UINT_MAX`, so fix it. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 188a12a02ce7..8c784c483c3e 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2357,16 +2357,13 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, break; } - n = nbytes; - - m = n; + /* Allocate all free buffer space. */ + comedi_buf_write_alloc(s, async->prealloc_bufsz); + m = comedi_buf_write_n_allocated(s); + /* Avoid buffer wraparound. */ if (async->buf_write_ptr + m > async->prealloc_bufsz) m = async->prealloc_bufsz - async->buf_write_ptr; - comedi_buf_write_alloc(s, async->prealloc_bufsz); - if (m > comedi_buf_write_n_allocated(s)) - m = comedi_buf_write_n_allocated(s); - if (m < n) - n = m; + n = min_t(size_t, m, nbytes); if (n == 0) { if (file->f_flags & O_NONBLOCK) { From 35a7475dc818320915e89ed0217872ff1ab66ec2 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 18 Nov 2015 17:55:08 +0000 Subject: [PATCH 823/843] staging: comedi: allow buffer wraparound in comedi_write() `comedi_write()` copies data from the user buffer to the acquisition data buffer, which is cyclic, using a single call to `copy_from_user()`. It currently avoids having to deal with wraparound of the cyclic buffer by limiting the amount it copies (and the amount returned to the user). Change it to deal with the wraparound using two calls to `copy_from_user()` if necessary. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 8c784c483c3e..4dd42890c641 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2346,6 +2346,7 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, add_wait_queue(&async->wait_head, &wait); while (count == 0 && !retval) { unsigned runflags; + unsigned int wp, n1, n2; set_current_state(TASK_INTERRUPTIBLE); @@ -2360,9 +2361,6 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, /* Allocate all free buffer space. */ comedi_buf_write_alloc(s, async->prealloc_bufsz); m = comedi_buf_write_n_allocated(s); - /* Avoid buffer wraparound. */ - if (async->buf_write_ptr + m > async->prealloc_bufsz) - m = async->prealloc_bufsz - async->buf_write_ptr; n = min_t(size_t, m, nbytes); if (n == 0) { @@ -2388,8 +2386,14 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, continue; } - m = copy_from_user(async->prealloc_buf + async->buf_write_ptr, - buf, n); + wp = async->buf_write_ptr; + n1 = min(n, async->prealloc_bufsz - wp); + n2 = n - n1; + m = copy_from_user(async->prealloc_buf + wp, buf, n1); + if (m) + m += n2; + else if (n2) + m = copy_from_user(async->prealloc_buf, buf + n1, n2); if (m) { n -= m; retval = -EFAULT; From 40d0e80e08012ac99b187cbaaeb8aab92b71714d Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 18 Nov 2015 17:55:09 +0000 Subject: [PATCH 824/843] staging: comedi: return error on "write" if no command set up The "write" file operation handler, `comedi_write()` returns an error for pretty much any condition that prevents a "write" going ahead. One of the conditions that prevents a "write" going ahead is that no asynchronous command has been set up, but that currently results in a return value of 0 (unless COMEDI instructions are being processed or an asynchronous command has been set up by a different file object). Change it to return `-EINVAL` in this case. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 4dd42890c641..2a2b5a06ed0e 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2331,9 +2331,12 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, } async = s->async; - - if (!s->busy || !nbytes) + if (!nbytes) goto out; + if (!s->busy) { + retval = -EINVAL; + goto out; + } if (s->busy != file) { retval = -EACCES; goto out; @@ -2373,8 +2376,10 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, retval = -ERESTARTSYS; break; } - if (!s->busy) + if (!s->busy) { + retval = -EINVAL; break; + } if (s->busy != file) { retval = -EACCES; break; From 3318c7add8b43a071498a973548dd24b55c587d4 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 18 Nov 2015 17:55:10 +0000 Subject: [PATCH 825/843] staging: comedi: simplify returned errors for comedi_write() In order to perform a "write" file operation, an asynchronous COMEDI command in the "write" direction needs to have been set up by the current file object on the COMEDI "write" subdevice associated with the file object. If there is a "write" subdevice, but a command has not been set up by the file object (or is has been set-up in the wrong direction), `comedi_write()` currently returns one of two error values `-EINVAL` or `-EACCES`. `-EACCES` is returned if the command was set up by a different subdevice, or somewhat randomly, if a COMEDI "instruction" is currently being processed. `-EINVAL` is returned in other cases. Simplify it by returning `-EINVAL` for all these cases. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 2a2b5a06ed0e..5a9c9d9782f3 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2333,15 +2333,7 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, async = s->async; if (!nbytes) goto out; - if (!s->busy) { - retval = -EINVAL; - goto out; - } - if (s->busy != file) { - retval = -EACCES; - goto out; - } - if (!(async->cmd.flags & CMDF_WRITE)) { + if (s->busy != file || !(async->cmd.flags & CMDF_WRITE)) { retval = -EINVAL; goto out; } @@ -2376,15 +2368,8 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, retval = -ERESTARTSYS; break; } - if (!s->busy) { - retval = -EINVAL; - break; - } - if (s->busy != file) { - retval = -EACCES; - break; - } - if (!(async->cmd.flags & CMDF_WRITE)) { + if (s->busy != file || + !(async->cmd.flags & CMDF_WRITE)) { retval = -EINVAL; break; } From 28a60c456bc52bbe949ad54c6b23917a651fc342 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 18 Nov 2015 17:55:11 +0000 Subject: [PATCH 826/843] staging: comedi: check for more errors for zero-length write If the "write" file operation handler, `comedi_write()` is passed 0 for the amount to write, some error conditions are currently skipped and the function just returns 0. Change it to check those error conditions and return an error value if appropriate. The trickiest case is the check for when the previously set up asynchronous command has terminated with an error. In that case, `-EPIPE` is returned (as it is for a write of non-zero length) and the subdevice gets marked as non-busy. A zero-length write that returns 0 has no other effects, in particular, it does not cause the subdevice to be marked as non-busy. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 5a9c9d9782f3..d57fadef47fc 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2331,8 +2331,6 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, } async = s->async; - if (!nbytes) - goto out; if (s->busy != file || !(async->cmd.flags & CMDF_WRITE)) { retval = -EINVAL; goto out; @@ -2349,9 +2347,12 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, if (!comedi_is_runflags_running(runflags)) { if (comedi_is_runflags_in_error(runflags)) retval = -EPIPE; - become_nonbusy = true; + if (retval || nbytes) + become_nonbusy = true; break; } + if (nbytes == 0) + break; /* Allocate all free buffer space. */ comedi_buf_write_alloc(s, async->prealloc_bufsz); From 479bd5edab3ca840ba60a89d3172029039ddc2a6 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 19 Nov 2015 14:49:07 +0000 Subject: [PATCH 827/843] staging: comedi: s526: replace counter mode bitfield struct The driver uses `struct counter_mode_register_t` to describe the 16-bit counter mode register as a sequence of bitfield members. The struct appears as the type of one of the members of `union cmReg`, the other member of which is of type `unsigned short`, so the driver can manipulate the register value as a whole, or as individual fields. Although this is fairly convenient, it's not that conventional. The code also needs to define the bitfield members in ascending or descending order of the physical bits, depending on whether bitfields are little- or big-endian. Rip all that out and replace it with a bunch of macros to set and mask out bits of the register value, as that's the more conventional way to do it. A bonus is that we get rid of a load of CamelCase definitions in the process. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/s526.c | 156 +++++++++++++++----------- 1 file changed, 93 insertions(+), 63 deletions(-) diff --git a/drivers/staging/comedi/drivers/s526.c b/drivers/staging/comedi/drivers/s526.c index d70c97947627..a8165dfe6f5f 100644 --- a/drivers/staging/comedi/drivers/s526.c +++ b/drivers/staging/comedi/drivers/s526.c @@ -37,7 +37,6 @@ #include #include "../comedidev.h" -#include /* * Register I/O map @@ -84,6 +83,62 @@ #define S526_GPCT_LSB_REG(x) (0x12 + ((x) * 8)) #define S526_GPCT_MSB_REG(x) (0x14 + ((x) * 8)) #define S526_GPCT_MODE_REG(x) (0x16 + ((x) * 8)) +#define S526_GPCT_MODE_COUT_SRC(x) ((x) << 0) +#define S526_GPCT_MODE_COUT_SRC_MASK S526_GPCT_MODE_COUT_SRC(0x1) +#define S526_GPCT_MODE_COUT_SRC_RCAP S526_GPCT_MODE_COUT_SRC(0) +#define S526_GPCT_MODE_COUT_SRC_RTGL S526_GPCT_MODE_COUT_SRC(1) +#define S526_GPCT_MODE_COUT_POL(x) ((x) << 1) +#define S526_GPCT_MODE_COUT_POL_MASK S526_GPCT_MODE_COUT_POL(0x1) +#define S526_GPCT_MODE_COUT_POL_NORM S526_GPCT_MODE_COUT_POL(0) +#define S526_GPCT_MODE_COUT_POL_INV S526_GPCT_MODE_COUT_POL(1) +#define S526_GPCT_MODE_AUTOLOAD(x) ((x) << 2) +#define S526_GPCT_MODE_AUTOLOAD_MASK S526_GPCT_MODE_AUTOLOAD(0x7) +#define S526_GPCT_MODE_AUTOLOAD_NONE S526_GPCT_MODE_AUTOLOAD(0) +/* these 3 bits can be OR'ed */ +#define S526_GPCT_MODE_AUTOLOAD_RO S526_GPCT_MODE_AUTOLOAD(0x1) +#define S526_GPCT_MODE_AUTOLOAD_IXFALL S526_GPCT_MODE_AUTOLOAD(0x2) +#define S526_GPCT_MODE_AUTOLOAD_IXRISE S526_GPCT_MODE_AUTOLOAD(0x4) +#define S526_GPCT_MODE_HWCTEN_SRC(x) ((x) << 5) +#define S526_GPCT_MODE_HWCTEN_SRC_MASK S526_GPCT_MODE_HWCTEN_SRC(0x3) +#define S526_GPCT_MODE_HWCTEN_SRC_CEN S526_GPCT_MODE_HWCTEN_SRC(0) +#define S526_GPCT_MODE_HWCTEN_SRC_IX S526_GPCT_MODE_HWCTEN_SRC(1) +#define S526_GPCT_MODE_HWCTEN_SRC_IXRF S526_GPCT_MODE_HWCTEN_SRC(2) +#define S526_GPCT_MODE_HWCTEN_SRC_NRCAP S526_GPCT_MODE_HWCTEN_SRC(3) +#define S526_GPCT_MODE_CTEN_CTRL(x) ((x) << 7) +#define S526_GPCT_MODE_CTEN_CTRL_MASK S526_GPCT_MODE_CTEN_CTRL(0x3) +#define S526_GPCT_MODE_CTEN_CTRL_DIS S526_GPCT_MODE_CTEN_CTRL(0) +#define S526_GPCT_MODE_CTEN_CTRL_ENA S526_GPCT_MODE_CTEN_CTRL(1) +#define S526_GPCT_MODE_CTEN_CTRL_HW S526_GPCT_MODE_CTEN_CTRL(2) +#define S526_GPCT_MODE_CTEN_CTRL_INVHW S526_GPCT_MODE_CTEN_CTRL(3) +#define S526_GPCT_MODE_CLK_SRC(x) ((x) << 9) +#define S526_GPCT_MODE_CLK_SRC_MASK S526_GPCT_MODE_CLK_SRC(0x3) +/* if count direction control set to quadrature */ +#define S526_GPCT_MODE_CLK_SRC_QUADX1 S526_GPCT_MODE_CLK_SRC(0) +#define S526_GPCT_MODE_CLK_SRC_QUADX2 S526_GPCT_MODE_CLK_SRC(1) +#define S526_GPCT_MODE_CLK_SRC_QUADX4 S526_GPCT_MODE_CLK_SRC(2) +#define S526_GPCT_MODE_CLK_SRC_QUADX4_ S526_GPCT_MODE_CLK_SRC(3) +/* if count direction control set to software control */ +#define S526_GPCT_MODE_CLK_SRC_ARISE S526_GPCT_MODE_CLK_SRC(0) +#define S526_GPCT_MODE_CLK_SRC_AFALL S526_GPCT_MODE_CLK_SRC(1) +#define S526_GPCT_MODE_CLK_SRC_INT S526_GPCT_MODE_CLK_SRC(2) +#define S526_GPCT_MODE_CLK_SRC_INTHALF S526_GPCT_MODE_CLK_SRC(3) +#define S526_GPCT_MODE_CT_DIR(x) ((x) << 11) +#define S526_GPCT_MODE_CT_DIR_MASK S526_GPCT_MODE_CT_DIR(0x1) +/* if count direction control set to software control */ +#define S526_GPCT_MODE_CT_DIR_UP S526_GPCT_MODE_CT_DIR(0) +#define S526_GPCT_MODE_CT_DIR_DOWN S526_GPCT_MODE_CT_DIR(1) +#define S526_GPCT_MODE_CTDIR_CTRL(x) ((x) << 12) +#define S526_GPCT_MODE_CTDIR_CTRL_MASK S526_GPCT_MODE_CTDIR_CTRL(0x1) +#define S526_GPCT_MODE_CTDIR_CTRL_QUAD S526_GPCT_MODE_CTDIR_CTRL(0) +#define S526_GPCT_MODE_CTDIR_CTRL_SOFT S526_GPCT_MODE_CTDIR_CTRL(1) +#define S526_GPCT_MODE_LATCH_CTRL(x) ((x) << 13) +#define S526_GPCT_MODE_LATCH_CTRL_MASK S526_GPCT_MODE_LATCH_CTRL(0x1) +#define S526_GPCT_MODE_LATCH_CTRL_READ S526_GPCT_MODE_LATCH_CTRL(0) +#define S526_GPCT_MODE_LATCH_CTRL_EVENT S526_GPCT_MODE_LATCH_CTRL(1) +#define S526_GPCT_MODE_PR_SELECT(x) ((x) << 14) +#define S526_GPCT_MODE_PR_SELECT_MASK S526_GPCT_MODE_PR_SELECT(0x1) +#define S526_GPCT_MODE_PR_SELECT_PR0 S526_GPCT_MODE_PR_SELECT(0) +#define S526_GPCT_MODE_PR_SELECT_PR1 S526_GPCT_MODE_PR_SELECT(1) #define S526_GPCT_CTRL_REG(x) (0x18 + ((x) * 8)) #define S526_EEPROM_DATA_REG 0x32 #define S526_EEPROM_CTRL_REG 0x34 @@ -92,41 +147,6 @@ #define S526_EEPROM_CTRL_READ S526_EEPROM_CTRL(2) #define S526_EEPROM_CTRL_START BIT(0) -struct counter_mode_register_t { -#if defined(__LITTLE_ENDIAN_BITFIELD) - unsigned short coutSource:1; - unsigned short coutPolarity:1; - unsigned short autoLoadResetRcap:3; - unsigned short hwCtEnableSource:2; - unsigned short ctEnableCtrl:2; - unsigned short clockSource:2; - unsigned short countDir:1; - unsigned short countDirCtrl:1; - unsigned short outputRegLatchCtrl:1; - unsigned short preloadRegSel:1; - unsigned short reserved:1; - #elif defined(__BIG_ENDIAN_BITFIELD) - unsigned short reserved:1; - unsigned short preloadRegSel:1; - unsigned short outputRegLatchCtrl:1; - unsigned short countDirCtrl:1; - unsigned short countDir:1; - unsigned short clockSource:2; - unsigned short ctEnableCtrl:2; - unsigned short hwCtEnableSource:2; - unsigned short autoLoadResetRcap:3; - unsigned short coutPolarity:1; - unsigned short coutSource:1; -#else -#error Unknown bit field order -#endif -}; - -union cmReg { - struct counter_mode_register_t reg; - unsigned short value; -}; - struct s526_private { unsigned int gpct_config[4]; unsigned short ai_ctrl; @@ -174,7 +194,6 @@ static int s526_gpct_insn_config(struct comedi_device *dev, struct s526_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); unsigned int val; - union cmReg cmReg; /* * Check what type of Counter the user requested @@ -192,28 +211,29 @@ static int s526_gpct_insn_config(struct comedi_device *dev, #if 1 /* Set Counter Mode Register */ - cmReg.value = data[1] & 0xffff; - outw(cmReg.value, dev->iobase + S526_GPCT_MODE_REG(chan)); + val = data[1] & 0xffff; + outw(val, dev->iobase + S526_GPCT_MODE_REG(chan)); /* Reset the counter if it is software preload */ - if (cmReg.reg.autoLoadResetRcap == 0) { + if ((val & S526_GPCT_MODE_AUTOLOAD_MASK) == + S526_GPCT_MODE_AUTOLOAD_NONE) { /* Reset the counter */ outw(0x8000, dev->iobase + S526_GPCT_CTRL_REG(chan)); - /* Load the counter from PR0 + /* + * Load the counter from PR0 * outw(0x4000, dev->iobase + S526_GPCT_CTRL_REG(chan)); */ } #else - /* 0 quadrature, 1 software control */ - cmReg.reg.countDirCtrl = 0; + val = S526_GPCT_MODE_CTDIR_CTRL_QUAD; /* data[1] contains GPCT_X1, GPCT_X2 or GPCT_X4 */ if (data[1] == GPCT_X2) - cmReg.reg.clockSource = 1; + val |= S526_GPCT_MODE_CLK_SRC_QUADX2; else if (data[1] == GPCT_X4) - cmReg.reg.clockSource = 2; + val |= S526_GPCT_MODE_CLK_SRC_QUADX4; else - cmReg.reg.clockSource = 0; + val |= S526_GPCT_MODE_CLK_SRC_QUADX1; /* When to take into account the indexpulse: */ /* @@ -224,13 +244,14 @@ static int s526_gpct_insn_config(struct comedi_device *dev, * } */ /* Take into account the index pulse? */ - if (data[3] == GPCT_RESET_COUNTER_ON_INDEX) + if (data[3] == GPCT_RESET_COUNTER_ON_INDEX) { /* Auto load with INDEX^ */ - cmReg.reg.autoLoadResetRcap = 4; + val |= S526_GPCT_MODE_AUTOLOAD_IXRISE; + } /* Set Counter Mode Register */ - cmReg.value = data[1] & 0xffff; - outw(cmReg.value, dev->iobase + S526_GPCT_MODE_REG(chan)); + val = data[1] & 0xffff; + outw(val, dev->iobase + S526_GPCT_MODE_REG(chan)); /* Load the pre-load register */ s526_gpct_write(dev, chan, data[2]); @@ -241,7 +262,8 @@ static int s526_gpct_insn_config(struct comedi_device *dev, dev->iobase + S526_GPCT_CTRL_REG(chan)); /* Reset the counter if it is software preload */ - if (cmReg.reg.autoLoadResetRcap == 0) { + if ((val & S526_GPCT_MODE_AUTOLOAD_MASK) == + S526_GPCT_MODE_AUTOLOAD_NONE) { /* Reset the counter */ outw(0x8000, dev->iobase + S526_GPCT_CTRL_REG(chan)); /* Load the counter from PR0 */ @@ -261,17 +283,21 @@ static int s526_gpct_insn_config(struct comedi_device *dev, devpriv->gpct_config[chan] = data[0]; /* Set Counter Mode Register */ - cmReg.value = data[1] & 0xffff; - cmReg.reg.preloadRegSel = 0; /* PR0 */ - outw(cmReg.value, dev->iobase + S526_GPCT_MODE_REG(chan)); + val = data[1] & 0xffff; + /* Select PR0 */ + val &= ~S526_GPCT_MODE_PR_SELECT_MASK; + val |= S526_GPCT_MODE_PR_SELECT_PR0; + outw(val, dev->iobase + S526_GPCT_MODE_REG(chan)); /* Load the pre-load register 0 */ s526_gpct_write(dev, chan, data[2]); /* Set Counter Mode Register */ - cmReg.value = data[1] & 0xffff; - cmReg.reg.preloadRegSel = 1; /* PR1 */ - outw(cmReg.value, dev->iobase + S526_GPCT_MODE_REG(chan)); + val = data[1] & 0xffff; + /* Select PR1 */ + val &= ~S526_GPCT_MODE_PR_SELECT_MASK; + val |= S526_GPCT_MODE_PR_SELECT_PR1; + outw(val, dev->iobase + S526_GPCT_MODE_REG(chan)); /* Load the pre-load register 1 */ s526_gpct_write(dev, chan, data[3]); @@ -294,17 +320,21 @@ static int s526_gpct_insn_config(struct comedi_device *dev, devpriv->gpct_config[chan] = data[0]; /* Set Counter Mode Register */ - cmReg.value = data[1] & 0xffff; - cmReg.reg.preloadRegSel = 0; /* PR0 */ - outw(cmReg.value, dev->iobase + S526_GPCT_MODE_REG(chan)); + val = data[1] & 0xffff; + /* Select PR0 */ + val &= ~S526_GPCT_MODE_PR_SELECT_MASK; + val |= S526_GPCT_MODE_PR_SELECT_PR0; + outw(val, dev->iobase + S526_GPCT_MODE_REG(chan)); /* Load the pre-load register 0 */ s526_gpct_write(dev, chan, data[2]); /* Set Counter Mode Register */ - cmReg.value = data[1] & 0xffff; - cmReg.reg.preloadRegSel = 1; /* PR1 */ - outw(cmReg.value, dev->iobase + S526_GPCT_MODE_REG(chan)); + val = data[1] & 0xffff; + /* Select PR1 */ + val &= ~S526_GPCT_MODE_PR_SELECT_MASK; + val |= S526_GPCT_MODE_PR_SELECT_PR1; + outw(val, dev->iobase + S526_GPCT_MODE_REG(chan)); /* Load the pre-load register 1 */ s526_gpct_write(dev, chan, data[3]); From e5417e49965a47f690fe33ab5b27011c86ef89b5 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 19 Nov 2015 14:49:08 +0000 Subject: [PATCH 828/843] staging: comedi: s526: add macros for counter control reg values The driver writes a couple of literal values to the counter control/status register, 0x8000 to reset the counter, and 0x4000 to load the counter from preload register 0. Add a bunch of macros to define these values and other values for the register, based on the Sensoray 526 manual. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/s526.c | 41 ++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/s526.c b/drivers/staging/comedi/drivers/s526.c index a8165dfe6f5f..c80527db9c19 100644 --- a/drivers/staging/comedi/drivers/s526.c +++ b/drivers/staging/comedi/drivers/s526.c @@ -139,7 +139,36 @@ #define S526_GPCT_MODE_PR_SELECT_MASK S526_GPCT_MODE_PR_SELECT(0x1) #define S526_GPCT_MODE_PR_SELECT_PR0 S526_GPCT_MODE_PR_SELECT(0) #define S526_GPCT_MODE_PR_SELECT_PR1 S526_GPCT_MODE_PR_SELECT(1) +/* Control/Status - R = readable, W = writeable, C = write 1 to clear */ #define S526_GPCT_CTRL_REG(x) (0x18 + ((x) * 8)) +#define S526_GPCT_CTRL_EV_STATUS(x) ((x) << 0) /* RC */ +#define S526_GPCT_CTRL_EV_STATUS_MASK S526_GPCT_EV_STATUS(0xf) +#define S526_GPCT_CTRL_EV_STATUS_NONE S526_GPCT_EV_STATUS(0) +/* these 4 bits can be OR'ed */ +#define S526_GPCT_CTRL_EV_STATUS_ECAP S526_GPCT_EV_STATUS(0x1) +#define S526_GPCT_CTRL_EV_STATUS_ICAPN S526_GPCT_EV_STATUS(0x2) +#define S526_GPCT_CTRL_EV_STATUS_ICAPP S526_GPCT_EV_STATUS(0x4) +#define S526_GPCT_CTRL_EV_STATUS_RCAP S526_GPCT_EV_STATUS(0x8) +#define S526_GPCT_CTRL_COUT_STATUS BIT(4) /* R */ +#define S526_GPCT_CTRL_INDEX_STATUS BIT(5) /* R */ +#define S525_GPCT_CTRL_INTEN(x) ((x) << 6) /* W */ +#define S525_GPCT_CTRL_INTEN_MASK S526_GPCT_CTRL_INTEN(0xf) +#define S525_GPCT_CTRL_INTEN_NONE S526_GPCT_CTRL_INTEN(0) +/* these 4 bits can be OR'ed */ +#define S525_GPCT_CTRL_INTEN_ERROR S526_GPCT_CTRL_INTEN(0x1) +#define S525_GPCT_CTRL_INTEN_IXFALL S526_GPCT_CTRL_INTEN(0x2) +#define S525_GPCT_CTRL_INTEN_IXRISE S526_GPCT_CTRL_INTEN(0x4) +#define S525_GPCT_CTRL_INTEN_RO S526_GPCT_CTRL_INTEN(0x8) +#define S525_GPCT_CTRL_LATCH_SEL(x) ((x) << 10) /* W */ +#define S525_GPCT_CTRL_LATCH_SEL_MASK S526_GPCT_CTRL_LATCH_SEL(0x7) +#define S525_GPCT_CTRL_LATCH_SEL_NONE S526_GPCT_CTRL_LATCH_SEL(0) +/* these 3 bits can be OR'ed */ +#define S525_GPCT_CTRL_LATCH_SEL_IXFALL S526_GPCT_CTRL_LATCH_SEL(0x1) +#define S525_GPCT_CTRL_LATCH_SEL_IXRISE S526_GPCT_CTRL_LATCH_SEL(0x2) +#define S525_GPCT_CTRL_LATCH_SEL_ITIMER S526_GPCT_CTRL_LATCH_SEL(0x4) +#define S525_GPCT_CTRL_CT_ARM BIT(13) /* W */ +#define S525_GPCT_CTRL_CT_LOAD BIT(14) /* W */ +#define S526_GPCT_CTRL_CT_RESET BIT(15) /* W */ #define S526_EEPROM_DATA_REG 0x32 #define S526_EEPROM_CTRL_REG 0x34 #define S526_EEPROM_CTRL_ADDR(x) (((x) & 0x3f) << 3) @@ -218,10 +247,12 @@ static int s526_gpct_insn_config(struct comedi_device *dev, if ((val & S526_GPCT_MODE_AUTOLOAD_MASK) == S526_GPCT_MODE_AUTOLOAD_NONE) { /* Reset the counter */ - outw(0x8000, dev->iobase + S526_GPCT_CTRL_REG(chan)); + outw(S526_GPCT_CTRL_CT_RESET, + dev->iobase + S526_GPCT_CTRL_REG(chan)); /* * Load the counter from PR0 - * outw(0x4000, dev->iobase + S526_GPCT_CTRL_REG(chan)); + * outw(S526_GPCT_CTRL_CT_LOAD, + * dev->iobase + S526_GPCT_CTRL_REG(chan)); */ } #else @@ -265,9 +296,11 @@ static int s526_gpct_insn_config(struct comedi_device *dev, if ((val & S526_GPCT_MODE_AUTOLOAD_MASK) == S526_GPCT_MODE_AUTOLOAD_NONE) { /* Reset the counter */ - outw(0x8000, dev->iobase + S526_GPCT_CTRL_REG(chan)); + outw(S526_GPCT_CTRL_CT_RESET, + dev->iobase + S526_GPCT_CTRL_REG(chan)); /* Load the counter from PR0 */ - outw(0x4000, dev->iobase + S526_GPCT_CTRL_REG(chan)); + outw(S526_GPCT_CTRL_CT_LOAD, + dev->iobase + S526_GPCT_CTRL_REG(chan)); } #endif break; From 2acc980bc623bd8cf3959e85e01fe98c6ede74f5 Mon Sep 17 00:00:00 2001 From: Jitendra Kumar Khasdev Date: Tue, 24 Nov 2015 17:52:28 +0530 Subject: [PATCH 829/843] staging: comedi: comedilib.h: Coding style warning fix for block comments This patch is to comedilib.h file that fixes up following warnings reported by checkpatch.pl : I) Block comments use * on subsequent lines. Apart from it I have remove header file path by base file name as suggested by community. Signed-off-by: Jitendra Kumar Khasdev Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedilib.h | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/staging/comedi/comedilib.h b/drivers/staging/comedi/comedilib.h index 56baf852ecf5..f9b56396e161 100644 --- a/drivers/staging/comedi/comedilib.h +++ b/drivers/staging/comedi/comedilib.h @@ -1,20 +1,20 @@ /* - linux/include/comedilib.h - header file for kcomedilib - - COMEDI - Linux Control and Measurement Device Interface - Copyright (C) 1998-2001 David A. Schleef - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. -*/ + * comedilib.h + * Header file for kcomedilib + * + * COMEDI - Linux Control and Measurement Device Interface + * Copyright (C) 1998-2001 David A. Schleef + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ #ifndef _LINUX_COMEDILIB_H #define _LINUX_COMEDILIB_H From e554840c947c2d25be24c790cf8db9579b2dfb4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20K=C3=B6nig?= Date: Thu, 17 Dec 2015 16:53:10 +0100 Subject: [PATCH 830/843] STAGING: COMEDI: Fixed format of comments in plx9080.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch fixes the format of comments in plx9080.h. Signed-off-by: Moritz König Signed-off-by: Fabian Lang Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/plx9080.h | 122 +++++++++++++++-------- 1 file changed, 78 insertions(+), 44 deletions(-) diff --git a/drivers/staging/comedi/drivers/plx9080.h b/drivers/staging/comedi/drivers/plx9080.h index 25706531b885..8d3caf6b4e86 100644 --- a/drivers/staging/comedi/drivers/plx9080.h +++ b/drivers/staging/comedi/drivers/plx9080.h @@ -1,4 +1,5 @@ -/* plx9080.h +/* + * plx9080.h * * Copyright (C) 2002,2003 Frank Mori Hess * @@ -33,8 +34,10 @@ struct plx_dma_desc { __le32 local_start_addr; /* transfer_size is in bytes, only first 23 bits of register are used */ __le32 transfer_size; - /* address of next descriptor (quad word aligned), plus some - * additional bits (see PLX_DMA0_DESCRIPTOR_REG) */ + /* + * address of next descriptor (quad word aligned), plus some + * additional bits (see PLX_DMA0_DESCRIPTOR_REG) + */ __le32 next; }; @@ -46,23 +49,31 @@ struct plx_dma_desc { ** **********************************************************************/ -#define PLX_LAS0RNG_REG 0x0000 /* L, Local Addr Space 0 Range Register */ -#define PLX_LAS1RNG_REG 0x00f0 /* L, Local Addr Space 1 Range Register */ +/* L, Local Addr Space 0 Range Register */ +#define PLX_LAS0RNG_REG 0x0000 +/* L, Local Addr Space 1 Range Register */ +#define PLX_LAS1RNG_REG 0x00f0 #define LRNG_IO 0x00000001 /* Map to: 1=I/O, 0=Mem */ #define LRNG_ANY32 0x00000000 /* Locate anywhere in 32 bit */ #define LRNG_LT1MB 0x00000002 /* Locate in 1st meg */ #define LRNG_ANY64 0x00000004 /* Locate anywhere in 64 bit */ -#define LRNG_MEM_MASK 0xfffffff0 /* bits that specify range for memory io */ -#define LRNG_IO_MASK 0xfffffffa /* bits that specify range for normal io */ - -#define PLX_LAS0MAP_REG 0x0004 /* L, Local Addr Space 0 Remap Register */ -#define PLX_LAS1MAP_REG 0x00f4 /* L, Local Addr Space 1 Remap Register */ +/* bits that specify range for memory io */ +#define LRNG_MEM_MASK 0xfffffff0 +/* bits that specify range for normal io */ +#define LRNG_IO_MASK 0xfffffffa +/* L, Local Addr Space 0 Remap Register */ +#define PLX_LAS0MAP_REG 0x0004 +/* L, Local Addr Space 1 Remap Register */ +#define PLX_LAS1MAP_REG 0x00f4 #define LMAP_EN 0x00000001 /* Enable slave decode */ -#define LMAP_MEM_MASK 0xfffffff0 /* bits that specify decode for memory io */ -#define LMAP_IO_MASK 0xfffffffa /* bits that specify decode bits for normal io */ +/* bits that specify decode for memory io */ +#define LMAP_MEM_MASK 0xfffffff0 +/* bits that specify decode bits for normal io */ +#define LMAP_IO_MASK 0xfffffffa -/* Mode/Arbitration Register. -*/ +/* + * Mode/Arbitration Register. + */ #define PLX_MARB_REG 0x8 /* L, Local Arbitration Register */ #define PLX_DMAARB_REG 0xac enum marb_bits { @@ -72,35 +83,45 @@ enum marb_bits { MARB_LPEN = 0x00020000, /* Pause Timer Enable */ MARB_BREQ = 0x00040000, /* Local Bus BREQ Enable */ MARB_DMA_PRIORITY_MASK = 0x00180000, - MARB_LBDS_GIVE_UP_BUS_MODE = 0x00200000, /* local bus direct slave give up bus mode */ - MARB_DS_LLOCK_ENABLE = 0x00400000, /* direct slave LLOCKo# enable */ + /* local bus direct slave give up bus mode */ + MARB_LBDS_GIVE_UP_BUS_MODE = 0x00200000, + /* direct slave LLOCKo# enable */ + MARB_DS_LLOCK_ENABLE = 0x00400000, MARB_PCI_REQUEST_MODE = 0x00800000, MARB_PCIv21_MODE = 0x01000000, /* pci specification v2.1 mode */ MARB_PCI_READ_NO_WRITE_MODE = 0x02000000, MARB_PCI_READ_WITH_WRITE_FLUSH_MODE = 0x04000000, - MARB_GATE_TIMER_WITH_BREQ = 0x08000000, /* gate local bus latency timer with BREQ */ + /* gate local bus latency timer with BREQ */ + MARB_GATE_TIMER_WITH_BREQ = 0x08000000, MARB_PCI_READ_NO_FLUSH_MODE = 0x10000000, MARB_USE_SUBSYSTEM_IDS = 0x20000000, }; #define PLX_BIGEND_REG 0xc enum bigend_bits { - BIGEND_CONFIG = 0x1, /* use big endian ordering for configuration register accesses */ + /* use big endian ordering for configuration register accesses */ + BIGEND_CONFIG = 0x1, BIGEND_DIRECT_MASTER = 0x2, BIGEND_DIRECT_SLAVE_LOCAL0 = 0x4, BIGEND_ROM = 0x8, - BIGEND_BYTE_LANE = 0x10, /* use byte lane consisting of most significant bits instead of least significant */ + /* + * use byte lane consisting of most significant bits instead of + * least significant + */ + BIGEND_BYTE_LANE = 0x10, BIGEND_DIRECT_SLAVE_LOCAL1 = 0x20, BIGEND_DMA1 = 0x40, BIGEND_DMA0 = 0x80, }; -/* Note: The Expansion ROM stuff is only relevant to the PC environment. +/* +** Note: The Expansion ROM stuff is only relevant to the PC environment. ** This expansion ROM code is executed by the host CPU at boot time. ** For this reason no bit definitions are provided here. -*/ + */ #define PLX_ROMRNG_REG 0x0010 /* L, Expn ROM Space Range Register */ -#define PLX_ROMMAP_REG 0x0014 /* L, Local Addr Space Range Register */ +/* L, Local Addr Space Range Register */ +#define PLX_ROMMAP_REG 0x0014 #define PLX_REGION0_REG 0x0018 /* L, Local Bus Region 0 Descriptor */ #define RGN_WIDTH 0x00000002 /* Local bus width bits */ @@ -190,7 +211,8 @@ enum bigend_bits { #define ICS_TA_DMA0 0x02000000 /* Target Abort - DMA #0 */ #define ICS_TA_DMA1 0x04000000 /* Target Abort - DMA #1 */ #define ICS_TA_RA 0x08000000 /* Target Abort - Retry Timeout */ -#define ICS_MBIA(x) (0x10000000 << ((x) & 0x3)) /* mailbox x is active */ +/* mailbox x is active */ +#define ICS_MBIA(x) (0x10000000 << ((x) & 0x3)) #define PLX_CONTROL_REG 0x006C /* L, EEPROM Cntl & PCI Cmd Codes */ #define CTL_RDMA 0x0000000E /* DMA Read Command */ @@ -221,28 +243,38 @@ enum bigend_bits { #define PLX_EN_BTERM_BIT 0x80 /* enable BTERM# input */ #define PLX_DMA_LOCAL_BURST_EN_BIT 0x100 /* enable local burst mode */ #define PLX_EN_CHAIN_BIT 0x200 /* enables chaining */ -#define PLX_EN_DMA_DONE_INTR_BIT 0x400 /* enables interrupt on dma done */ -#define PLX_LOCAL_ADDR_CONST_BIT 0x800 /* hold local address constant (don't increment) */ -#define PLX_DEMAND_MODE_BIT 0x1000 /* enables demand-mode for dma transfer */ +/* enables interrupt on dma done */ +#define PLX_EN_DMA_DONE_INTR_BIT 0x400 +/* hold local address constant (don't increment) */ +#define PLX_LOCAL_ADDR_CONST_BIT 0x800 +/* enables demand-mode for dma transfer */ +#define PLX_DEMAND_MODE_BIT 0x1000 #define PLX_EOT_ENABLE_BIT 0x4000 #define PLX_STOP_MODE_BIT 0x8000 -#define PLX_DMA_INTR_PCI_BIT 0x20000 /* routes dma interrupt to pci bus (instead of local bus) */ +/* routes dma interrupt to pci bus (instead of local bus) */ +#define PLX_DMA_INTR_PCI_BIT 0x20000 -#define PLX_DMA0_PCI_ADDRESS_REG 0x84 /* pci address that dma transfers start at */ +/* pci address that dma transfers start at */ +#define PLX_DMA0_PCI_ADDRESS_REG 0x84 #define PLX_DMA1_PCI_ADDRESS_REG 0x98 -#define PLX_DMA0_LOCAL_ADDRESS_REG 0x88 /* local address that dma transfers start at */ +/* local address that dma transfers start at */ +#define PLX_DMA0_LOCAL_ADDRESS_REG 0x88 #define PLX_DMA1_LOCAL_ADDRESS_REG 0x9c -#define PLX_DMA0_TRANSFER_SIZE_REG 0x8c /* number of bytes to transfer (first 23 bits) */ +/* number of bytes to transfer (first 23 bits) */ +#define PLX_DMA0_TRANSFER_SIZE_REG 0x8c #define PLX_DMA1_TRANSFER_SIZE_REG 0xa0 #define PLX_DMA0_DESCRIPTOR_REG 0x90 /* descriptor pointer register */ #define PLX_DMA1_DESCRIPTOR_REG 0xa4 -#define PLX_DESC_IN_PCI_BIT 0x1 /* descriptor is located in pci space (not local space) */ +/* descriptor is located in pci space (not local space) */ +#define PLX_DESC_IN_PCI_BIT 0x1 #define PLX_END_OF_CHAIN_BIT 0x2 /* end of chain bit */ -#define PLX_INTR_TERM_COUNT 0x4 /* interrupt when this descriptor's transfer is finished */ -#define PLX_XFER_LOCAL_TO_PCI 0x8 /* transfer from local to pci bus (not pci to local) */ +/* interrupt when this descriptor's transfer is finished */ +#define PLX_INTR_TERM_COUNT 0x4 +/* transfer from local to pci bus (not pci to local) */ +#define PLX_XFER_LOCAL_TO_PCI 0x8 #define PLX_DMA0_CS_REG 0xa8 /* command status register */ #define PLX_DMA1_CS_REG 0xa9 @@ -288,10 +320,11 @@ enum bigend_bits { #define MBX_STS_PCIRESET 0x00000100 /* Host issued PCI reset request */ #define MBX_STS_BUSY 0x00000080 /* PUTS is in progress */ #define MBX_STS_ERROR 0x00000040 /* PUTS has failed */ -#define MBX_STS_RESERVED 0x000000c0 /* Undefined -> status in transition. - We are in process of changing - bits; we SET Error bit before - RESET of Busy bit */ +/* + * Undefined -> status in transition. We are in process of changing bits; + * we SET Error bit before RESET of Busy bit + */ +#define MBX_STS_RESERVED 0x000000c0 #define MBX_RESERVED_5 0x00000020 /* FYI: reserved/unused bit */ #define MBX_RESERVED_4 0x00000010 /* FYI: reserved/unused bit */ @@ -320,12 +353,12 @@ enum bigend_bits { #define MBX_CMD_BSWAP_0 0x8c000000 /* use scheme 0 */ #define MBX_CMD_BSWAP_1 0x8c000001 /* use scheme 1 */ -#define MBX_CMD_SETHMS 0x8d000000 /* setup host memory access window - size */ -#define MBX_CMD_SETHBA 0x8e000000 /* setup host memory access base - address */ -#define MBX_CMD_MGO 0x8f000000 /* perform memory setup and continue - (IE. Done) */ +/* setup host memory access window size */ +#define MBX_CMD_SETHMS 0x8d000000 +/* setup host memory access base address */ +#define MBX_CMD_SETHBA 0x8e000000 +/* perform memory setup and continue (IE. Done) */ +#define MBX_CMD_MGO 0x8f000000 #define MBX_CMD_NOOP 0xFF000000 /* dummy, illegal command */ /*****************************************/ @@ -348,7 +381,8 @@ enum bigend_bits { /***************************************/ #define MBX_BTYPE_MASK 0x0000ffff /* PUTS Board Type Register */ -#define MBX_BTYPE_FAMILY_MASK 0x0000ff00 /* PUTS Board Family Register */ +/* PUTS Board Family Register */ +#define MBX_BTYPE_FAMILY_MASK 0x0000ff00 #define MBX_BTYPE_SUBTYPE_MASK 0x000000ff /* PUTS Board Subtype */ #define MBX_BTYPE_PLX9060 0x00000100 /* PLX family type */ From e0bcce6b3a6a8c2ac8f5b8be8fb7be0d4e682072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20K=C3=B6nig?= Date: Thu, 17 Dec 2015 16:53:11 +0100 Subject: [PATCH 831/843] STAGING: COMEDI: Added spaces around binary operators in plx9080.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds spaces around binary operators in plx9080.h. Signed-off-by: Moritz König Signed-off-by: Fabian Lang Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/plx9080.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/plx9080.h b/drivers/staging/comedi/drivers/plx9080.h index 8d3caf6b4e86..c4920f8654d0 100644 --- a/drivers/staging/comedi/drivers/plx9080.h +++ b/drivers/staging/comedi/drivers/plx9080.h @@ -412,7 +412,7 @@ enum bigend_bits { /* system allocates this many bytes for address mapping mailbox space */ #define MBX_ADDR_SPACE_360 0x80 /* wanXL100s/200/400 */ -#define MBX_ADDR_MASK_360 (MBX_ADDR_SPACE_360-1) +#define MBX_ADDR_MASK_360 (MBX_ADDR_SPACE_360 - 1) static inline int plx9080_abort_dma(void __iomem *iobase, unsigned int channel) { From f6e9b914332f5c60249a911c687eea1aa0cd37d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20K=C3=B6nig?= Date: Thu, 17 Dec 2015 16:53:12 +0100 Subject: [PATCH 832/843] STAGING: COMEDI: Using kernel types in plx9080.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch makes plx9080.h use kernel types. Signed-off-by: Moritz König Signed-off-by: Fabian Lang Reviewed-by: Ian Abbott Acked-by: Moritz Fischer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/plx9080.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/plx9080.h b/drivers/staging/comedi/drivers/plx9080.h index c4920f8654d0..f5cd6d5004bd 100644 --- a/drivers/staging/comedi/drivers/plx9080.h +++ b/drivers/staging/comedi/drivers/plx9080.h @@ -417,7 +417,7 @@ enum bigend_bits { static inline int plx9080_abort_dma(void __iomem *iobase, unsigned int channel) { void __iomem *dma_cs_addr; - uint8_t dma_status; + u8 dma_status; const int timeout = 10000; unsigned int i; From e7cfb3907d1c88cea8977fa267149cb2297fb07e Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Wed, 18 Nov 2015 22:02:39 +0100 Subject: [PATCH 833/843] staging/emxx_udc: fix 64-bit warnings ARCH_SHMOBILE is coming to arm64, which creates new warnings in allmodconfig: drivers/staging/emxx_udc/emxx_udc.c: In function '_nbu2ss_out_dma': drivers/staging/emxx_udc/emxx_udc.c:843:45: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] _nbu2ss_writel(&preg->EP_DCR[num].EP_TADR, (u32)pBuffer); This is clearly a mistake from confusing a dma_addr_t with a pointer, so the fix is to use the correct types in two places. The third warning of this kind is a check for an unaligned pointer, which should be done by casting the pointer to uintptr_t, not int. Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/emxx_udc/emxx_udc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index 4e6c16af40fc..c168845cbb91 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -823,7 +823,7 @@ static int _nbu2ss_out_dma( u32 length ) { - u8 *pBuffer; + dma_addr_t pBuffer; u32 mpkt; u32 lmpkt; u32 dmacnt; @@ -836,7 +836,7 @@ static int _nbu2ss_out_dma( return 1; /* DMA is forwarded */ req->dma_flag = TRUE; - pBuffer = (u8 *)req->req.dma; + pBuffer = req->req.dma; pBuffer += req->req.actual; /* DMA Address */ @@ -1034,7 +1034,7 @@ static int _nbu2ss_in_dma( u32 length ) { - u8 *pBuffer; + dma_addr_t pBuffer; u32 mpkt; /* MaxPacketSize */ u32 lmpkt; /* Last Packet Data Size */ u32 dmacnt; /* IN Data Size */ @@ -1080,7 +1080,7 @@ static int _nbu2ss_in_dma( _nbu2ss_writel(&preg->EP_DCR[num].EP_DCR2, data); /* Address setting */ - pBuffer = (u8 *)req->req.dma; + pBuffer = req->req.dma; pBuffer += req->req.actual; _nbu2ss_writel(&preg->EP_DCR[num].EP_TADR, (u32)pBuffer); @@ -2728,7 +2728,7 @@ static int nbu2ss_ep_queue( spin_lock_irqsave(&udc->lock, flags); #ifdef USE_DMA - if ((u32)req->req.buf & 0x3) + if ((uintptr_t)req->req.buf & 0x3) req->unaligned = TRUE; else req->unaligned = FALSE; From e59ac747946693b1356d576f843ce8ac1e283927 Mon Sep 17 00:00:00 2001 From: Geliang Tang Date: Mon, 16 Nov 2015 21:54:46 +0800 Subject: [PATCH 834/843] staging: emxx_udc: use list_first_entry_or_null() Simplify the code with list_first_entry_or_null(). Signed-off-by: Geliang Tang Signed-off-by: Greg Kroah-Hartman --- drivers/staging/emxx_udc/emxx_udc.c | 30 +++++------------------------ 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index c168845cbb91..beb9411658ba 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -1285,11 +1285,7 @@ static void _nbu2ss_restert_transfer(struct nbu2ss_ep *ep) bool bflag = FALSE; struct nbu2ss_req *req; - if (list_empty(&ep->queue)) - req = NULL; - else - req = list_entry(ep->queue.next, struct nbu2ss_req, queue); - + req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); if (!req) return; @@ -1784,11 +1780,7 @@ static inline int _nbu2ss_ep0_in_data_stage(struct nbu2ss_udc *udc) struct nbu2ss_req *req; struct nbu2ss_ep *ep = &udc->ep[0]; - if (list_empty(&ep->queue)) - req = NULL; - else - req = list_entry(ep->queue.next, struct nbu2ss_req, queue); - + req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); if (!req) req = &udc->ep0_req; @@ -1811,11 +1803,7 @@ static inline int _nbu2ss_ep0_out_data_stage(struct nbu2ss_udc *udc) struct nbu2ss_req *req; struct nbu2ss_ep *ep = &udc->ep[0]; - if (list_empty(&ep->queue)) - req = NULL; - else - req = list_entry(ep->queue.next, struct nbu2ss_req, queue); - + req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); if (!req) req = &udc->ep0_req; @@ -1838,11 +1826,7 @@ static inline int _nbu2ss_ep0_status_stage(struct nbu2ss_udc *udc) struct nbu2ss_req *req; struct nbu2ss_ep *ep = &udc->ep[0]; - if (list_empty(&ep->queue)) - req = NULL; - else - req = list_entry(ep->queue.next, struct nbu2ss_req, queue); - + req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); if (!req) { req = &udc->ep0_req; if (req->req.complete) @@ -2145,11 +2129,7 @@ static inline void _nbu2ss_epn_int(struct nbu2ss_udc *udc, u32 epnum) /* Interrupt Clear */ _nbu2ss_writel(&udc->p_regs->EP_REGS[num].EP_STATUS, ~(u32)status); - if (list_empty(&ep->queue)) - req = NULL; - else - req = list_entry(ep->queue.next, struct nbu2ss_req, queue); - + req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); if (!req) { /* pr_warn("=== %s(%d) req == NULL\n", __func__, epnum); */ return; From 7d2c2acac577959dbbddefefa91d1ba1b80460b3 Mon Sep 17 00:00:00 2001 From: "Andrew F. Davis" Date: Mon, 14 Dec 2015 16:35:57 -0600 Subject: [PATCH 835/843] iio: Make IIO value formating function globally available. Make IIO value formating function globally available to allow IIO drivers to output values as the core does. Signed-off-by: Andrew F. Davis Signed-off-by: Jonathan Cameron --- drivers/iio/industrialio-core.c | 1 + include/linux/iio/iio.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index d0a84febd435..a45eb2c53d0f 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -470,6 +470,7 @@ ssize_t iio_format_value(char *buf, unsigned int type, int size, int *vals) return 0; } } +EXPORT_SYMBOL_GPL(iio_format_value); static ssize_t iio_read_channel_info(struct device *dev, struct device_attribute *attr, diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index 19c94c9acc81..b5894118755f 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h @@ -636,6 +636,8 @@ static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev) } #endif +ssize_t iio_format_value(char *buf, unsigned int type, int size, int *vals); + int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer, int *fract); From 58e9042f5f130bf3f9043cf75aa2632fc12140e6 Mon Sep 17 00:00:00 2001 From: Adriana Reus Date: Mon, 14 Dec 2015 14:24:45 +0200 Subject: [PATCH 836/843] iio: light: us5182d: Fix enable status inconcistency When setting als only or proximity only modes make sure that we mark the other component as disabled. This fix is in preparation of adding event support because that will make it possible to switch between one-shot and continuous modes and not tracking these correctly may cause faulty behaviour (e.g wrongfully considering px enabled and not setting an appropriate mode in the chip). Signed-off-by: Adriana Reus Signed-off-by: Jonathan Cameron --- drivers/iio/light/us5182d.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/us5182d.c b/drivers/iio/light/us5182d.c index 256c4bc12d21..f24b687bd152 100644 --- a/drivers/iio/light/us5182d.c +++ b/drivers/iio/light/us5182d.c @@ -238,8 +238,12 @@ static int us5182d_als_enable(struct us5182d_data *data) int ret; u8 mode; - if (data->power_mode == US5182D_ONESHOT) - return us5182d_set_opmode(data, US5182D_ALS_ONLY); + if (data->power_mode == US5182D_ONESHOT) { + ret = us5182d_set_opmode(data, US5182D_ALS_ONLY); + if (ret < 0) + return ret; + data->px_enabled = false; + } if (data->als_enabled) return 0; @@ -260,8 +264,12 @@ static int us5182d_px_enable(struct us5182d_data *data) int ret; u8 mode; - if (data->power_mode == US5182D_ONESHOT) - return us5182d_set_opmode(data, US5182D_PX_ONLY); + if (data->power_mode == US5182D_ONESHOT) { + ret = us5182d_set_opmode(data, US5182D_PX_ONLY); + if (ret < 0) + return ret; + data->als_enabled = false; + } if (data->px_enabled) return 0; From b6695254f800698faee4f30a8f0b199459ebeafe Mon Sep 17 00:00:00 2001 From: Adriana Reus Date: Mon, 14 Dec 2015 14:24:46 +0200 Subject: [PATCH 837/843] iio: light: us5182d: Add interrupt support and events Add interrupt support for proximity. Add two threshold events to signal rising and falling directions. Signed-off-by: Adriana Reus Signed-off-by: Jonathan Cameron --- drivers/iio/light/us5182d.c | 271 +++++++++++++++++++++++++++++++++++- 1 file changed, 270 insertions(+), 1 deletion(-) diff --git a/drivers/iio/light/us5182d.c b/drivers/iio/light/us5182d.c index f24b687bd152..213f7785095f 100644 --- a/drivers/iio/light/us5182d.c +++ b/drivers/iio/light/us5182d.c @@ -20,7 +20,10 @@ #include #include #include +#include #include +#include +#include #include #include #include @@ -30,6 +33,8 @@ #define US5182D_CFG0_ONESHOT_EN BIT(6) #define US5182D_CFG0_SHUTDOWN_EN BIT(7) #define US5182D_CFG0_WORD_ENABLE BIT(0) +#define US5182D_CFG0_PROX BIT(3) +#define US5182D_CFG0_PX_IRQ BIT(2) #define US5182D_REG_CFG1 0x01 #define US5182D_CFG1_ALS_RES16 BIT(4) @@ -41,6 +46,7 @@ #define US5182D_REG_CFG3 0x03 #define US5182D_CFG3_LED_CURRENT100 (BIT(4) | BIT(5)) +#define US5182D_CFG3_INT_SOURCE_PX BIT(3) #define US5182D_REG_CFG4 0x10 @@ -55,6 +61,13 @@ #define US5182D_REG_AUTO_LDARK_GAIN 0x29 #define US5182D_REG_AUTO_HDARK_GAIN 0x2a +/* Thresholds for events: px low (0x08-l, 0x09-h), px high (0x0a-l 0x0b-h) */ +#define US5182D_REG_PXL_TH 0x08 +#define US5182D_REG_PXH_TH 0x0a + +#define US5182D_REG_PXL_TH_DEFAULT 1000 +#define US5182D_REG_PXH_TH_DEFAULT 30000 + #define US5182D_OPMODE_ALS 0x01 #define US5182D_OPMODE_PX 0x02 #define US5182D_OPMODE_SHIFT 4 @@ -84,6 +97,8 @@ #define US5182D_READ_WORD 2 #define US5182D_OPSTORE_SLEEP_TIME 20 /* ms */ #define US5182D_SLEEP_MS 3000 /* ms */ +#define US5182D_PXH_TH_DISABLE 0xffff +#define US5182D_PXL_TH_DISABLE 0x0000 /* Available ranges: [12354, 7065, 3998, 2202, 1285, 498, 256, 138] lux */ static const int us5182d_scales[] = {188500, 107800, 61000, 33600, 19600, 7600, @@ -119,6 +134,12 @@ struct us5182d_data { u8 upper_dark_gain; u16 *us5182d_dark_ths; + u16 px_low_th; + u16 px_high_th; + + int rising_en; + int falling_en; + u8 opmode; u8 power_mode; @@ -148,10 +169,26 @@ static const struct { {US5182D_REG_CFG1, US5182D_CFG1_ALS_RES16}, {US5182D_REG_CFG2, (US5182D_CFG2_PX_RES16 | US5182D_CFG2_PXGAIN_DEFAULT)}, - {US5182D_REG_CFG3, US5182D_CFG3_LED_CURRENT100}, + {US5182D_REG_CFG3, US5182D_CFG3_LED_CURRENT100 | + US5182D_CFG3_INT_SOURCE_PX}, {US5182D_REG_CFG4, 0x00}, }; +static const struct iio_event_spec us5182d_events[] = { + { + .type = IIO_EV_TYPE_THRESH, + .dir = IIO_EV_DIR_RISING, + .mask_separate = BIT(IIO_EV_INFO_VALUE) | + BIT(IIO_EV_INFO_ENABLE), + }, + { + .type = IIO_EV_TYPE_THRESH, + .dir = IIO_EV_DIR_FALLING, + .mask_separate = BIT(IIO_EV_INFO_VALUE) | + BIT(IIO_EV_INFO_ENABLE), + }, +}; + static const struct iio_chan_spec us5182d_channels[] = { { .type = IIO_LIGHT, @@ -161,6 +198,8 @@ static const struct iio_chan_spec us5182d_channels[] = { { .type = IIO_PROXIMITY, .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), + .event_spec = us5182d_events, + .num_event_specs = ARRAY_SIZE(us5182d_events), } }; @@ -487,11 +526,201 @@ static int us5182d_write_raw(struct iio_dev *indio_dev, return -EINVAL; } +static int us5182d_setup_prox(struct iio_dev *indio_dev, + enum iio_event_direction dir, u16 val) +{ + struct us5182d_data *data = iio_priv(indio_dev); + + if (dir == IIO_EV_DIR_FALLING) + return i2c_smbus_write_word_data(data->client, + US5182D_REG_PXL_TH, val); + else if (dir == IIO_EV_DIR_RISING) + return i2c_smbus_write_word_data(data->client, + US5182D_REG_PXH_TH, val); + + return 0; +} + +static int us5182d_read_thresh(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, enum iio_event_type type, + enum iio_event_direction dir, enum iio_event_info info, int *val, + int *val2) +{ + struct us5182d_data *data = iio_priv(indio_dev); + + switch (dir) { + case IIO_EV_DIR_RISING: + mutex_lock(&data->lock); + *val = data->px_high_th; + mutex_unlock(&data->lock); + break; + case IIO_EV_DIR_FALLING: + mutex_lock(&data->lock); + *val = data->px_low_th; + mutex_unlock(&data->lock); + break; + default: + return -EINVAL; + } + + return IIO_VAL_INT; +} + +static int us5182d_write_thresh(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, enum iio_event_type type, + enum iio_event_direction dir, enum iio_event_info info, int val, + int val2) +{ + struct us5182d_data *data = iio_priv(indio_dev); + int ret; + + if (val < 0 || val > USHRT_MAX || val2 != 0) + return -EINVAL; + + switch (dir) { + case IIO_EV_DIR_RISING: + mutex_lock(&data->lock); + if (data->rising_en) { + ret = us5182d_setup_prox(indio_dev, dir, val); + if (ret < 0) + goto err; + } + data->px_high_th = val; + mutex_unlock(&data->lock); + break; + case IIO_EV_DIR_FALLING: + mutex_lock(&data->lock); + if (data->falling_en) { + ret = us5182d_setup_prox(indio_dev, dir, val); + if (ret < 0) + goto err; + } + data->px_low_th = val; + mutex_unlock(&data->lock); + break; + default: + return -EINVAL; + } + + return 0; +err: + mutex_unlock(&data->lock); + return ret; +} + +static int us5182d_read_event_config(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, enum iio_event_type type, + enum iio_event_direction dir) +{ + struct us5182d_data *data = iio_priv(indio_dev); + int ret; + + switch (dir) { + case IIO_EV_DIR_RISING: + mutex_lock(&data->lock); + ret = data->rising_en; + mutex_unlock(&data->lock); + break; + case IIO_EV_DIR_FALLING: + mutex_lock(&data->lock); + ret = data->falling_en; + mutex_unlock(&data->lock); + break; + default: + ret = -EINVAL; + break; + } + + return ret; +} + +static int us5182d_write_event_config(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, enum iio_event_type type, + enum iio_event_direction dir, int state) +{ + struct us5182d_data *data = iio_priv(indio_dev); + int ret; + u16 new_th; + + mutex_lock(&data->lock); + + switch (dir) { + case IIO_EV_DIR_RISING: + if (data->rising_en == state) { + mutex_unlock(&data->lock); + return 0; + } + new_th = US5182D_PXH_TH_DISABLE; + if (state) { + data->power_mode = US5182D_CONTINUOUS; + ret = us5182d_set_power_state(data, true); + if (ret < 0) + goto err; + ret = us5182d_px_enable(data); + if (ret < 0) + goto err_poweroff; + new_th = data->px_high_th; + } + ret = us5182d_setup_prox(indio_dev, dir, new_th); + if (ret < 0) + goto err_poweroff; + data->rising_en = state; + break; + case IIO_EV_DIR_FALLING: + if (data->falling_en == state) { + mutex_unlock(&data->lock); + return 0; + } + new_th = US5182D_PXL_TH_DISABLE; + if (state) { + data->power_mode = US5182D_CONTINUOUS; + ret = us5182d_set_power_state(data, true); + if (ret < 0) + goto err; + ret = us5182d_px_enable(data); + if (ret < 0) + goto err_poweroff; + new_th = data->px_low_th; + } + ret = us5182d_setup_prox(indio_dev, dir, new_th); + if (ret < 0) + goto err_poweroff; + data->falling_en = state; + break; + default: + ret = -EINVAL; + goto err; + } + + if (!state) { + ret = us5182d_set_power_state(data, false); + if (ret < 0) + goto err; + } + + if (!data->falling_en && !data->rising_en && !data->default_continuous) + data->power_mode = US5182D_ONESHOT; + + mutex_unlock(&data->lock); + return 0; + +err_poweroff: + if (state) + us5182d_set_power_state(data, false); +err: + mutex_unlock(&data->lock); + return ret; +} + static const struct iio_info us5182d_info = { .driver_module = THIS_MODULE, .read_raw = us5182d_read_raw, .write_raw = us5182d_write_raw, .attrs = &us5182d_attr_group, + .read_event_value = &us5182d_read_thresh, + .write_event_value = &us5182d_write_thresh, + .read_event_config = &us5182d_read_event_config, + .write_event_config = &us5182d_write_event_config, }; static int us5182d_reset(struct iio_dev *indio_dev) @@ -513,6 +742,9 @@ static int us5182d_init(struct iio_dev *indio_dev) data->opmode = 0; data->power_mode = US5182D_CONTINUOUS; + data->px_low_th = US5182D_REG_PXL_TH_DEFAULT; + data->px_high_th = US5182D_REG_PXH_TH_DEFAULT; + for (i = 0; i < ARRAY_SIZE(us5182d_regvals); i++) { ret = i2c_smbus_write_byte_data(data->client, us5182d_regvals[i].reg, @@ -583,6 +815,33 @@ static int us5182d_dark_gain_config(struct iio_dev *indio_dev) US5182D_REG_DARK_AUTO_EN_DEFAULT); } +static irqreturn_t us5182d_irq_thread_handler(int irq, void *private) +{ + struct iio_dev *indio_dev = private; + struct us5182d_data *data = iio_priv(indio_dev); + enum iio_event_direction dir; + int ret; + u64 ev; + + ret = i2c_smbus_read_byte_data(data->client, US5182D_REG_CFG0); + if (ret < 0) { + dev_err(&data->client->dev, "i2c transfer error in irq\n"); + return IRQ_HANDLED; + } + + dir = ret & US5182D_CFG0_PROX ? IIO_EV_DIR_RISING : IIO_EV_DIR_FALLING; + ev = IIO_UNMOD_EVENT_CODE(IIO_PROXIMITY, 1, IIO_EV_TYPE_THRESH, dir); + + iio_push_event(indio_dev, ev, iio_get_time_ns()); + + ret = i2c_smbus_write_byte_data(data->client, US5182D_REG_CFG0, + ret & ~US5182D_CFG0_PX_IRQ); + if (ret < 0) + dev_err(&data->client->dev, "i2c transfer error in irq\n"); + + return IRQ_HANDLED; +} + static int us5182d_probe(struct i2c_client *client, const struct i2c_device_id *id) { @@ -614,6 +873,16 @@ static int us5182d_probe(struct i2c_client *client, return (ret < 0) ? ret : -ENODEV; } + if (client->irq > 0) { + ret = devm_request_threaded_irq(&client->dev, client->irq, NULL, + us5182d_irq_thread_handler, + IRQF_TRIGGER_LOW | IRQF_ONESHOT, + "us5182d-irq", indio_dev); + if (ret < 0) + return ret; + } else + dev_warn(&client->dev, "no valid irq found\n"); + us5182d_get_platform_data(indio_dev); ret = us5182d_init(indio_dev); if (ret < 0) From 9b1de75b5deea3e56bfb76d19d71ec599fcc803b Mon Sep 17 00:00:00 2001 From: Adriana Reus Date: Mon, 14 Dec 2015 14:24:47 +0200 Subject: [PATCH 838/843] iio: light: us5182d: Refactor read_raw function A bit of refactoring for better readability. Moved and slightly reorganized all the activity necessary for reading als and proximity into a different function. This way the switch in read raw becomes clearer and more compact. Signed-off-by: Adriana Reus Signed-off-by: Jonathan Cameron --- drivers/iio/light/us5182d.c | 155 ++++++++++++++++++------------------ 1 file changed, 78 insertions(+), 77 deletions(-) diff --git a/drivers/iio/light/us5182d.c b/drivers/iio/light/us5182d.c index 213f7785095f..45bc2f742f46 100644 --- a/drivers/iio/light/us5182d.c +++ b/drivers/iio/light/us5182d.c @@ -203,23 +203,6 @@ static const struct iio_chan_spec us5182d_channels[] = { } }; -static int us5182d_get_als(struct us5182d_data *data) -{ - int ret; - unsigned long result; - - ret = i2c_smbus_read_word_data(data->client, - US5182D_REG_ADL); - if (ret < 0) - return ret; - - result = ret * data->ga / US5182D_GA_RESOLUTION; - if (result > 0xffff) - result = 0xffff; - - return result; -} - static int us5182d_oneshot_en(struct us5182d_data *data) { int ret; @@ -324,6 +307,39 @@ static int us5182d_px_enable(struct us5182d_data *data) return 0; } +static int us5182d_get_als(struct us5182d_data *data) +{ + int ret; + unsigned long result; + + ret = us5182d_als_enable(data); + if (ret < 0) + return ret; + + ret = i2c_smbus_read_word_data(data->client, + US5182D_REG_ADL); + if (ret < 0) + return ret; + + result = ret * data->ga / US5182D_GA_RESOLUTION; + if (result > 0xffff) + result = 0xffff; + + return result; +} + +static int us5182d_get_px(struct us5182d_data *data) +{ + int ret; + + ret = us5182d_px_enable(data); + if (ret < 0) + return ret; + + return i2c_smbus_read_word_data(data->client, + US5182D_REG_PDL); +} + static int us5182d_shutdown_en(struct us5182d_data *data, u8 state) { int ret; @@ -370,6 +386,46 @@ static int us5182d_set_power_state(struct us5182d_data *data, bool on) return ret; } +static int us5182d_read_value(struct us5182d_data *data, + struct iio_chan_spec const *chan) +{ + int ret, value; + + mutex_lock(&data->lock); + + if (data->power_mode == US5182D_ONESHOT) { + ret = us5182d_oneshot_en(data); + if (ret < 0) + goto out_err; + } + + ret = us5182d_set_power_state(data, true); + if (ret < 0) + goto out_err; + + if (chan->type == IIO_LIGHT) + ret = us5182d_get_als(data); + else + ret = us5182d_get_px(data); + if (ret < 0) + goto out_poweroff; + + value = ret; + + ret = us5182d_set_power_state(data, false); + if (ret < 0) + goto out_err; + + mutex_unlock(&data->lock); + return value; + +out_poweroff: + us5182d_set_power_state(data, false); +out_err: + mutex_unlock(&data->lock); + return ret; +} + static int us5182d_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val, int *val2, long mask) @@ -379,76 +435,21 @@ static int us5182d_read_raw(struct iio_dev *indio_dev, switch (mask) { case IIO_CHAN_INFO_RAW: - switch (chan->type) { - case IIO_LIGHT: - mutex_lock(&data->lock); - if (data->power_mode == US5182D_ONESHOT) { - ret = us5182d_oneshot_en(data); - if (ret < 0) - goto out_err; - } - ret = us5182d_set_power_state(data, true); - if (ret < 0) - goto out_err; - ret = us5182d_als_enable(data); - if (ret < 0) - goto out_poweroff; - ret = us5182d_get_als(data); - if (ret < 0) - goto out_poweroff; - *val = ret; - ret = us5182d_set_power_state(data, false); - if (ret < 0) - goto out_err; - mutex_unlock(&data->lock); - return IIO_VAL_INT; - case IIO_PROXIMITY: - mutex_lock(&data->lock); - if (data->power_mode == US5182D_ONESHOT) { - ret = us5182d_oneshot_en(data); - if (ret < 0) - goto out_err; - } - ret = us5182d_set_power_state(data, true); - if (ret < 0) - goto out_err; - ret = us5182d_px_enable(data); - if (ret < 0) - goto out_poweroff; - ret = i2c_smbus_read_word_data(data->client, - US5182D_REG_PDL); - if (ret < 0) - goto out_poweroff; - *val = ret; - ret = us5182d_set_power_state(data, false); - if (ret < 0) - goto out_err; - mutex_unlock(&data->lock); - return IIO_VAL_INT; - default: - return -EINVAL; - } - + ret = us5182d_read_value(data, chan); + if (ret < 0) + return ret; + *val = ret; + return IIO_VAL_INT; case IIO_CHAN_INFO_SCALE: ret = i2c_smbus_read_byte_data(data->client, US5182D_REG_CFG1); if (ret < 0) return ret; - *val = 0; *val2 = us5182d_scales[ret & US5182D_AGAIN_MASK]; - return IIO_VAL_INT_PLUS_MICRO; default: return -EINVAL; } - - return -EINVAL; - -out_poweroff: - us5182d_set_power_state(data, false); -out_err: - mutex_unlock(&data->lock); - return ret; } /** From e8aab48b34d3bd069dfcf4ccb8f13ba8c98f7845 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Tue, 22 Dec 2015 18:51:27 +0000 Subject: [PATCH 839/843] iio: adc: ina2xx: Fix incorrect report of data endianness to userspace. This was extracted from a reposting of the driver after it had been applied to the IIO tree. I have fast tracked it as the driver will be in 4.5 and it would be nice to fix this trivial issue before it is. Signed-off-by: Jonathan Cameron --- drivers/iio/adc/ina2xx-adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c index bd56adaeec05..d803e5018a42 100644 --- a/drivers/iio/adc/ina2xx-adc.c +++ b/drivers/iio/adc/ina2xx-adc.c @@ -400,7 +400,7 @@ static ssize_t ina2xx_shunt_resistor_store(struct device *dev, .sign = 'u', \ .realbits = 16, \ .storagebits = 16, \ - .endianness = IIO_LE, \ + .endianness = IIO_CPU, \ } \ } From 2bc29a1abc5c1b89576f8ae864cce9c07d18fd44 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Wed, 25 Nov 2015 16:09:10 +0100 Subject: [PATCH 840/843] staging: gdm72xx: Replace timeval with ktime_t struct sdu_stamp in the gdm_sdio.h is a timeval type. 'struct timeval now' is used for calculating elapsed time. 32-bit systems using 'struct timeval' will break in the year 2038, so we have to replace that code with more appropriate types. This patch changes the gdm72xx driver to use ktime_t. ktime_get() is better than using do_gettimeofday(), because it uses the monotonic clock. ktime_sub are used to subtract two ktime variables. Build tested this by saying Y to WIMAX_GDM72XX. Signed-off-by: Tapasweni Pathak Reviewed-by: Arnd Bergmann Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm72xx/gdm_sdio.c | 13 ++++++------- drivers/staging/gdm72xx/gdm_sdio.h | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/staging/gdm72xx/gdm_sdio.c b/drivers/staging/gdm72xx/gdm_sdio.c index b0521da3c793..1f5a087723ba 100644 --- a/drivers/staging/gdm72xx/gdm_sdio.c +++ b/drivers/staging/gdm72xx/gdm_sdio.c @@ -36,7 +36,7 @@ #define RX_BUF_SIZE (25*1024) #define TX_HZ 2000 -#define TX_INTERVAL (1000000/TX_HZ) +#define TX_INTERVAL (NSEC_PER_SEC/TX_HZ) static struct sdio_tx *alloc_tx_struct(struct tx_cxt *tx) { @@ -303,7 +303,7 @@ static void send_sdu(struct sdio_func *func, struct tx_cxt *tx) put_tx_struct(t->tx_cxt, t); } - do_gettimeofday(&tx->sdu_stamp); + tx->sdu_stamp = ktime_get(); spin_unlock_irqrestore(&tx->lock, flags); } @@ -330,7 +330,7 @@ static void do_tx(struct work_struct *work) struct sdio_func *func = sdev->func; struct tx_cxt *tx = &sdev->tx; struct sdio_tx *t = NULL; - struct timeval now, *before; + ktime_t now, before; int is_sdu = 0; long diff; unsigned long flags; @@ -346,11 +346,10 @@ static void do_tx(struct work_struct *work) list_del(&t->list); is_sdu = 0; } else if (!tx->stop_sdu_tx && !list_empty(&tx->sdu_list)) { - do_gettimeofday(&now); - before = &tx->sdu_stamp; + now = ktime_get(); + before = tx->sdu_stamp; - diff = (now.tv_sec - before->tv_sec) * 1000000 + - (now.tv_usec - before->tv_usec); + diff = ktime_to_ns(ktime_sub(now, before)); if (diff >= 0 && diff < TX_INTERVAL) { schedule_work(&sdev->ws); spin_unlock_irqrestore(&tx->lock, flags); diff --git a/drivers/staging/gdm72xx/gdm_sdio.h b/drivers/staging/gdm72xx/gdm_sdio.h index 77ad9d686f8e..aa7dad22a219 100644 --- a/drivers/staging/gdm72xx/gdm_sdio.h +++ b/drivers/staging/gdm72xx/gdm_sdio.h @@ -15,7 +15,7 @@ #define __GDM72XX_GDM_SDIO_H__ #include -#include +#include #define MAX_NR_SDU_BUF 64 @@ -32,7 +32,7 @@ struct tx_cxt { struct list_head free_list; struct list_head sdu_list; struct list_head hci_list; - struct timeval sdu_stamp; + ktime_t sdu_stamp; u8 *sdu_buf; spinlock_t lock; int can_send; From d1052aa5692d08aa4a058507ff5721317d2bef75 Mon Sep 17 00:00:00 2001 From: Wim de With Date: Fri, 11 Dec 2015 10:25:13 +0100 Subject: [PATCH 841/843] staging: gdm72xx: add userspace data struct This fixes the sparse warnings about dereferencing a userspace pointer. Once I updated the sparse annotations, I noticed a bug in gdm_wimax_ioctl() where we pass a user space pointer to gdm_update_fsm() which dereferences it. I fixed this. Signed-off-by: Wim de With Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm72xx/gdm_wimax.c | 12 ++++++++---- drivers/staging/gdm72xx/wm_ioctl.h | 7 ++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/staging/gdm72xx/gdm_wimax.c b/drivers/staging/gdm72xx/gdm_wimax.c index b8eea21f2655..ba03f9386567 100644 --- a/drivers/staging/gdm72xx/gdm_wimax.c +++ b/drivers/staging/gdm72xx/gdm_wimax.c @@ -363,7 +363,7 @@ static void kdelete(void **buf) } } -static int gdm_wimax_ioctl_get_data(struct data_s *dst, struct data_s *src) +static int gdm_wimax_ioctl_get_data(struct udata_s *dst, struct data_s *src) { int size; @@ -379,7 +379,7 @@ static int gdm_wimax_ioctl_get_data(struct data_s *dst, struct data_s *src) return 0; } -static int gdm_wimax_ioctl_set_data(struct data_s *dst, struct data_s *src) +static int gdm_wimax_ioctl_set_data(struct data_s *dst, struct udata_s *src) { if (!src->size) { dst->size = 0; @@ -455,6 +455,7 @@ static int gdm_wimax_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) struct wm_req_s *req = (struct wm_req_s *)ifr; struct nic *nic = netdev_priv(dev); int ret; + struct fsm_s fsm_buf; if (cmd != SIOCWMIOCTL) return -EOPNOTSUPP; @@ -477,8 +478,11 @@ static int gdm_wimax_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) /* NOTE: gdm_update_fsm should be called * before gdm_wimax_ioctl_set_data is called. */ - gdm_update_fsm(dev, - req->data.buf); + if (copy_from_user(&fsm_buf, req->data.buf, + sizeof(struct fsm_s))) + return -EFAULT; + + gdm_update_fsm(dev, &fsm_buf); } ret = gdm_wimax_ioctl_set_data( &nic->sdk_data[req->data_id], &req->data); diff --git a/drivers/staging/gdm72xx/wm_ioctl.h b/drivers/staging/gdm72xx/wm_ioctl.h index ed8f649c0042..631cb1d23c7e 100644 --- a/drivers/staging/gdm72xx/wm_ioctl.h +++ b/drivers/staging/gdm72xx/wm_ioctl.h @@ -78,13 +78,18 @@ struct data_s { void *buf; }; +struct udata_s { + int size; + void __user *buf; +}; + struct wm_req_s { union { char ifrn_name[IFNAMSIZ]; } ifr_ifrn; unsigned short cmd; unsigned short data_id; - struct data_s data; + struct udata_s data; /* NOTE: sizeof(struct wm_req_s) must be less than sizeof(struct ifreq). */ }; From e16a48845deefc417738b22a801e94486abd1d6f Mon Sep 17 00:00:00 2001 From: Aya Mahfouz Date: Tue, 15 Dec 2015 01:27:27 +0200 Subject: [PATCH 842/843] staging: gdm724x: constify tty_port_operations structs Constifies tty_port_operations structure in the tty code of the gdm724x driver since it is not modified after its initialization. Detected and found using Coccinelle. Suggested-by: Julia Lawall Signed-off-by: Aya Mahfouz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm724x/gdm_tty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/gdm724x/gdm_tty.c b/drivers/staging/gdm724x/gdm_tty.c index e2c0f228f369..eb7e2523c354 100644 --- a/drivers/staging/gdm724x/gdm_tty.c +++ b/drivers/staging/gdm724x/gdm_tty.c @@ -64,7 +64,7 @@ static void gdm_port_destruct(struct tty_port *port) kfree(gdm); } -static struct tty_port_operations gdm_port_ops = { +static const struct tty_port_operations gdm_port_ops = { .destruct = gdm_port_destruct, }; From 841e3ed977e0284e3680d6345d880a64e8072573 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 8 Jan 2016 21:00:08 -0800 Subject: [PATCH 843/843] Revert "arm64: dts: Add dts files to enable ION on Hi6220 SoC." This reverts commit 59dfafd03fc67d38307d2ba30bbfdd1224b8a75d Mark Brown reports that the dts file should not be accepted at this time as it is not following the convention that has been agreed on for the ion drivers. Reported-by: Mark Brown Cc: Mark Rutland Cc: Chen Feng Cc: Yu Dongbin Signed-off-by: Greg Kroah-Hartman --- .../arm64/boot/dts/hisilicon/hi6220-hikey.dts | 1 - arch/arm64/boot/dts/hisilicon/hi6220-ion.dtsi | 20 ------------------- 2 files changed, 21 deletions(-) delete mode 100644 arch/arm64/boot/dts/hisilicon/hi6220-ion.dtsi diff --git a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts index 496a920eced4..8d43a0fce522 100644 --- a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts +++ b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts @@ -11,7 +11,6 @@ /memreserve/ 0x05e00000 0x00100000; #include "hi6220.dtsi" -#include "hi6220-ion.dtsi" / { model = "HiKey Development Board"; diff --git a/arch/arm64/boot/dts/hisilicon/hi6220-ion.dtsi b/arch/arm64/boot/dts/hisilicon/hi6220-ion.dtsi deleted file mode 100644 index c79f2cea314c..000000000000 --- a/arch/arm64/boot/dts/hisilicon/hi6220-ion.dtsi +++ /dev/null @@ -1,20 +0,0 @@ -/ { - hi6220-ion { - compatible = "hisilicon,hi6220-ion"; - heap_sys_user@0 { - heap-name = "sys_user"; - heap-id = <0x0>; - heap-base = <0x0>; - heap-size = <0x0>; - heap-type = "ion_system"; - }; - heap_sys_contig@0 { - heap-name = "sys_contig"; - heap-id = <0x1>; - heap-base = <0x0>; - heap-size = <0x0>; - heap-type = "ion_system_contig"; - }; - }; - -};